Reading Railroad Signal aspects

I am thinking about using an ESP-Cam for reading the aspects of railroad signals while approaching the signal and I wonder what is the best way to do that.
First try to find the signal and then in a second pass go for the aspect? Or just train the program to see the entire signal including the aspect.
And how to detect aspects with a blinking lamp? I thought about detecting the signal with the lamp on and with the lamp off and determine based on the received events as a function of time whether it is blinking or completely off. Is there a better way?
Typically I am looking at four different aspects: Green, Red, Yellow and Yellow blinking
Any suggestions?
Thanks

I’d first try to do the naive approach, train four classes:

  • Green on
  • Red on
  • Yellow on
  • Yellow off

On the full image, and see if you get any accuracy.

Then you can just program some control loop that expects yellow on / yellow off / yellow on within a certain time to detect blinking.

If this does not yield a good model you could use some computer vision to first find the railroad sign, and cut it out (you can do this as a custom processing block in Edge Impulse as well), and then pass it in to the classifier.

Thank you, Jan. Looks like I’m on the right path of thinking. Will let you know how it goes. Hans