Rails49
Computer Vision

Model Railroad
Track Occupancy Detection

Overhead cameras and a CNN image classifier detect trains and rolling stock on your layout — running entirely in the browser, with no server and no installation.

How It Works

Photograph the layout, mark the spots you care about, train a classifier, watch it run live.

📐

Layout Editor

Load overhead photographs of your layout, calibrate the scale against a known reference length, and mark each point you want monitored as track, train, or coupling.

📦

The .r49 Format

A single portable archive holding your layout photographs alongside a validated manifest of scale, calibration, and every labelled marker. Open and save it straight from the browser.

🧠

ResNet-18 Classifier

Image crops extracted around each marker train a ResNet-18 convolutional network with Fastai, exported to ONNX for fast, portable inference.

🎥

Live View

Point a phone or tablet camera at the layout and every marker is classified in real time, with occupancy drawn as an overlay and per-frame timing shown alongside.

🔒

Runs In Your Browser

ONNX Runtime executes the network on-device via WebAssembly. Your photographs and layout files never leave the machine you are working on.

📏

Scale Aware

Calibration is expressed in dots-per-track, so a model trained on one layout transfers to another regardless of gauge, from Z through G scale.

Built With Cutting-Edge Tech

Lit & Vite
TypeScript
ONNX Runtime
WebAssembly
Fastai & PyTorch