2021/5/18 voc原数据集 yolov4训练
1设置 config, train
1)MODEL_TYPE = { "TYPE": "YOLOv4" } # YOLO type:YOLOv4, Mobilenet-YOLOv4 or Mobilenetv3-YOLOv4 CONV_TYPE = {"TYPE": "GENERAL"} # conv type:DO_CONV or GENERAL ATTENTION = {"TYPE": "NONE"} # attention type:SEnet、CBAM or NONE # train TRAIN = { "DATA_TYPE": "VOC", # DATA_TYPE: VOC ,COCO or Customer "TRAIN_IMG_SIZE": 416, "AUGMENT": True, "BATCH_SIZE": 2, "MULTI_SCALE_TRAIN": True, "IOU_THRESHOLD_LOSS": 0.5, "YOLO_EPOCHS": 50, "Mobilenet_YOLO_EPOCHS": 120, "NUMBER_WORKERS": 2, "MOMENTUM": 0.9, "WEIGHT_DECAY": 0.0005, "LR_INIT": 1e-4, "LR_END": 1e-6, "WARMUP_EPOCHS": 2, # or None "showatt": False } # val VAL = { "TEST_IMG_SIZE": 416, "BATCH_SIZE": 2, "NUMBER_WORKERS": 2, "CONF_THRESH": 0.005, "NMS_THRESH": 0.45, "MULTI_SCALE_VAL": False, "FLIP_VAL": False, "Visual": False, "showatt": False }
2)parser.add_argument('--weight_path', type=str, default='weight/yolov4.weights', help='weight file path')#weight/darknet53_448.weights#修改权重
2结果
[2021-05-17 23:35:44,342]-[train.py line:235]: === Epoch:[ 30/50],step:[2500/2505],img_size:[384],total_loss:17.8603|loss_ciou:3.8230|loss_conf:6.3693|loss_cls:7.6680|lr:0.0001 [2021-05-17 23:35:45,728]-[train.py line:279]:===== Validate ===== [2021-05-17 23:35:45,728]-[train.py line:281]:val img size is 416 Traceback (most recent call last): File "C:/GitHub/YOLOv4-pytorch/train.py", line 346, in <module> fp_16=opt.fp_16, File "C:/GitHub/YOLOv4-pytorch/train.py", line 284, in train self.yolov4, showatt=self.showatt File "C:\GitHub\YOLOv4-pytorch\eval\evaluator.py", line 44, in APs_voc with open(img_inds_file, "r") as f: FileNotFoundError: [Errno 2] No such file or directory: 'C:\\GitHub\\YOLOv4-pytorch\\data\\VOCtest-2007\\VOCdevkit\\VOC2007\\ImageSets\\Main\\test.txt'
3分析
...文件路径错误 or 路径下没有路径
需要修改 evaluator.py 文件