Simulation
Racing Line Analysis from Tour de France Footage
A computer-vision and trajectory-optimisation pipeline that reconstructs an entire mountain descent from race footage and overlays the computed optimal racing line on the riders' actual trajectories, which track the optimum to within 10% of the road width.
Links & Resources
The Question
Not every kilometre of a Grand Tour is raced flat out, but a descent is where the line a rider chooses matters most. The descent of the Ballon d'Alsace during a Tour de France stage in the Vosges — a smooth strip of asphalt weaving through forest, past mountain lakes and around hairpin bends — made an ideal test case for a question that is easy to ask and hard to answer: how close do professional cyclists come to the optimal racing line, and can that be measured from broadcast footage alone, without a single sensor on the bike?
From Footage to a Top-Down Road Map
The pipeline starts with the road itself. AI-based semantic segmentation (SAM2) extracts the full width of the road surface frame by frame, and does so occlusion-aware: riders, motorbikes and cars passing over the asphalt do not punch holes in the road that is recovered. Those same road users are detected and tracked separately with a YOLO-based detector, so their image-space trajectories can be followed through the sequence.
Geometry comes next. Structure-from-Motion (COLMAP) registers the different viewpoints against one another and reconstructs the scene geometry, which is then orthorectified and stitched into a single consistent top-down representation of the entire descent — one continuous map of the road rather than a sequence of perspective views.
The Optimal Line
With the road known in plan view, the optimal trajectory down it is computed by trajectory optimisation, solved as a nonlinear program with IPOPT. That line is then reprojected onto the original video frames, so the computed optimum and the lines the riders actually took can be compared inside the footage itself rather than in an abstract plot.
What the Comparison Shows
The riders sit remarkably close to the optimum: the mean lateral deviation between observed and optimal trajectories stays well under 10% of the road width. They use every available metre of asphalt, open up the corners, and connect the bends with a smoothness that looks almost mathematically deliberate — arrived at by experience rather than by optimisation, much as racing drivers converge on the same lines.
That the professionals are hard to beat is exactly what makes the result useful as a check. A pipeline that reconstructs a road from ordinary race footage, computes an optimum on it, and finds experts already sitting on that optimum is a pipeline whose optimum can be trusted elsewhere: on a descent that has not been raced yet, on a line a rider has not tried, or on any other road user whose trajectory is visible on camera but not instrumented.
Related work