Good question … I am making a follow up article now. With a video of the prototype. But here is a quick explanation. Computer Vision, which is part of Data Science can detect not only the color of the light but also the position. All traffic lights share the same order of the lights ( 99% ) … so when the sensor “sees” the light it will also sense the position in relation to the non active lights. It will use this info to detect a yellow or red light. Much like facial recognition.