jingtianyilong / YOLOv4-pytorch

This is a pytorch repository of YOLOv4 that can be trained with custom dataset.
31 stars 12 forks source link

关于训练的问题 #8

Open dreamchaser-cai opened 3 years ago

dreamchaser-cai commented 3 years ago

您好可以加一下您的联系方式吗,我有一些关于这个项目训练的问题想请教一下您。

jingtianyilong commented 3 years ago

Please ask in the issue or discussion. Because I believe that your question might also be ask by others. And by answering your question, we can avoid answering same question again and again. Discussion section is also available for this project. I will check them every now and then.

dreamchaser-cai commented 3 years ago

ok,I have a problem when training this project with my own data.My data format is like this:

The txt file stored the path of the picture。then,i meet a proplem like this IndexError: too many indices for array I'm not sure if my data format is wrong,Thanks for your answering。

jingtianyilong commented 3 years ago

Well. Make sure you read the README.md before you do anything.

How to use

Dataset

The code had been heavily modified, so the COCO and VOC format are not supported currently. So pls convert your dataset from whatever format into this specific yolo format. We use text file which describing the path to the image and its bboxes. Each line would contain only one image and all the annotation about the bbox comes right after the image path. See example below:

images/00001.png x1,y1,x2,y2,class_id x1,y1,x2,y2,class_id x1,y1,x2,y2,class_id x1,y1,x2,y2,class_id 
images/00002.png x1,y1,x2,y2,class_id x1,y1,x2,y2,class_id 

x1, y1 refer to the coordinates of top left corner. x2, y2 refer to the coordinates of bottom right corner. All the coordinates are pixel wise location on the original image.

To make sure that the COCOAPI works properly, you might also have to change your image name to a number e.g. 0000234.png. Or else you might modify the get_image_id in utils/datasets.py and other function related to index respectively.

########################################################################

Also, I can't really answer your question when you only tell me that you got IndexError. Because it can be anything. Spot the line of code that dump the error and see if you can actually do something. What is this list? What does it contains? Do they have any meaning? Are they the thing you wish to have? If not, then why not? Which line modifies the list? What did it put in? You can normally source back to where the problem actually occur.

ogbanugot commented 3 years ago

Screenshot from 2021-06-25 18-18-18 Having the same issue; and my train.txt file is formatted correctly. Any idea why this is happening please?

ogbanugot commented 3 years ago

Yeah, so the problem was that some images had no bounding box annotations. So you might see images with blank spaces (highlighted in red in the image attached) in your "train.txt" file. Just remove those images and the error will go away. Screenshot from 2021-06-25 22-46-43