Darknet training yolo error - Error in load_data_detection() - OpenCV

Error message:

 If error occurs - run training with flag: -dont_show

Error in load_data_detection() - OpenCV

Troubleshooting idea 1:

Check whether there is a one-to-one correspondence between your label and the data sets in the JPEGimages folder. For example, the images in my data set are 500 bmp files, and the labels have 500 txt files. If there is one more or one less, it will not work.

Troubleshooting idea 2:

The problem of partitioning datasets

Attached is a copy of the code for partitioning the dataset. This code is used to divide the training set (train) and the verification set (val), and divide the ratio of the training set and the verification set. If you run this code and report an error, you can directly use the local python environment with anaconda.

import os
import random



def convert(image_dir,train_ratio=1):
    file_list=[]
    for file in os.listdir(image_dir):
        image_file=os.path.join(image_dir,file)
        file_list.append(image_file)
    random.shuffle(file_list)
    train_count=int(len(file_list)*train_ratio)
    train_list=file_list[:train_count]
    val_list=file_list[train_count:]
    with open('train.txt','w') as f:
       f.write('\n'.join(train_list))
    with open('val.txt','w') as f:
       f.write('\n'.join(val_list))
image_dir=r'D:\1\dataset\JPEGImages'
convert(image_dir)


 

Guess you like

Origin blog.csdn.net/blink182007/article/details/130382927