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