MMDetection——COCO格式数据集显示单类别AP

问题

COCO格式数据集如何在MMDetection中显示单类别AP

解决方案

1. 进入mmdet/datasets/coco.py

2. 修改363行中的evaluate函数参数:classwise=True

3. iou_thrs可根据自己的情况看是否修改,(输入需是包含float数据的List)

def evaluate(self,
                 results,
                 metric='bbox',
                 logger=None,
                 jsonfile_prefix=None,
                 classwise=True,
                 proposal_nums=(100, 300, 1000),
                 iou_thrs=None,
                 metric_items=None):
        """Evaluation in COCO protocol.

        Args:
            results (list[list | tuple]): Testing results of the dataset.
            metric (str | list[str]): Metrics to be evaluated. Options are
                'bbox', 'segm', 'proposal', 'proposal_fast'.
            logger (logging.Logger | str | None): Logger used for printing
                related information during evaluation. Default: None.
            jsonfile_prefix (str | None): The prefix of json files. It includes
                the file path and the prefix of filename, e.g., "a/b/prefix".
                If not specified, a temp file will be created. Default: None.
            classwise (bool): Whether to evaluating the AP for each class.
            proposal_nums (Sequence[int]): Proposal number used for evaluating
                recalls, such as recall@100, recall@1000.
                Default: (100, 300, 1000).
            iou_thrs (Sequence[float], optional): IoU threshold used for
                evaluating recalls/mAPs. If set to a list, the average of all
                IoUs will also be computed. If not specified, [0.50, 0.55,
                0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95] will be used.
                Default: None.
            metric_items (list[str] | str, optional): Metric items that will
                be returned. If not specified, ``['AR@100', 'AR@300',
                'AR@1000', 'AR_s@1000', 'AR_m@1000', 'AR_l@1000' ]`` will be
                used when ``metric=='proposal'``, ``['mAP', 'mAP_50', 'mAP_75',
                'mAP_s', 'mAP_m', 'mAP_l']`` will be used when
                ``metric=='bbox' or metric=='segm'``.

        Returns:
            dict[str, float]: COCO style evaluation metric.
        """

  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
要使用MMDetection训练类别数据集,你需要进行以下步骤: 1. 准备数据:首先,你需要准备你的类别数据集。确保你的数据集包含图像和相应的标注文件,标注文件应该包含每个目标的类别和边界框信息。 2. 修改配置文件:在MMDetection的配置文件中,你需要修改一些参数以适应你的类别数据集。你可以在mmdetection/configs文件夹下找到相应的配置文件。例如,如果你想使用Cascade R-CNN模型,你可以修改cascade_rcnn_r50_fpn_1x.py配置文件。在配置文件中,你需要修改类别数量、数据集路径和其他相关参数。 3. 训练模型:使用修改后的配置文件,你可以开始训练你的模型。你可以使用命令行工具运行训练命令,例如: ``` python tools/train.py <配置文件路径> ``` 这将开始使用你的类别数据集训练模型。 4. 评估模型:在训练完成后,你可以使用测试集对模型进行评估。你可以使用命令行工具运行评估命令,例如: ``` python tools/test.py <配置文件路径> <模型权重路径> --eval <评估指标> ``` 这将使用你的测试集对模型进行评估,并输出相应的评估结果。 请注意,以上步骤只是一个大致的指导,具体的操作可能会因你的数据集和需求而有所不同。你可以根据MMDetection的文档和示例进行更详细的操作。\[1\]\[2\]\[3\] #### 引用[.reference_title] - *1* *3* [使用MMDetection训练自己的数据集](https://blog.csdn.net/ECHOSON/article/details/119959863)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [mmdetection训练voc数据集](https://blog.csdn.net/qq_39435411/article/details/121122322)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值