Last active
August 27, 2019 10:37
-
-
Save NMO13/453f66ee5c153a67ec98041f31676785 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image, ImageFont, ImageDraw, ImageEnhance | |
import torchvision.transforms.functional as F | |
# image is the tensor defined as torch.zeros((3, 800, 800)).float() | |
## visualize all centers and boxes for 1 position | |
pil_image = F.to_pil_image(image) | |
draw = ImageDraw.Draw(pil_image) | |
for anchor in anchor_base: | |
draw.rectangle(((anchor[1], anchor[0]), (anchor[3], anchor[2]))) | |
draw = ImageDraw.Draw(pil_image) | |
for center in centers: | |
draw.point((center[1], center[0]), fill="blue") | |
pil_image.show() | |
## visualize all boxes | |
pil_image = F.to_pil_image(image) | |
draw = ImageDraw.Draw(pil_image) | |
for anchor in anchors: | |
draw.rectangle(((anchor[1], anchor[0]), (anchor[3], anchor[2]))) | |
pil_image.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment