How can I use yolo to color detection?
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?
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.
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
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=0instead 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 Thanks! and one more question. Can yolo distinguish all the colors not only green or red?
can I training without fliping image? example the direction of the road
@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.