模型评价流程2

针对开源工程mAp实现,根据实际项目操作便利性,对该工程进行了改进,已使用实际项目中的物体检测场景。改进后测试步骤如下:

准备模型

这里假设你已经有了对应的测试模型

准备测试集

测试集格式为VOC标注格式

val
├── Annotations
├── JPEGImages

目录中含有1697张测试集,标注了hand_phone和hand_other两个分类

play_phone

测试测试集

使用你训练好的模型,检测你的测试集,检测后,在val目录下生成detector_out.txt文件,文件内容格式为

dectect out: hand_other: 0.953 : 4 169 26 221 :xxx/val/JPEGImages/11031011480001146_3613.jpg
dectect out: hand_phone: 0.995 : 73 79 106 148 :xxx/val/JPEGImages/11031011480001146_3613.jpg
...
dectect out: hand_other: 0.900 : 55 373 98 453 :xxx/val/JPEGImages/09161953150004444_2349.jpg
dectect out: hand_phone: 0.919 : 153 267 199 332 :xxx/val/JPEGImages/09161953150004444_2349.jpg

开始测试

生成测试txt

下载AI_Pef_tool,放到与测试集同级目录,此时目录结构为:

AI_Perf_tool

val
├── Annotations
├── JPEGImages
├── detector_out.txt

运行如下命令,转换detector_out.txt中的检测结果为每张测试图片对应一个txt文件

python AI_Perf_tool/Create_detection_ret_txt.py  -log val/detector_out.txt  -o val

运行成功后,在val目录下生成一个

val
├── Annotations
├── JPEGImages
├──detector_out.txt
├──detection_result

val/detection_result# ls
11031551160000021_527.txt
...
11031551160000191_2260.txt
11031551160000226_2978.txt
11031551160000291_2598.txt

每一个txt的内容格式为:[class_name score box]

hand_phone 0.899  36 113 179 322  

生成groud_truth txt

运行如下命令,读取val/Annotations下每一个xml文件,生成标注txt文件

python AI_Perf_tool/Create_ground_truth_txt.py  -test val

运行成功后,在val目录下,会生成groud_truth目录,目录下各个txt文件

val/ground_truth#ls
11031551160000021_527.txt
11031551160000044_3418.txt
11031551160000093_819.txt
11031551160000129_3321.txt
11031551160000178_1058.txt

每个txt的内容为:[class_name box]

hand_phone 161 57 223 176

生成各个分类AP

运行以下命令,分别读取groud_truth txt和detetion_result txt,生成Recall,Precision,Ap等指标

python AI_Perf_tool/test.py -gt val/ground_truth/ -dr  val/detection_result/ -jpg  val/JPEGImages/ -o val/

测试结果

AP

在这里插入图片描述

召回和误报率

在这里插入图片描述

Code

AI_Perf_tool

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值