AlexeyAB / darknet

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

Question: HSV values image pre-processing #740

Open anandkoirala opened 6 years ago

anandkoirala commented 6 years ago

Hi @AlexeyAB Just few questions about the image pre-processing. HSV values for openCV is in range (0-180,0-255,0-255) while other programs may use (0-360, 0-1, 0-1). the pixel values are integers anyways. I am not good in C++ so digging into your source code I couldn't understand how YOLO is using the HSV values for Image preprocessing? is it a scalar multiplier of 0.1 and 1.5 to the pixel values (if yes that will result in floats)? or is it like addition of 10, 150 to the pixels? what is the HSV range used by YOLO? Thanks, Anand

AlexeyAB commented 6 years ago

@anandkoirala Hi,

In the Darknet image is represented as array of floats: https://github.com/AlexeyAB/darknet/blob/535353cdaad78714640c171fd797f281b0c49c28/src/image.h#L15-L16

So RGB and HSV always is normalized for range [0, 1]


How HSV-data-augmentation works you can see here: if in the cfg file: hue=0.1, saturation=1.5, exposure=1.5 then dhue = [-0.1, 0.1], dsat = [1/1.5, 1.5], dexp = [1/1.5, 1.5]