jetson a5566f3b99 feat: switch live preview from WebSocket to MJPEG streaming
- Pipeline writes JPEG to /tmp/feedmill_preview_{job_id}.jpg (atomic)
- Flask serves MJPEG stream at /api/preview/{job_id}
- Frontend uses native <img src> MJPEG — zero JS needed
- Removed flask-socketio, eventlet, socket.io CDN dependencies
- 33% less bandwidth per frame, native browser decode
- Same proven approach as original karung-counting project
2026-09-22 10:09:22 +07:00

Feedmill Recounter

AI video analysis tool for counting objects (sacks, boxes) in feedmill videos. Built on top of karung_counter_semarang.

Features

  • CLI: Process videos from the command line with any model + class filter
  • Web UI: Upload videos, select models, download annotated output on port 9000
  • Multiple Models: Run multiple model configurations on the same video for comparison
  • Class Filtering: Choose which classes to count (sack, box, truck)
  • Annotated Output: Download MP4 videos with detection overlays for human review
  • Async Processing: Background job queue — upload and poll status

Quick Start

pip install -e ".[dev]"

# List available models
recounter --list-models --models-dir ./models

# Process a single video via CLI
recounter --video input.mp4 --model v4-best.pt --filter sack --output-dir ./output

# Start web UI
recounter-web
# Open http://localhost:9000

CLI Reference

recounter --video PATH          Input video file
         --model NAME           Model filename (repeatable for multiple)
         --all-models           Run all discovered models
         --list-models          List available models and exit
         --filter NAME          Class filter (repeatable): sack, box, truck
         --sack-conf FLOAT      Sack confidence threshold (default: 0.4)
         --truck-conf FLOAT     Truck confidence threshold (default: 0.5)
          --output PATH          Output path (single model only)
         --output-dir DIR       Output directory (default: ./output)
         --models-dir DIR       Models directory (default: ./models)

Web UI

  • Port: 9000 (configurable via WEB_PORT env)
  • Upload: Select video file
  • Model Selection: Checkboxes for each model, dropdown for class filter
  • Job Status: Auto-refreshing progress page
  • Download: Annotated MP4 per model result

API Endpoints

Endpoint Method Description
/ GET Upload form with model selection
/upload POST Start processing job
/status/<job_id> GET Job status with results
/jobs GET All jobs listing
/download/<job_id>/<filename> GET Download output video
/api/models GET List available models
/api/jobs GET List all jobs (JSON)
/api/jobs/<job_id> GET Job detail (JSON)

Project Structure

src/
├── interfaces.py         # Detection dataclass + protocols
├── detection.py          # YOLO detectors with class filtering
├── tracking.py           # ByteTrack/FastTrack tracker
├── stabilizer.py         # Bbox smoothing + occlusion hold
├── truck_roi.py          # Truck ROI detection + EMA smoothing
├── counting.py           # Line-crossing counter
├── batch.py              # Batch lifecycle state machine
├── dashboard.py          # Frame annotation overlay
├── video_writer.py       # Annotated video writer
├── model_registry.py     # Model discovery + class metadata
├── pipeline.py           # Video processing pipeline
└── job.py                # Async job queue
S
Description
Multi model AI counter with class filtering for feedmill recounting
Readme
583 KiB
0 Stars 1 Watchers 0 Forks
Languages
Python 72.1%
HTML 11.7%
JavaScript 8.6%
CSS 7.6%