AlexeyAB / darknet

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

Detection in shadows or dark side (not Jedi one...) #4953

Open PaserSRL opened 4 years ago

PaserSRL commented 4 years ago

I'm tryind to improve yolov3-tiny-prn in order to detect objects inside buildings shadows. At sunrise and sunset the difference between zones illuminated from sun and building shadows is very high, I tried to train yolo changing: saturation = 1.5 exposure = 1.5 to saturation = 2.5 exposure = 5.0

but result is not good enought. Has anyone a suggestion?

parcheggio

AlexeyAB commented 4 years ago

Run training with -show_imgs flag at the end of training command, and press ESC button for next images, and look are there any images similar to cars in the shade?

Add more images with car to your training dataset.

keko950 commented 4 years ago

How large is your dataset?

PaserSRL commented 4 years ago

Run training with -show_imgs flag at the end of training command, and press ESC button for next images, and look are there any images similar to cars in the shade?

Add more images with car to your training dataset.

I will try, thanks Alexey

PaserSRL commented 4 years ago

How large is your dataset?

I'm using COCO Dataset 2014, so around 80K images

keko950 commented 4 years ago

How large is your dataset?

I'm using COCO Dataset 2014, so around 80K images

You should try to add some labeled images with shadows, maybe the dataset doesn't have any similar or enough samples.

PaserSRL commented 4 years ago

For the moment I've added CLAHE filter to frame, in order to equalize it.

Reference: https://docs.opencv.org/master/d5/daf/tutorial_py_histogram_equalization.html

UP: Frame visualized DOWN: Frame to detect cortile_mosaico

AlexeyAB commented 4 years ago

What mAP (accuracy) can you get with and without CLAHE (adaptive histogram equalization)?

PaserSRL commented 4 years ago

What mAP (accuracy) can you get with and without CLAHE (adaptive histogram equalization)?

Well, is possible to calculate mAP on a live stream? I'm testing it directly on a live stream from IP camera.

Anyway in this moment there no improvement cause it's 2 PM so the light is at maximum, but at morning and late afternoon there is a small improvement (at least on car class). I will make some screenshot with and without it in a few hours.

PS: at this moment I'm using a model trained with exposure = 5.0 so I'm not so confident...

PaserSRL commented 4 years ago

This afternoon is cloudy in Italy. I cannot make tests, I will do some screenshots tomorrow morning :(

PaserSRL commented 4 years ago

Model: YoloV3-tiny-prn Dataset: Coco 2014 Training Resolution: 416x416 Working Resolution: 576x320 Classes: 6 (car, truck, person, cat, dog, bird) Car Treshold: 0.20

Left without CLAHE - Right with CLAHE cortile_clahe

AlexeyAB commented 4 years ago

It seems that we can test CLAHE and may be include it to the Darknet pre-processing for inference-only (Detection) by setting param [net] clache_inference_preprocessing=1

PaserSRL commented 4 years ago

I used it with this setting: clahe = cv2.createCLAHE(clipLimit=3.5, tileGridSize=(8, 8))

PaserSRL commented 4 years ago

Another comparison cortile_clahe_2

@AlexeyAB Do you think that could help use it during training?

AlexeyAB commented 4 years ago

Do you think that could help use it during training?

No, I think it could help only during Detection.

Or may be inverse function could help during Training.

Hwijune commented 4 years ago

hi @PaserSRL

When you detect, adjust the contrast value.

When we were in the dark background like shadow or night, , our detection was good.

PaserSRL commented 4 years ago

hi @PaserSRL

When you detect, adjust the contrast value.

When we were in the dark background like shadow or night, , our detection was good.

During night also my detection is good, I applied CLAHE filter cause during day some areas could be very illuminated and other are dark. Using CLAHE the image is equalized in order to enchance contrast in dark areas without increase it also in areas already illuminated.

Anyway if you have a suggestion, post it :)

Hwijune commented 4 years ago

hi @PaserSRL When you detect, adjust the contrast value. When we were in the dark background like shadow or night, , our detection was good.

During night also my detection is good, I applied CLAHE filter cause during day some areas could be very illuminated and other are dark. Using CLAHE the image is equalized in order to enchance contrast in dark areas without increase it also in areas already illuminated.

Anyway if you have a suggestion, post it :)

when you train, use the CLAHE augmentation or luma threshold??

PaserSRL commented 4 years ago

when you train, use the CLAHE augmentation or luma threshold??

None of them, during training I've not used any filter.