AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.77k stars 7.96k forks source link

train tiny-yolo (to detect your custom objects) #3745

Open Jefflier opened 5 years ago

Jefflier commented 5 years ago

wen l run training ./darknet detector train data/obj.data yolov3-tiny-obj.cfg yolov3-tiny.conv.15 yolov3-tiny-obj something happened decay: Using default '0.000100' layer filters size input output 0 conv 16 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 16 0.150 BFLOPs 1 max 2 x 2 / 2 416 x 416 x 16 -> 208 x 208 x 16 2 conv 32 3 x 3 / 1 208 x 208 x 16 -> 208 x 208 x 32 0.399 BFLOPs 3 max 2 x 2 / 2 208 x 208 x 32 -> 104 x 104 x 32 4 conv 64 3 x 3 / 1 104 x 104 x 32 -> 104 x 104 x 64 0.399 BFLOPs 5 max 2 x 2 / 2 104 x 104 x 64 -> 52 x 52 x 64 6 conv 128 3 x 3 / 1 52 x 52 x 64 -> 52 x 52 x 128 0.399 BFLOPs 7 max 2 x 2 / 2 52 x 52 x 128 -> 26 x 26 x 128 8 conv 256 3 x 3 / 1 26 x 26 x 128 -> 26 x 26 x 256 0.399 BFLOPs 9 max 2 x 2 / 2 26 x 26 x 256 -> 13 x 13 x 256 10 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BFLOPs 11 max 2 x 2 / 1 13 x 13 x 512 -> 13 x 13 x 512 12 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs 13 conv 256 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 256 0.089 BFLOPs 14 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BFLOPs 15 conv 18 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 18 0.003 BFLOPs 16 yolo 17 route 13 18 conv 128 1 x 1 / 1 13 x 13 x 256 -> 13 x 13 x 128 0.011 BFLOPs 19 upsample 2x 13 x 13 x 128 -> 26 x 26 x 128 20 route 19 8 21 conv 256 3 x 3 / 1 26 x 26 x 384 -> 26 x 26 x 256 1.196 BFLOPs 22 conv 18 1 x 1 / 1 26 x 26 x 256 -> 26 x 26 x 18 0.006 BFLOPs 23 yolo Loading weights from yolov3-tiny.conv.15...Done! Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0001 Couldn't open file: data/train.txt

