Skip to content

Commit 09a6089

Browse files
jdsgomesNicolasHug
authored andcommitted
[fbsync] Add mask rcnn to instance segmentation docs (#5949)
Summary: * Add mask rcnn to instance segmentation * Add docs a use nicolas suggestion * remov param * remov docsstring, edit docs * Add one section level Reviewed By: YosuaMichael Differential Revision: D36204384 fbshipit-source-id: 2a9f2f7d524b725ac18f9c9149319e6f1fea6da5 Co-authored-by: Nicolas Hug <[email protected]>
1 parent b678f24 commit 09a6089

File tree

3 files changed

+43
-16
lines changed

3 files changed

+43
-16
lines changed

docs/source/conf.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -348,14 +348,14 @@ def inject_weight_metadata(app, what, name, obj, options, lines):
348348
lines.append("")
349349

350350

351-
def generate_weights_table(module, table_name, metrics, include_pattern=None, exclude_pattern=None):
351+
def generate_weights_table(module, table_name, metrics, include_patterns=None, exclude_patterns=None):
352352
weight_enums = [getattr(module, name) for name in dir(module) if name.endswith("_Weights")]
353353
weights = [w for weight_enum in weight_enums for w in weight_enum]
354354

355-
if include_pattern is not None:
356-
weights = [w for w in weights if include_pattern in str(w)]
357-
if exclude_pattern is not None:
358-
weights = [w for w in weights if exclude_pattern not in str(w)]
355+
if include_patterns is not None:
356+
weights = [w for w in weights if any(p in str(w) for p in include_patterns)]
357+
if exclude_patterns is not None:
358+
weights = [w for w in weights if all(p not in str(w) for p in exclude_patterns)]
359359

360360
metrics_keys, metrics_names = zip(*metrics)
361361
column_names = ["Weight"] + list(metrics_names) + ["Params", "Recipe"]
@@ -383,13 +383,19 @@ def generate_weights_table(module, table_name, metrics, include_pattern=None, ex
383383

384384
generate_weights_table(module=M, table_name="classification", metrics=[("acc@1", "Acc@1"), ("acc@5", "Acc@5")])
385385
generate_weights_table(
386-
module=M.detection, table_name="detection", metrics=[("box_map", "Box MAP")], exclude_pattern="Keypoint"
386+
module=M.detection, table_name="detection", metrics=[("box_map", "Box MAP")], exclude_patterns=["Mask", "Keypoint"]
387+
)
388+
generate_weights_table(
389+
module=M.detection,
390+
table_name="instance_segmentation",
391+
metrics=[("box_map", "Box MAP"), ("mask_map", "Mask MAP")],
392+
include_patterns=["Mask"],
387393
)
388394
generate_weights_table(
389395
module=M.detection,
390396
table_name="detection_keypoint",
391397
metrics=[("box_map", "Box MAP"), ("kp_map", "Keypoint MAP")],
392-
include_pattern="Keypoint",
398+
include_patterns=["Keypoint"],
393399
)
394400
generate_weights_table(
395401
module=M.segmentation, table_name="segmentation", metrics=[("miou", "Mean IoU"), ("pixel_acc", "pixelwise Acc")]

docs/source/models/faster_rcnn.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Faster R-CNN
2-
==========
2+
============
33

44
.. currentmodule:: torchvision.models.detection
55

docs/source/models_new.rst

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,33 +89,54 @@ All models are evaluated on COCO val2017:
8989

9090

9191

92+
Object Detection, Instance Segmentation and Person Keypoint Detection
93+
=====================================================================
94+
9295
Object Detection
93-
================
96+
----------------
9497

9598
.. currentmodule:: torchvision.models.detection
9699

97-
The following detection models are available, with or without pre-trained
100+
The following object detection models are available, with or without pre-trained
98101
weights:
99102

100103
.. toctree::
101104
:maxdepth: 1
102105

103106
models/faster_rcnn
104107
models/fcos
105-
models/mask_rcnn
106108
models/retinanet
107109
models/ssdlite
108110

109-
Table of all available detection weights
110-
----------------------------------------
111+
Table of all available Object detection weights
112+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
111113

112114
Box MAPs are reported on COCO
113115

114116
.. include:: generated/detection_table.rst
115117

118+
Instance Segmentation
119+
---------------------
120+
121+
.. currentmodule:: torchvision.models.detection
122+
123+
The following instance segmentation models are available, with or without pre-trained
124+
weights:
125+
126+
.. toctree::
127+
:maxdepth: 1
128+
129+
models/mask_rcnn
130+
131+
Table of all available Instance segmentation weights
132+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
133+
134+
Box and Mask MAPs are reported on COCO
135+
136+
.. include:: generated/instance_segmentation_table.rst
116137

117-
Keypoint detection
118-
==================
138+
Keypoint Detection
139+
------------------
119140

120141
.. currentmodule:: torchvision.models.detection
121142

@@ -128,7 +149,7 @@ pre-trained weights:
128149
models/keypoint_rcnn
129150

130151
Table of all available Keypoint detection weights
131-
-------------------------------------------------
152+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
132153

133154
Box and Keypoint MAPs are reported on COCO:
134155

0 commit comments

Comments
 (0)