Skip to content

Add mask rcnn to instance segmentation docs #5949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,14 @@ def inject_weight_metadata(app, what, name, obj, options, lines):
lines.append("")


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

if include_pattern is not None:
weights = [w for w in weights if include_pattern in str(w)]
if exclude_pattern is not None:
weights = [w for w in weights if exclude_pattern not in str(w)]
if include_patterns is not None:
weights = [w for w in weights if any(p in str(w) for p in include_patterns)]
if exclude_patterns is not None:
weights = [w for w in weights if all(p not in str(w) for p in exclude_patterns)]

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

generate_weights_table(module=M, table_name="classification", metrics=[("acc@1", "Acc@1"), ("acc@5", "Acc@5")])
generate_weights_table(
module=M.detection, table_name="detection", metrics=[("box_map", "Box MAP")], exclude_pattern="Keypoint"
module=M.detection, table_name="detection", metrics=[("box_map", "Box MAP")], exclude_patterns=["Mask", "Keypoint"]
)
generate_weights_table(
module=M.detection,
table_name="instance_segmentation",
metrics=[("box_map", "Box MAP"), ("mask_map", "Mask MAP")],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO mean average precision is short handed as mAP and not MAP? That's what I think pycocotools or other report?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen both used. No strong opinion from me

include_patterns=["Mask"],
)
generate_weights_table(
module=M.detection,
table_name="detection_keypoint",
metrics=[("box_map", "Box MAP"), ("kp_map", "Keypoint MAP")],
include_pattern="Keypoint",
include_patterns=["Keypoint"],
)
generate_weights_table(
module=M.segmentation, table_name="segmentation", metrics=[("miou", "Mean IoU"), ("pixel_acc", "pixelwise Acc")]
Expand Down
2 changes: 1 addition & 1 deletion docs/source/models/faster_rcnn.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Faster R-CNN
==========
============

.. currentmodule:: torchvision.models.detection

Expand Down
37 changes: 29 additions & 8 deletions docs/source/models_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,33 +89,54 @@ All models are evaluated on COCO val2017:



Object Detection, Instance Segmentation and Person Keypoint Detection
=====================================================================

Object Detection
================
----------------

.. currentmodule:: torchvision.models.detection

The following detection models are available, with or without pre-trained
The following object detection models are available, with or without pre-trained
weights:

.. toctree::
:maxdepth: 1

models/faster_rcnn
models/fcos
models/mask_rcnn
models/retinanet
models/ssdlite

Table of all available detection weights
----------------------------------------
Table of all available Object detection weights
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Box MAPs are reported on COCO

.. include:: generated/detection_table.rst

Instance Segmentation
---------------------

.. currentmodule:: torchvision.models.detection

The following instance segmentation models are available, with or without pre-trained
weights:

.. toctree::
:maxdepth: 1

models/mask_rcnn

Table of all available Instance segmentation weights
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Box and Mask MAPs are reported on COCO

.. include:: generated/instance_segmentation_table.rst

Keypoint detection
==================
Keypoint Detection
------------------

.. currentmodule:: torchvision.models.detection

Expand All @@ -128,7 +149,7 @@ pre-trained weights:
models/keypoint_rcnn

Table of all available Keypoint detection weights
-------------------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Box and Keypoint MAPs are reported on COCO:

Expand Down