can you help me? l have check the file train.txt which contain data/obj/1.jpg data/obj/1.txt data/obj/2.jpg data/obj/3.jpg data/obj/4.jpg data/obj/5.jpg data/obj/6.jpg data/obj/9.jpg data/obj/10.jpg data/obj/11.jpg data/obj/12.jpg data/obj/13.jpg data/obj/14.jpg data/obj/15.jpg data/obj/16.jpg data/obj/17.jpg data/obj/18.jpg data/obj/20.jpg data/obj/22.jpg data/obj/23.jpg data/obj/24.jpg data/obj/25.jpg data/obj/27.jpg data/obj/28.jpg data/obj/29.jpg data/obj/30.jpg data/obj/31.jpg data/obj/32.jpg data/obj/33.jpg data/obj/34.jpg data/obj/35.jpg data/obj/36.jpg data/obj/37.jpg data/obj/38.jpg data/obj/39.jpg data/obj/40.jpg data/obj/41.jpg data/obj/43.jpg data/obj/44.jpg data/obj/45.jpg data/obj/46.jpg data/obj/47.jpg data/obj/49.jpg data/obj/50.jpg data/obj/51.jpg data/obj/52.jpg data/obj/53.jpg data/obj/54.jpg data/obj/55.jpg data/obj/56.jpg data/obj/57.jpg data/obj/58.jpg data/obj/59.jpg data/obj/61.jpg data/obj/62.jpg data/obj/64.jpg data/obj/67.jpg data/obj/68.jpg data/obj/69.jpg data/obj/70.jpg data/obj/76.jpg data/obj/79.jpg data/obj/80.jpg data/obj/81.jpg data/obj/82.jpg data/obj/83.jpg data/obj/84.jpg data/obj/85.jpg data/obj/86.jpg data/obj/87.jpg data/obj/88.jpg data/obj/89.jpg data/obj/90.jpg data/obj/91.jpg data/obj/92.jpg data/obj/93.jpg data/obj/94.jpg data/obj/95.jpg data/obj/96.jpg data/obj/97.jpg data/obj/99.jpg data/obj/100.jpg data/obj/101.jpg data/obj/102.jpg data/obj/103.jpg data/obj/104.jpg data/obj/105.jpg data/obj/106.jpg data/obj/107.jpg data/obj/108.jpg data/obj/109.jpg data/obj/111.jpg data/obj/114.jpg data/obj/116.jpg data/obj/119.jpg data/obj/120.jpg data/obj/121.jpg data/obj/122.jpg data/obj/124.jpg data/obj/126.jpg data/obj/127.jpg data/obj/128.jpg data/obj/129.jpg data/obj/132.jpg data/obj/133.jpg data/obj/134.jpg data/obj/135.jpg data/obj/136.jpg data/obj/137.jpg data/obj/139.jpg data/obj/140.jpg data/obj/141.jpg data/obj/143.jpg data/obj/144.jpg data/obj/145.jpg data/obj/146.jpg data/obj/147.jpg data/obj/148.jpg data/obj/149.jpg data/obj/150.jpg data/obj/160.jpg data/obj/161.jpg data/obj/162.jpg data/obj/163.jpg data/obj/164.jpg data/obj/165.jpg data/obj/166.jpg data/obj/167.jpg data/obj/168.jpg data/obj/169.jpg data/obj/170.jpg data/obj/171.jpg data/obj/172.jpg data/obj/173.jpg data/obj/174.jpg data/obj/175.jpg data/obj/176.jpg data/obj/177.jpg data/obj/178.jpg data/obj/179.jpg data/obj/180.jpg data/obj/181.jpg data/obj/182.jpg data/obj/183.jpg data/obj/184.jpg data/obj/186.jpg data/obj/187.jpg data/obj/188.jpg data/obj/189.jpg data/obj/190.jpg data/obj/191.jpg data/obj/192.jpg data/obj/193.jpg data/obj/194.jpg data/obj/195.jpg data/obj/196.jpg data/obj/197.jpg data/obj/198.jpg data/obj/199.jpg

thank you for help

fogx commented 5 years ago

Couldn't open file: data/train.txt

train.txt is not in the relative path data/train.txt. put it in the right place

Jefflier commented 5 years ago

l have checked that ,it is right in the darknet/data/train.txt

fogx commented 5 years ago

go to your ./darknet and writecat data/train.txt (or in windows -> darknet.exe and write more data\train.txt.)

If it says could not open file or can't access file then your path is wrong. If you followed the custom detector tutorial your path is probably build/darknet/x64/data/train.txt

Jefflier commented 5 years ago

