Rails49
Open Source

Model Railroad
Control and Intelligence

Software for running model railroads: seeing where the trains are, and deciding where they go next.

Two Projects

Each stands on its own, and they are built to meet.

📷

Occupancy

Camera-based track occupancy detection. Photograph the layout, mark the points you care about, train a classifier, and watch it run live — entirely in your browser.

🚦

Control

Scheduling, dispatching, and driving trains. The research core is deadlock-free, high-throughput dispatch: many trains sharing one layout without ever backing each other into a corner.

How Occupancy 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