Skip to content

Commit 65e462a

Browse files
committed
Update docs, visual inspector
1 parent 37ec36f commit 65e462a

4 files changed

Lines changed: 26 additions & 20 deletions

File tree

CONFIGURATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ python lib/detection.py tests/images/muni_snapshot_20251207_092107.jpg
217217
pytest tests/test_system_status.py -v
218218

219219
# Interactive detection viewer
220-
python scripts/station_viewer.py
220+
python scripts/detection_viewer.py
221221
```
222222

223223
## Notes

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Contributors can collect their own test images:
121121

122122
3. Visualize detection interactively:
123123
```bash
124-
python scripts/station_viewer.py # Interactive detection viewer
124+
python scripts/detection_viewer.py # Interactive detection viewer
125125
```
126126

127127
4. Run tests:
@@ -136,15 +136,18 @@ munimet.ro/
136136
├── lib/ # Shared library code
137137
│ ├── muni_lib.py # Core download & detection functions
138138
│ ├── detection.py # OpenCV-based status detection
139+
│ ├── station_detector.py # Station position detection
140+
│ ├── train_detector.py # Train ID detection (OCR)
141+
│ ├── station_constants.py # Station definitions
139142
│ ├── analytics.py # SQLite-based delay analytics
140143
│ └── notifiers/ # Notification channels (Bluesky, RSS)
141144
142-
├── scripts/ # Detection and utility scripts
143-
│ ├── analyze.py # CLI tool for image analysis
144-
│ ├── station_detector.py # Station position detection
145-
│ ├── train_detector.py # Train ID detection (OCR)
146-
│ ├── detect_stations.py # Station configuration
147-
│ └── station_viewer.py # Debug visualization tool
145+
├── scripts/ # Development and utility scripts
146+
│ ├── analyze.py # CLI tool for image analysis
147+
│ ├── detect_stations.py # Station detection CLI
148+
│ ├── detection_viewer.py # Interactive detection viewer
149+
│ ├── validate.sh # Local validation (lint + tests)
150+
│ └── install-hooks.sh # Git hooks installer
148151
149152
├── api/ # Production web API
150153
│ ├── api.py # Falcon web server
@@ -240,7 +243,7 @@ Users
240243
## Development Workflow
241244

242245
1. **Collect Data** - Run `download_muni_image.py` periodically
243-
2. **Test Detection** - Use `scripts/station_viewer.py` to visualize detection
246+
2. **Test Detection** - Use `scripts/detection_viewer.py` to visualize detection
244247
3. **Run Tests** - Execute `pytest tests/` to verify detection accuracy
245248
4. **Test Locally** - Deploy with `./deploy/local/setup.sh && ./deploy/local/start.sh`
246249
5. **Deploy Cloud** - Deploy to Cloud Run with `./deploy/cloud/deploy-services.sh`

lib/detection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"""
33
OpenCV-based detection library for SF Muni Metro status.
44
5-
This module wraps the detection logic from scripts/station_viewer.py
6-
to provide a clean API for the status detection service.
5+
This module provides the detection API used by the status service,
6+
combining station detection, train detection, and delay analysis.
77
"""
88

99
from pathlib import Path

scripts/detection_viewer.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,18 @@ def image_to_base64(image_path):
774774
</div>
775775
776776
<div class="info-section">
777-
<h3>Trains Detected ({{ detection.trains|length }})</h3>
778-
<div id="trainsInfo">
777+
<h3>Click Info</h3>
778+
<div class="click-info" id="clickInfo">
779+
Click on stations or track segments to see details.
780+
</div>
781+
</div>
782+
783+
<div class="info-section">
784+
<div class="section-header" onclick="toggleSection('trains')">
785+
<h3>Trains Detected ({{ detection.trains|length }})</h3>
786+
<span class="section-toggle" id="trains-toggle">[+]</span>
787+
</div>
788+
<div class="section-content collapsed" id="trains-content">
779789
{% if detection.trains %}
780790
{% for t in detection.trains %}
781791
{% if t.confidence == 'high' %}
@@ -798,13 +808,6 @@ def image_to_base64(image_path):
798808
</div>
799809
</div>
800810
801-
<div class="info-section">
802-
<h3>Click Info</h3>
803-
<div class="click-info" id="clickInfo">
804-
Click on stations or track segments to see details.
805-
</div>
806-
</div>
807-
808811
<div class="info-section">
809812
<div class="section-header" onclick="toggleSection('stations')">
810813
<h3>Stations ({{ detection.stations|length }})</h3>

0 commit comments

Comments
 (0)