l used cat data/train.txt,and it shows the train.txt data/obj/1.jpg data/obj/2.jpg data/obj/3.jpg data/obj/4.jpg data/obj/5.jpg data/obj/6.jpg data/obj/7.jpg data/obj/9.jpg data/obj/10.jpg data/obj/11.jpg data/obj/12.jpg data/obj/13.jpg data/obj/14.jpg data/obj/15.jpg data/obj/16.jpg data/obj/17.jpg data/obj/18.jpg data/obj/20.jpg data/obj/22.jpg data/obj/23.jpg data/obj/24.jpg data/obj/25.jpg data/obj/27.jpg data/obj/28.jpg data/obj/29.jpg data/obj/30.jpg data/obj/31.jpg data/obj/32.jpg data/obj/33.jpg data/obj/34.jpg data/obj/35.jpg data/obj/36.jpg data/obj/37.jpg data/obj/38.jpg data/obj/39.jpg data/obj/40.jpg data/obj/41.jpg data/obj/43.jpg data/obj/44.jpg data/obj/45.jpg data/obj/46.jpg data/obj/47.jpg data/obj/49.jpg data/obj/50.jpg data/obj/51.jpg data/obj/52.jpg data/obj/53.jpg data/obj/54.jpg data/obj/55.jpg data/obj/56.jpg data/obj/57.jpg data/obj/58.jpg data/obj/59.jpg data/obj/61.jpg data/obj/62.jpg data/obj/64.jpg data/obj/67.jpg data/obj/68.jpg data/obj/69.jpg data/obj/70.jpg data/obj/76.jpg data/obj/79.jpg data/obj/80.jpg data/obj/81.jpg data/obj/82.jpg data/obj/83.jpg data/obj/84.jpg data/obj/85.jpg data/obj/86.jpg data/obj/87.jpg data/obj/88.jpg data/obj/89.jpg data/obj/90.jpg data/obj/91.jpg data/obj/92.jpg data/obj/93.jpg data/obj/94.jpg data/obj/95.jpg data/obj/96.jpg data/obj/97.jpg data/obj/99.jpg data/obj/100.jpg data/obj/101.jpg data/obj/102.jpg data/obj/103.jpg data/obj/104.jpg data/obj/105.jpg data/obj/106.jpg data/obj/107.jpg data/obj/108.jpg data/obj/109.jpg data/obj/111.jpg data/obj/114.jpg data/obj/116.jpg data/obj/119.jpg data/obj/120.jpg data/obj/121.jpg data/obj/122.jpg data/obj/124.jpg data/obj/126.jpg data/obj/127.jpg data/obj/128.jpg data/obj/129.jpg data/obj/132.jpg data/obj/133.jpg data/obj/134.jpg data/obj/135.jpg data/obj/136.jpg data/obj/137.jpg data/obj/139.jpg data/obj/140.jpg data/obj/141.jpg data/obj/143.jpg data/obj/144.jpg data/obj/145.jpg data/obj/146.jpg data/obj/147.jpg data/obj/148.jpg data/obj/149.jpg data/obj/150.jpg data/obj/160.jpg data/obj/161.jpg data/obj/162.jpg data/obj/163.jpg data/obj/164.jpg data/obj/165.jpg data/obj/166.jpg data/obj/167.jpg data/obj/168.jpg data/obj/169.jpg data/obj/170.jpg data/obj/171.jpg data/obj/172.jpg data/obj/173.jpg data/obj/174.jpg data/obj/175.jpg data/obj/176.jpg data/obj/177.jpg data/obj/178.jpg data/obj/179.jpg data/obj/180.jpg data/obj/181.jpg data/obj/182.jpg data/obj/183.jpg data/obj/184.jpg data/obj/186.jpg data/obj/187.jpg data/obj/188.jpg data/obj/189.jpg data/obj/190.jpg data/obj/191.jpg data/obj/192.jpg data/obj/193.jpg data/obj/194.jpg data/obj/195.jpg data/obj/196.jpg data/obj/197.jpg data/obj/198.jpg data/obj/199.jpg data/obj/200.jpg

LukeAI commented 5 years ago

what is the output of: ls -l data/train.txt

Jefflier commented 5 years ago

l also want to ask if l can train in the basic of tiny-yolo,thanks!

Jefflier commented 5 years ago

when l run ls -l data/train.txt , it said -rwxrwxrwx 1 winger winger 2757 8月 10 19:49 data/train.txt

LukeAI commented 5 years ago

ok, that seems fine - can you give us data/obj.data ? Did you generate train.txt on a Windows machine by any chance? Sometimes different encodings can mess things up.

Jefflier commented 5 years ago

l generate it in windows and l have used UTF-8 code so it is wrong,right?

LukeAI commented 5 years ago

could be relevant. try copying across the text from the old train.txt to a new file and see if that makes a difference?

LukeAI commented 5 years ago

did that help? @Jefflier

Jefflier commented 5 years ago

l have just solved this in Google colab,thanks for your help!

LukeAI commented 5 years ago

