# Feedmill Recounter AI video analysis tool for counting objects (sacks, boxes) in feedmill videos. Built on top of [karung_counter_semarang](https://git.proit.id/andrew/karung-counting-feedmill-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 ```bash 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/` | GET | Job status with results | | `/jobs` | GET | All jobs listing | | `/download//` | GET | Download output video | | `/api/models` | GET | List available models | | `/api/jobs` | GET | List all jobs (JSON) | | `/api/jobs/` | 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 ```