YOLOv6训练自己的数据集运行报错:AttributeError: module ‘tools.eval‘ has no attribute ‘run‘

YOLOv6与其他YOLO系列的终端运行略有不同

准备好数据集,GitHub上直接下载下来的源代码直接运行

运行如下:

python tools/train.py --batch 16 --conf YOLOv6\configs\yolov6l.py('建议使用绝对路径') --data datasets\data\data.yaml('同样使用绝对路径') --device 0 --write_trainbatch_tb --fuse_ab

YOLOv6的mAP值是每运行20次进行一次精度评价

报错也是在这个时候出现的:

AttributeError: module 'tools.eval' has no attribute 'run'

ERROR in training loop or eval/save model.
AttributeError: module 'tools.eval' has no attribute 'run'

解决方法如下:

首先修改tools文件下train.py的内容:

'如果对代码没做过任何改动,这行代码在你的14-16行'
#原代码
ROOT = os.getcwd()
if str(ROOT) not in sys.path:
    sys.path.append(str(ROOT))

#修改后
ROOT = os.getcwd()
if str(ROOT) not in sys.path:
    sys.path.insert(0,str(ROOT))

然后再tools文件下新建一个空白的__init__.py文件即可。

修改过后,重新运行到第20个epoch时,将会输出类似如下的内容:

Inferencing model in train datasets.: 100%|███████████████████████████| 8/8 [00:15<00:00,  1.90s/it]

Evaluating speed.

Evaluating mAP by pycocotools.
Saving runs\train\exp1\predictions.json...
loading annotations into memory...
Done (t=0.09s)
creating index...
index created!
Loading and preparing results...
DONE (t=0.47s)
creating index...
index created!
Running per image evaluation...
Evaluate annotation type *bbox*
DONE (t=3.50s).
Accumulating evaluation results...
DONE (t=0.26s).
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.282
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.640
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.194
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.284
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.156
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.059
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.325
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.499
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.503
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.417
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
Results saved to runs\train\exp1
Epoch: 19 | mAP@0.5: 0.6396783849377471 | mAP@0.50:0.95: 0.2820219739865932

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值