Skip to content

Commit 4c73a5e

Browse files
committed
Merge branch 'main' into prototype-datasets-inheritance
2 parents 3be12c7 + 5f74f03 commit 4c73a5e

File tree

6 files changed

+56
-78
lines changed

6 files changed

+56
-78
lines changed

.github/workflows/bandit.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/codeql.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

torchvision/datasets/flowers102.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(
6565
image_ids = set_ids[self._splits_map[self._split]].tolist()
6666

6767
labels = loadmat(self._base_folder / self._file_dict["label"][0], squeeze_me=True)
68-
image_id_to_label = dict(enumerate(labels["labels"].tolist(), 1))
68+
image_id_to_label = dict(enumerate((labels["labels"] - 1).tolist(), 1))
6969

7070
self._labels = []
7171
self._image_files = []

torchvision/models/detection/faster_rcnn.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,18 @@ class FasterRCNN_ResNet50_FPN_Weights(WeightsEnum):
393393

394394

395395
class FasterRCNN_ResNet50_FPN_V2_Weights(WeightsEnum):
396-
pass
396+
COCO_V1 = Weights(
397+
url="https://download.pytorch.org/models/fasterrcnn_resnet50_fpn_v2_coco-dd69338a.pth",
398+
transforms=ObjectDetection,
399+
meta={
400+
**_COMMON_META,
401+
"publication_year": 2021,
402+
"num_params": 43712278,
403+
"recipe": "https://github.com/pytorch/vision/pull/5763",
404+
"map": 46.7,
405+
},
406+
)
407+
DEFAULT = COCO_V1
397408

398409

399410
class FasterRCNN_MobileNet_V3_Large_FPN_Weights(WeightsEnum):

torchvision/models/detection/mask_rcnn.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,17 +349,22 @@ def __init__(self, in_channels, dim_reduced, num_classes):
349349
# nn.init.constant_(param, 0)
350350

351351

352+
_COMMON_META = {
353+
"task": "image_object_detection",
354+
"architecture": "MaskRCNN",
355+
"categories": _COCO_CATEGORIES,
356+
"interpolation": InterpolationMode.BILINEAR,
357+
}
358+
359+
352360
class MaskRCNN_ResNet50_FPN_Weights(WeightsEnum):
353361
COCO_V1 = Weights(
354362
url="https://download.pytorch.org/models/maskrcnn_resnet50_fpn_coco-bf2d0c1e.pth",
355363
transforms=ObjectDetection,
356364
meta={
357-
"task": "image_object_detection",
358-
"architecture": "MaskRCNN",
365+
**_COMMON_META,
359366
"publication_year": 2017,
360367
"num_params": 44401393,
361-
"categories": _COCO_CATEGORIES,
362-
"interpolation": InterpolationMode.BILINEAR,
363368
"recipe": "https://github.com/pytorch/vision/tree/main/references/detection#mask-r-cnn",
364369
"map": 37.9,
365370
"map_mask": 34.6,
@@ -369,7 +374,19 @@ class MaskRCNN_ResNet50_FPN_Weights(WeightsEnum):
369374

370375

371376
class MaskRCNN_ResNet50_FPN_V2_Weights(WeightsEnum):
372-
pass
377+
COCO_V1 = Weights(
378+
url="https://download.pytorch.org/models/maskrcnn_resnet50_fpn_v2_coco-73cbd019.pth",
379+
transforms=ObjectDetection,
380+
meta={
381+
**_COMMON_META,
382+
"publication_year": 2021,
383+
"num_params": 46359409,
384+
"recipe": "https://github.com/pytorch/vision/pull/5773",
385+
"map": 47.4,
386+
"map_mask": 41.8,
387+
},
388+
)
389+
DEFAULT = COCO_V1
373390

374391

375392
@handle_legacy_interface(

torchvision/models/detection/retinanet.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -672,17 +672,22 @@ def forward(self, images, targets=None):
672672
return self.eager_outputs(losses, detections)
673673

674674

675+
_COMMON_META = {
676+
"task": "image_object_detection",
677+
"architecture": "RetinaNet",
678+
"categories": _COCO_CATEGORIES,
679+
"interpolation": InterpolationMode.BILINEAR,
680+
}
681+
682+
675683
class RetinaNet_ResNet50_FPN_Weights(WeightsEnum):
676684
COCO_V1 = Weights(
677685
url="https://download.pytorch.org/models/retinanet_resnet50_fpn_coco-eeacb38b.pth",
678686
transforms=ObjectDetection,
679687
meta={
680-
"task": "image_object_detection",
681-
"architecture": "RetinaNet",
688+
**_COMMON_META,
682689
"publication_year": 2017,
683690
"num_params": 34014999,
684-
"categories": _COCO_CATEGORIES,
685-
"interpolation": InterpolationMode.BILINEAR,
686691
"recipe": "https://github.com/pytorch/vision/tree/main/references/detection#retinanet",
687692
"map": 36.4,
688693
},
@@ -691,7 +696,18 @@ class RetinaNet_ResNet50_FPN_Weights(WeightsEnum):
691696

692697

693698
class RetinaNet_ResNet50_FPN_V2_Weights(WeightsEnum):
694-
pass
699+
COCO_V1 = Weights(
700+
url="https://download.pytorch.org/models/retinanet_resnet50_fpn_v2_coco-5905b1c5.pth",
701+
transforms=ObjectDetection,
702+
meta={
703+
**_COMMON_META,
704+
"publication_year": 2019,
705+
"num_params": 38198935,
706+
"recipe": "https://github.com/pytorch/vision/pull/5756",
707+
"map": 41.5,
708+
},
709+
)
710+
DEFAULT = COCO_V1
695711

696712

697713
@handle_legacy_interface(

0 commit comments

Comments
 (0)