Darknet: Need help in detecting custom objects.

Created on 12 Sep 2017  路  9Comments  路  Source: AlexeyAB/darknet

I am trying to train YOLO to recognize helmet and safety jackets and so I have made weights file by following the instructions.
But it has somehow got mistrained. it is now recognizing helmets as safety jackets and safety jacket as a helmet.
what have I done wrong? and how do I fix this?

I used 0 for helmet class and 1 for safety jacket class in the .txt files of images.

please help and let me know if you need any more info.
Thanks.

All 9 comments

  1. Show the contents of one of the text files.

  2. Just change obj.names file:

safety jacket

Thank you AlexeyAB it works fine now.
But now as it seems it only detects either helmet or a jacket in a picture. It won't detect both of them in the same picture at the same time.
I don't have a Nvidia GPU so I trained for like 300 iterations only using the 300.weights file (4 days and 5 nights continue training on my CPU -_- ).
Is it happening because I haven't trained enough or am I missing something here?
Also is there any way for to integrate these custom weights into the VOC weights/ COCO weights so that i can detect other things along with helmets and safety jakcets?

Yes, you should train about 4000 iterations for 2 objects. Also your image dataset probably is not enough good.

Increase network resolution in cfg-file:

width=608
height=608

I made the changed to .cfg file and now its takes 10 sec per image instead of 4 sec.
How do I make my trained custom objects detectable with other normal already provided objects like dog, person, car etc.
What I basically want to achieve is to detect a man wearing a helmet and a safety jacket as 3 different objects:
1) helmet
2) jacket
3) person
Can I do it? Please let me know.

I can retrain the objects till 4000 iterations with good training data if your answer is yes(advice on how to select good training images would be great so that I have greater accuracy).

P.S - I will get a CUDA supported GPU soon.

  • Yes, you should train 4000 iterations and should have about 4000 images.
  • What resolution of training images and tested images?
  • What distance between helmet and jacket in pixels (how many pixels)?
  • Check you training dataset using Yolo_mark: https://github.com/AlexeyAB/Yolo_mark
  • Read how to improve training and detection: https://github.com/AlexeyAB/darknet#how-to-improve-object-detection

Okay I will now try to train for 4000 images and 4000 iterations

  • I used different images from google with different resolutions (varying from 400 * 400 to 1080 * 720)
  • the distance between the helmet and object is same as the normal distance between a persons head and shoulders. (around min 100 pixels approx)
  • In love with YOLO mark. thank you.
  • I have read how to improve training and detection. It is quite helpful.
    Thanks a lot.

@neospeed83 hi, Could you describe your idea of recognizing helmet and safety jacket please. For example, are you recognizing from video, how about the camera position, where did you get your dataset, etc? It'd be helpful for me. And we can collaborate for further improvements. You can reach me personally any time, thanks.

Hi, @neospeed83 I run into the same issue here. May I ask how did you make your custom model to detect provided objects, such as dog, car, and person?
Thanks!

How do I make my trained custom objects detectable with other normal already provided objects like dog, person, car etc.
What I basically want to achieve is to detect a man wearing a helmet and a safety jacket as 3 different objects:

  1. helmet
  2. jacket
  3. person
    Can I do it? Please let me know.

Hi @tongxinw!

  1. If your model is identifying trained objects incorrectly then try changing the order of classes in the obj.names file.
  2. So as @AlexeyAB suggested, I needed to train for over 4000 iterations and with a lot more images than before. I also upscaled the training set resolution in configuration and relabelled training images. the model needed more res images and a lot of them to identify everything in the same frame. Rest everything you need to know is beautifully explained in the documentation and readme.

Hope this helps! Good luck with your model.

P.S. Sorry for not closing this issue earlier.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Jacky3213 picture Jacky3213  路  3Comments

hemp110 picture hemp110  路  3Comments

bit-scientist picture bit-scientist  路  3Comments

louisondumont picture louisondumont  路  3Comments

shootingliu picture shootingliu  路  3Comments