Deep Learning pour les images avec PyTorch
Michal Oleszak
Machine Learning Engineer
La reconnaissance d'objets repère les objets dans les images :
Emplacement de chaque objet (boîte englobante)
Étiquette de classe de chaque objet
Applications : surveillance, diagnostic médical, gestion de la circulation, analyse sportive



![]()
Transformation avec ToTensor()
import torchvision.transforms as transformstransform = transforms.Compose([ transforms.Resize(224), transforms.ToTensor() ]) image_tensor = transform(image)
Transformation avec PILToTensor()
import torchvision.transforms as transforms
transform = transforms.Compose([
transforms.Resize(224),
transforms.PILToTensor()
])
image_tensor = transform(image)
from torchvision.utils import draw_bounding_boxesbbox = torch.tensor([x_min, y_min, x_max, y_max]) bbox = bbox.unsqueeze(0)bbox_image = draw_bounding_boxes( image_tensor, bbox, width=3, colors="red" )transform = transforms.Compose([ transforms.ToPILImage() ]) pil_image = transform(bbox_image) import matplotlib.pyplot as plt plt.imshow(pil_image)
draw_bounding_boxes
Deep Learning pour les images avec PyTorch