79231624

Date: 2024-11-27 19:22:53
Score: 1
Natty:
Report link

As of torchvision version 0.13, the class labels are accessible from the weights class for each pretrained model (as in the documentation):

from torchvision.models import ResNet50_Weights
weights = ResNet50_Weights.DEFAULT
category_name = weights.meta["categories"][class_id]
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: robots_like_tea