IDEA-Research / detrex

detrex is a research platform for DETR-based object detection, segmentation, pose estimation and other visual recognition tasks.
https://detrex.readthedocs.io/en/latest/
Apache License 2.0
1.9k stars 199 forks source link

COCOEvaluator类与get_detection_dataset_dicts函数接受变量不一致,导致多个数据集不能同时用COCOEvaluator进行验证 #348

Open Abin0217 opened 3 weeks ago

Abin0217 commented 3 weeks ago

COCOEvaluator这个类接受的是数据集名称(str),get_detection_dataset_dicts这个函数接受的是数据集名称或者数据集列表(str or list),当get_detection_dataset_dicts接受列表变量时,COCOEvaluator不能正确获取输入 ` dataloader.test = L(build_detection_test_loader)( dataset=L(get_detection_dataset_dicts)(names=test_list, filter_empty=False), mapper=L(DetrDatasetMapper)( augmentation=[ L(T.ResizeShortestEdge)( short_edge_length=800, max_size=1333, ), ], augmentation_with_crop=None, is_train=False, mask_on=False, img_format="RGB", ), num_workers=4, )

dataloader.evaluator = L(COCOEvaluator)( dataset_name="${..test.dataset.names}", ) def get_detection_dataset_dicts( names, filter_empty=True, min_keypoints=0, proposal_files=None, check_consistency=True, ): """ Load and prepare dataset dicts for instance detection/segmentation and semantic segmentation.

Args:
    names (str or list[str]): a dataset name or a list of dataset names
    filter_empty (bool): whether to filter out images without instance annotations
    min_keypoints (int): filter out images with fewer keypoints than
        `min_keypoints`. Set to 0 to do nothing.
    proposal_files (list[str]): if given, a list of object proposal files
        that match each dataset in `names`.
    check_consistency (bool): whether to check if datasets have consistent metadata.

Returns:
    list[dict]: a list of dicts following the standard dataset dict format.
"""

class COCOEvaluator(DatasetEvaluator): """ Evaluate AR for object proposals, AP for instance detection/segmentation, AP for keypoint detection outputs using COCO's metrics. See http://cocodataset.org/#detection-eval and http://cocodataset.org/#keypoints-eval to understand its metrics. The metrics range from 0 to 100 (instead of 0 to 1), where a -1 or NaN means the metric cannot be computed (e.g. due to no predictions made).

In addition to COCO, this evaluator is able to support any bounding box detection,
instance segmentation, or keypoint detection dataset.
"""

`