Skip to content

Instantly share code, notes, and snippets.

View NMO13's full-sized avatar

Martin Ennemoser NMO13

View GitHub Profile
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])))