I am running a YOLOv5 detector on the below video to detect persons in the stream.

enter image description here

It is giving me satisfactory response.

I need to know if I should train the model on my custom dataset, or continue to use the standard weights given in the Ultralytics Github repo.

When should one train the model on their custom data?

Also how many annotated images should I arrange if I want to train on my custom dataset?


1 Answer 1


COCO dataset contains more than 91 stuff categories with 330K images (>200K labeled). Perhaps it is not the best way to identify people using YOLOv5 because your workshop has illumination changes during the daytime (natural light and lamps?). Thus, I suggest the following:

  1. Use other pre-trained weights for people detection only, use this. I got them from this website, and they work pretty well.
  2. Label people from recorded videos in different hours and check the recommendations below.
  • Images per class. ≥ 1500 images per class recommended
  • Instances per class. ≥ 10000 instances (labeled objects) per class recommended
  • Image variety. Must be representative of deployed environment. For real-world use cases we recommend images from different times of day, different seasons, different weather, different lighting, different angles, different sources (scraped online, collected locally, different cameras) etc.
  • Label consistency. All instances of all classes in all images must be labelled.
  • Partial labelling will not work.
  • Label accuracy. Labels must closely enclose each object. No space should exist between an object and it's bounding box. No objects should be missing a label.
  • Background images. Background images are images with no objects that are added to a dataset to reduce False Positives (FP). We recommend about 0-10% background images to help reduce FPs (COCO has 1000 background images for reference, 1% of the total). No labels are required for background images.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.