AlexeyAB / darknet

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

Training on images of raspberry bi captured for some days #2611

Open PythonImageDeveloper opened 5 years ago

PythonImageDeveloper commented 5 years ago

Hi @AlexeyAB, I captured the images of cars from highways with raspberry'pi camera, I have some question. I want to detect various types of cars, and some of the frames are busy, because of the density of cars, Q1- Is it necessary to have labels (boxes) for all of the cars? if some are cars in some frames don't have labels, is this be a problem for training? that means, is necessary to have labeled all the cars? Q2- I captured the images with 25 FPS, and maybe the some of cars be same in some frames, Is cause the overfitting problem? assume 50'th frame be in training set and 51'th frame be validation set, it appears these frames are the same and have slightly different, Is cause the overfitting problem? Q3- Because the frames are high height, the cars aren't very cleary, Is necessary any image pre-processing techniques?

AlexeyAB commented 5 years ago

@zeynali Hi,

  1. You must label every car: https://github.com/AlexeyAB/darknet#how-to-improve-object-detection

check that each object are mandatory labeled in your dataset - no one object in your data set should not be without label. In the most training issues - there are wrong labels in your dataset (got labels by using some conversion script, marked with a third-party tool, ...). Always check your dataset by using: https://github.com/AlexeyAB/Yolo_mark

  1. If many of your images are similar in the Training dataset then you must have large dataset to avoid overfitting, more than 2000 images per class. If you have very simillar images in the Training and Validation dataset, then the mAP on Validation dataset will increase even after overfitting, so it can lead to overfitting too.

  2. Can you show an example?

PythonImageDeveloper commented 5 years ago

https://i.ibb.co/QPgtLV3/1.jpg https://i.ibb.co/D8K1Z94/07.jpg

Please explain more detail for answer 2, If we have more than 2000 images for every class, this cause preserve any problem of over-fitting? My other question is that, suppose we have a binary classification problem, and one class is light-cars and other is heavy-cars. and I gathered many images that captured with 25 FPS, and I cropped any cars of road and then split them into 2 folder, one is light-cars and other is heavy cars. My question is that, because some of cares same in the some of frames, that is, the one cars is moving on the road and that car is appeared in the some of frames, when i cropped all of cars from all of frames, some of cars apparently same, is it necessary to remove that the same cropped images?

AlexeyAB commented 5 years ago

Is it part of image or whole image?

If it is a part of image - then this is a good object for neural network. It will be deceted well.

PythonImageDeveloper commented 5 years ago

That images are for binary classification, and these are cropped from whole image, Isn't any pre-processing for these low-quality images? If these images good for Neural Network without any necessary pre-processing, so why some times my result are be unstable?

AlexeyAB commented 5 years ago

So what do you want to use Detector or Classifier?

You shouldn't do any preprocessing.

You should have ~200-2000 different images per class to avoid overfitting. If every 10 images are simillar, then you should have 10x more images to avoid overfitting, so you should have 2000 - 20 000 images per class.

PythonImageDeveloper commented 5 years ago

I have ~5K images for every class, but i don't know why my test result of classification on online stream of images is unstable? that is , when I cropped the same car from 5'th frame and the result of network is class 0 , then I crapped the same car from 6'th frame (only difference of these is car moved forward but i deal with classification problem and should not have any effect), the result of network are be class 1, and sensitive on conditional of weather. while I gathered any time of days images.