-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What's the purpose of pre-trained weights in YOLO? #232
Comments
Hi @Voldy1998 On a high level, the yolo network is a deep neural net with millions of parameters and needs millions of labeled images to tune all these parameters. Because many people don't have the resources to label that amount of images we use a technique called transfer learning where we use the knowledge that the network has acquired by training on millions of similar images. That is why we need the pre-trained weights. And we can get good results with only a few hundred images. Hope that helps. Google also has a lot of resources about yolo and transfer learning in general. |
Hi @AntonMu , Thanks for the quick reply! |
You probably need to be a bit more specific. What is your IoU constraint here? A common metric in object detection is mAP. |
@AntonMu iou is 0.5 here. |
I see. I think it looks fine. It is a little unusual to use this type of curve. How do you deal with multiple cars in one picture? In your graph do you vary the threshold to say car/no car? |
The trained model was tested on a test dataset of 120 images of cars. The 120 images had 272 instances of class 'car', out of which 220 were detected as 'True Positive', 26 as 'False Positive', and 26 as "False Negative". For each class (here there is just one class car) the neural network detection results were sorted by decreasing confidence scores and are assigned to ground-truth objects. It was judged to be true or false positives by measuring bounding box overlap. To be considered a correct detection, the area of overlap between the predicted bounding box Using the above criteria the precision-recall curve was plotted. Then a version of the measured precision/recall curve with precision monotonically decreasing was plotted by setting the precision for recall 'r' to the maximum precision obtained for any recall r' > r. Finally, we compute the Average Precision (AP) as the area under the precision-recall curve (shown in light blue) in the above figure. |
Ok. That sounds reasonable for your use case. You are basically treating a object detection problem as a classification problem. Essentially you are capturing one aspects of the model (the classification) with your metric but ignore the aspect of detecting objects accurately. Hope that makes sense. |
Hi @AntonMu, I actually followed your steps and trained the detector to detect cars and draw bounding boxes around it in an image which is classification + localization. Now the detection results for each and every car in an image (the coordinates of the bounding box and the confidence scores) were saved in a text file. The ground-truth coordinates of each and every car in an image were also saved into a text file. |
Ah Ok - cool. Yes, you are right. I was a bit thrown off by the single class. But it makes sense - if you only have a single class there is no mean to calculate. If you feel comfortable feel free to add a pull request to get that feature added to the repo. Thank you so much! |
Yes, @AntonMu I hope the graph is not incorrect or anything. How can I add this as a feature? I went to that repo and followed the guidelines and ran his code. |
Cool - yes. I think there are several options. One could be to add a description on the steps you did maybe under the 3_Inference section. There would also be an option to add some code that would handle the computation. Basically you describe what one needs to do to calculate mAP and provide a script that does it. |
Yes @AntonMu, sure I will add. Issue is I am not 100% sure if what I did is correct. |
I see - best thing is to start a PR and then I can check. But if you followed the tutorial it should be fine. To add it here - I would like to also work for multiple classes. |
Okay @AntonMu, Thanks Will do it! |
Hi Anjanaouseph, do you mind uploading your code for converting our csv to the required file format for mAp calculation? |
Hi @648783116 #convert .csv as per https://github.com/Cartucho/mAP from csv import DictReader INPUT_FILE = 'Detection_Results.csv' with open(INPUT_FILE, 'rt') as csvfile: The above is the code that I used. |
"Before getting started download the pre-trained YOLOv3 weights and convert them to the keras format", I want to understand why do we need to use pre-trained weights in yolo.
The text was updated successfully, but these errors were encountered: