SpinSight is a Dockerized real-time roulette stream analyzer and dataset capture tool. It transforms raw RTMP broadcasts into structured, rectified roulette-segment crops and exports YOLO-style labels directly from the browser.
While many systems focus on just "seeing" the wheel, SpinSight is built for Dataset Generation. It doesn't just detect blocks; it standardizes them. It extracts every wheel segment, rectifies its rotation so the inner-edge is always at the bottom, and overlays precise ground-truth labels—making the output perfect for training Convolutional Neural Networks (CNNs).
- Real-time Pipeline: Transcodes RTMP to HLS on-the-fly and serves a low-latency browser viewer.
- Edge Processing: Performs pixel-level analysis (blob detection, connected components, convex hull) directly in the browser using pre-allocated typed arrays.
- Automatic Rectification: Rotates each detected block into a consistent upright view for review and export.
- Debug + Dataset Modes: Switch between RGB/debug inspection and guided dataset capture without leaving the stream view.
- YOLO Export: Saves per-block JPG crops plus one YOLO label file per crop and bundles them with the uploaded
classes.txtin a ZIP.
[RTMP Stream]
│
▼
[Transcoder Service (FFmpeg)] ──► Shared HLS Volume (.m3u8 / .ts)
│
▼
[Web Service (Nginx)] ◄────────────────────┘
│
├──► Injects .env config into config.json
└──► Serves SPA (Frontend)
│
└──► [HLS.js Viewer]
└──► [RingProcessor (CV Engine)] ──► [Standardized Dataset View]
- Docker & Docker Compose
- A valid RTMP stream URL
Copy the template and fill in your stream details:
# Configuration is managed via the .env file
# Ensure STREAM_URL and calibration values are setdocker compose up -d --buildOpen http://localhost:8081 in your browser.
Space: freeze / resume the stream↻: manually refresh the HLS connection from the latest live position
Space: start one capture roundF: pause / resume dataset capture without freezing the stream- Viewer hints show capture state such as
Wheel is not spinningandWaiting for green block
- Switch to Dataset mode.
- Upload
classes.txt.- The file is preserved as-is in the export ZIP.
- It must contain class names
0through36. - Class IDs are the uploaded file's line numbers.
- Set a dataset name or leave it blank to use
YYMMDD. - Choose target mode:
- total image count, or
- per-class image count
- Configure:
- undersample balancing
- frames per round
- interval by seconds or frames
- duplicate threshold
- Press
Spaceto start a round.
Capture rules:
- A frame is skipped if the wheel is not moving.
- A frame is skipped until a green block is detected.
- Only successfully predicted blocks are exported.
- One valid frame can produce multiple files: one rectified JPG per predicted block.
- Each JPG receives one YOLO label file using the precise label box normalized to the crop image.
- Capture stops automatically when the target is reached.
To achieve high-quality detection, you must calibrate the vision engine for your specific camera angle:
- Use the
roulette_stream_calibrator.pytool to determine ROI and ellipse parameters. - Tune the Color Ranges in
.envuntil the red, green, and black blocks are cleanly isolated. - Adjust
MIN_BLOCK_SIZEto filter out noise.
Every block displayed in the "Detected Blocks" list follows these rules:
- Alignment: The "Inner Side" (cyan line) is rotated to the bottom.
- Crop Box: The colored box represents the sampling area.
- Label Box: The orange box represents the precise pixel-cluster boundary (Ground Truth).
- Consistency: The thumbnails are 100% spatially consistent with the original stream coordinates.
- Ordering: The block list is ordered from the top of the wheel and then clockwise.
Dataset ZIP contents:
images/*.jpg: one rectified crop per predicted blocklabels/*.txt: one YOLO label file per cropclasses.txt: the exact uploaded class mapping file
Each label file contains one line:
<class_id> <cx> <cy> <w> <h>
Coordinates are normalized to the exported crop, not the full source frame.
- Engine: FFmpeg (Alpine-based)
- Server: Nginx (Alpine-based)
- Frontend: Vanilla ES6 JavaScript, HLS.js, CSS Grid
- CV Logic: Custom Union-Find Labeling, Convex Hull (Graham scan), Affine Transformation for rectification.
Developed for high-precision roulette video analysis and machine learning pre-processing.