Train-YOLOv3-with-OpenImagesV4
Train-YOLOv3-with-OpenImagesV4 copied to clipboard
Training in multiple classes
For multiple classes , should i add negative samples (empty txt) ? it's necessary ? because i have too much classes and the mAP didn't increase . I tested for one class and it's working very well .
If your mean average precision didn't "increase":
For which classes of objects? All of them? just additional ones beyond the first that you trained it for? or just some of them?
If it's just some classes that have a poor or low mAP, how many photos were downloaded for that class? If it's any less than 12,000 or so you may just not have enough photos for that class and need to adjust parameters in the config files to accommodate for that, or just reduce the amount of photos used for all the other classes to have the same number of photos that the class with the lowest number of photos has.
Let's say you have one class with 80,000 photos and another with 2,000. If you train the model with all of that "clumped together" in one big pile, it may be the case that the weights are going to perform detection on those objects proportionally to how it was trained (as 98% of the objects in the text files used for training were one object, and only 2% of the training was done for detecting the other object).
Try using the same number of photos for each object, and try to make sure that the lowest number of photos for a class of object is at least several thousand. You can probably get by with ~6,000 photos for a class, but make sure if that's the case to reduce all of the other classes to ~6000 photos too, before processing everything for training.
Anyway, that's a quick and easy test to try first. You shouldn't have to do anything else besides reduce the number of photos in the folders that they downloaded to before processing them.
I'd recommend dumping a copy of the photos to an external drive beforehand, so you can just delete stuff instead of having duplicates and having to move several massive quantities of photos around.
I could be wrong about the above assumption too, in regards to YOLOv3 training like that; it may already equalize the input for training accross classes, but I would be willing to bet that just starting off with evenly sized datasets for each object will help. If it causes mAP to be low for everything after making the reductions to equalize dataset sizes, then I will help you dig into the config and see what's going on.
Anywho, I'll give you a few days to report back before closing. Sorry for the wait!
i have trained my model on 30 classes of openimages dataset and i used your script for annotation . Now i have 67% mAP on the validation set and i trained with 2k for each class . I want to increase the mAP but i don't know which parameters i modify and should i use openimages.weights instead of darknet53 (for the transfer learning)? thanks in advance
Hmmmmm.
I will have to research this; I very well may be overlooking something critical in the configuration.
If you can, try out the openimages weights and report back with the results. In the meantime I will research possible adjustments that need to be made to the configuration files.
It may be that it just needs to be adjusted to train much, much longer when using that many classes, considering the sample size for each class is very small here, and it's only getting an input per each class during training that reflects that
For example:
If you trained it on one class, even with only 2000 images, 100% of the input was still taken from that one class, meaning it was thoroughly trained for that one class even if some images are recycled as input during training. It may be the case that if you train it for the same length of time for that one class as you did a dataset of 30 classes, allocating the same amount of resources, you may be getting something like 1/30th of the results for each of those classes that you did for the results you got for the training of a single class.
You may need to train it exponentially longer or with more resources allocated to it, if it isn't fixed by simply starting with the open images weights.
The fact that one class works fine though, leads me to believe we could try adjusting the config to train it 30x longer.
It has honestly been some time since I've reviewed this, and there may be some step that is being overlooked in the config prep for multiple classes.
Did you make any adjustments to the config for multiple classes, besides just the adding class names/numbers?
No i didnt add any thing it was fine. I trained for long time and after the mAP is decreasing and loss too then i think i was overfitting that s why i took the more accurate result . For the config file there is not a very documented link for adjusting :( is mAP of 67% too low ? I had precision of 77% for thresh 0.25
Télécharger Outlook pour Androidhttps://aka.ms/ghei36
From: bitsandgiggles [email protected] Sent: Friday, May 10, 2019 3:50:27 PM To: WyattAutomation/Train-YOLOv3-with-OpenImagesV4 Cc: Cyrine NABLI; Author Subject: Re: [WyattAutomation/Train-YOLOv3-with-OpenImagesV4] Training in multiple classes (#6)
It has honestly been some time since I've reviewed this, and there may be some step that is being overlooked in the config prep for multiple classes.
Did you make any adjustments to the config for multiple classes, besides just the adding class names/numbers?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/WyattAutomation/Train-YOLOv3-with-OpenImagesV4/issues/6#issuecomment-491295710, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKDCODVJTDOCZ6ISMT3FZTTPUV4SHANCNFSM4HI6ROMA.
I will take the time over the weekend to test this process out myself, and see if I can reproduce this issue with 30 classes. If it happens on my side too, then I'll look into what needs to happen to the config to accommodate, and update the documentation accordingly.
Thanks for bringing this to my attention; I'll follow up with results and if needed a solution, in a few days.
Thanks a lot for the effort . Just to mention that i have trained with some classes that don t have too much samples such as screwdriver and some classes with too much samples such as person then to balance the data i took only 3000 samples per class and i did data augmentation for those in need (rotation,translation,hsv....)
I used cuda and cudnn with height and width 416 and batch 64 and subdivisions=16 ( i can t less due to memory). Thanks in advance.
From: bitsandgiggles [email protected] Sent: Friday, May 10, 2019 4:11:23 PM To: WyattAutomation/Train-YOLOv3-with-OpenImagesV4 Cc: Cyrine NABLI; Author Subject: Re: [WyattAutomation/Train-YOLOv3-with-OpenImagesV4] Training in multiple classes (#6)
I will take the time over the weekend to test this process out myself, and see if I can reproduce this issue with 30 classes. If it happens on my side too, then I'll look into what needs to happen to the config to accommodate, and update the documentation accordingly.
Thanks for bringing this to my attention; I'll follow up with results and if needed a solution, in a few days.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/WyattAutomation/Train-YOLOv3-with-OpenImagesV4/issues/6#issuecomment-491303057, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKDCODRXC76V7GUOECUXBZ3PUV7AVANCNFSM4HI6ROMA.
Hey Wyatt! Thanks for your hard work and !!!EXCELENT!!! HOWTO. I really appreciate it.
However, I wish to train my Yolov3 for multiple classes now and I'm having difficulties. I mean it is probably just me, but it is not clear for me if I have to copy now the generated txt files next to the images in each folder of the desired classes or not. Also, in the process.py
, line 5, how do I declare the folder where I have the images? Sorry if I ask something that is clear for everyone but me.
Regards: Bert
You can collect all the images in the same folder After that copy the .py in this folder and run it .
From: Imre Bertalan [email protected] Sent: Tuesday, June 11, 2019 11:52:22 AM To: WyattAutomation/Train-YOLOv3-with-OpenImagesV4 Cc: Cyrine NABLI; Author Subject: Re: [WyattAutomation/Train-YOLOv3-with-OpenImagesV4] Training in multiple classes (#6)
Hey Wyatt! Thanks for your hard work and !!!EXCELENT!!! HOWTO. I really appreciate it. However, I wish to train my Yolov3 for multiple classes now and I'm having difficulties. I mean it is probably just me, but it is not clear for me if I have to copy now the generated txt files next to the images in each folder of the desired classes or not. Also, in the process.py, line 5, how do I declare the folder where I have the images? Sorry if I ask something that is clear for everyone but me.
Regards: Bert
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/WyattAutomation/Train-YOLOv3-with-OpenImagesV4/issues/6?email_source=notifications&email_token=AKDCODTISEK4XUWWMASHHETPZ5YVNA5CNFSM4HI6ROMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXMSVMA#issuecomment-500771504, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKDCODXL2XJ5FYW6WE32TPLPZ5YVNANCNFSM4HI6ROMA.
Cheers, it worked like a charm. :) I have other issues, but that is not related to your work. It is a darknet issue.
All,
I am very sorry for my lack of correspondence here, thank you cyrinee for helping out in my absence.
I've been absolutely swamped with work recently, but I plan to return to this very soon with some critical updates that should resolve some of the issues with multiple classes. Should be near the end of the month that I will be returning to this project to update it, so please be patient and I will do what I can to reply with bug fixes and updated documentation!
Thanks, Gene