Can you post the solution here in case somebody else has the same problem?

Jefflier commented 5 years ago

of course,here is my obj.data file

classes= 8 train = /content/darknet/data/train.txt valid = /content/darknet/data/test.txt names = /content/darknet/data/obj.names backup = /content/darknet/backup

LukeAI commented 5 years ago

Thanks. So in a nutshell - what was the problem and solution?

Jefflier commented 5 years ago

yeah,here is the most important thing when using Google lab :

You have to be carefully configuring paths on your config files. obj.data file needs to have spaces on the path escaped with . Like this: /content/gdrive/My\ Drive/darknet/train.txt. But, in files train.txt and test.txt does not!

AlexeyAB commented 5 years ago

@Jefflier This is strange that we should follow different rules in obj.data and train.txt, I will check it.

Jefflier commented 5 years ago

The weights appears not auto saved in darknet/backup ,but just yolov3-tiny_obj.backup,what happened? also,what is the difference between yolov3-tiny_obj.backup and yolov3-tiny_obj.weights? Thanks for your help!

Jefflier commented 5 years ago

@AlexeyAB l think it is Google colab's bug,hope that is helpful.

AlexeyAB commented 5 years ago

@Jefflier

The weights appears not auto saved in darknet/backup ,but just yolov3-tiny_obj.backup,what happened?

It seems you use https://github.com/pjreddie/darknet instead of https://github.com/AlexeyAB/darknet

In my repo will be created:

https://github.com/AlexeyAB/darknet/blob/4c315ea26b56c2bf20ebc240d94386c6e3cc83db/src/detector.c#L287-L325

Jefflier commented 5 years ago

yeah, that's right,thank you!

AlexeyAB commented 5 years ago

@Jefflier

So I think this behavior https://github.com/AlexeyAB/darknet/issues/3745#issuecomment-521917495 is also related only for original repo, not for my repo.

Jefflier commented 5 years ago

l think so ,hahahaha!!!

shouryasimha commented 4 years ago

@Jefflier @AlexeyAB @LukeAI Hey guys, I'm trying to train YOLOV3 on Google colab. i created a folder in colab called data , with two sub-folders as images and labls which consist images and anootation.txt files. I used the Repo from Pjreddie the .data file is as follows: num_classes= 6 valid = /content/data/test.txt names = /content/data/class.data backup = /content/darknet/backup train = /content/data/train.txt. My model stops training at 100 iterations always, I gave the max_batches = 12000 width and height = 224 steps= 9600,10800 filters = 33 in the config file image Kindly help me guys, im stuck at this since two weeks.Also, the loss inititally was decreasing but increased from the 85th iteration or so after resizing... is it normal?

LukeAI commented 4 years ago

I can only suggest trying again with this. repo. - it has many improvements and bug fixes over PJ Reddie's original repo. maybe this will solve it, maybe not and we can try and work it out

Jefflier commented 4 years ago

@Jefflier @AlexeyAB @LukeAI Hey guys, I'm trying to train YOLOV3 on Google colab. i created a folder in colab called data , with two sub-folders as images and labls which consist images and anootation.txt files. I used the Repo from Pjreddie the .data file is as follows: num_classes= 6 valid = /content/data/test.txt names = /content/data/class.data backup = /content/darknet/backup train = /content/data/train.txt. My model stops training at 100 iterations always, I gave the max_batches = 12000 width and height = 224 steps= 9600,10800 filters = 33 in the config file image Kindly help me guys, im stuck at this since two weeks.Also, the loss inititally was decreasing but increased from the 85th iteration or so after resizing... is it normal?

Did you have a backup folder named backup under the /content/darknet folder?

nancyshaji commented 4 years ago

@Jefflier I too trained using yolo on colab. However I took the data from my drive by mounting it. This was my obj.data file:

classes= 1 train = data/train.txt valid = data/test.txt names = data/obj.names backup = backup/

Hope this helps you. It supposed to save at every 100th iteration. I guess your issue is with the paths.