darknet icon indicating copy to clipboard operation
darknet copied to clipboard

How can I use yolo to color detection?

Open Lapinchu opened this issue 7 years ago • 6 comments

Hi, I'm making a project to detect the color of traffic lights by YOLO. Can the YOLO distinguish between green and red, which are the color of traffic lights? And how to do that? I mean Is it possible for the YOLO to learn color detection?

Lapinchu avatar Feb 01 '19 06:02 Lapinchu

Maybe the simplest way is to recognize the shape of traffic light and check the position of the lighted lamp (no need to check colour). But be careful ! This position depends on the country.

py-lacroix avatar Feb 01 '19 08:02 py-lacroix

You need firstly to detect class of the object and the color, probably you need 2 networks for it Also there is a solution in OpenCV for multiple color detection here

tarasevich-dmitry avatar Feb 01 '19 12:02 tarasevich-dmitry

Hi, I'm making a project to detect the color of traffic lights by YOLO. Can the YOLO distinguish between green and red, which are the color of traffic lights? And how to do that? I mean Is it possible for the YOLO to learn color detection?

Yes, Yolo can distinguish between green and red. You just should:

  • label red and green objects as different classes
  • disable color augmentation, set hue=0 instead of https://github.com/pjreddie/darknet/blob/61c9d02ec461e30d55762ec7669d6a1d3c356fb2/cfg/yolov3.cfg#L16

Then train the Yolo as usuall.


More about HSV: https://en.wikipedia.org/wiki/HSL_and_HSV

AlexeyAB avatar Feb 01 '19 12:02 AlexeyAB

@AlexeyAB Thanks! and one more question. Can yolo distinguish all the colors not only green or red?

seojupal avatar Sep 18 '19 11:09 seojupal

can I training without fliping image? example the direction of the road

nugrahari avatar Aug 19 '20 04:08 nugrahari

@AlexeyAB Thanks! and one more question. Can yolo distinguish all the colors not only green or red?

Yes, it can! By using instance segmentation and extracting the dominant colors inside the masked region by using K-means or Color histogram feature extraction followed by KNN Classifier for training the model. Refer my instance segmentation repository which uses yolov5seg for your reference.

Tanusri99 avatar May 31 '24 02:05 Tanusri99