I actually have done something similar to this, since I had pretty clear view of the road infront and had my old android phone laying around,
Used to yolov5 to detect vehicles and deepsort to track them, also got a rough estimate for the speed of the pass
heres the two part blog i wrote about it