diff --git a/docs/source/conf.py b/docs/source/conf.py index c458e946491..1be5de77e33 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -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"] @@ -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")], + 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")] diff --git a/docs/source/models/faster_rcnn.rst b/docs/source/models/faster_rcnn.rst index 43d8c8b6f68..cbd461533ec 100644 --- a/docs/source/models/faster_rcnn.rst +++ b/docs/source/models/faster_rcnn.rst @@ -1,5 +1,5 @@ Faster R-CNN -========== +============ .. currentmodule:: torchvision.models.detection diff --git a/docs/source/models_new.rst b/docs/source/models_new.rst index cd2831e3824..2054a6a2fe1 100644 --- a/docs/source/models_new.rst +++ b/docs/source/models_new.rst @@ -89,12 +89,15 @@ 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:: @@ -102,20 +105,38 @@ weights: 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 @@ -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: