Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
542 views
in Technique[技术] by (71.8m points)

object detection - YOLO darknet retrain does not even start saying it could not find *.txt in some *labels* directory

I have been trying to retrain YOLOv3 on a custom dataset. I saved the jpg images and their corresponding txt annotation files in the same directory. I have set the my .data file, .names file and .cfg file appropriately as suggested in many tutorials online. Quite frustratingly, I have been running into the problem where it says Couldn't open file: <some-path>/labels/<some file>.txt. What is annoying here it seems to be looking for .txt files in some labels directory which neither exists, nor did I mention it anywhere. All my .jpg and .txt files are in a directory named images located at the same level as where the system is looking for this labels directory.

What is further annoying is if I do separate .txt files into a labels directory which is where the yolo darknet is looking for, this error goes away but the training never starts.

I have tried many different ways of specifying the paths, using different models, cfg files etc, but all in vain. Please help someone.

question from:https://stackoverflow.com/questions/66046534/yolo-darknet-retrain-does-not-even-start-saying-it-could-not-find-txt-in-some

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Remember, in your *.data file, you have the following settings:

classes = [Your number of classes]
train  = data/train.txt
valid  = data/test.txt
names = data/obj.names
backup = backup/

You should have data/train.txtand data/test.txt, which is a text file containining the directory list of your images.

For example, if you put all of your images and txt files at data/obj, the txt file should contain:

data/obj/1.jpg
data/obj/2.jpg
.
.
(and so on)

Then, YOLO will automatically check the corresponding label of the images, which should be having the same name (in this case: 1.txt, 2.txt, ...)

Reference: (No. 3 and 4 in https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...