π HaulVision
AI-Powered Truck Detection β’ Real-Time β’ Highway & Logistics Optimized
A production-grade Streamlit application built around a fine-tuned YOLO object detection model optimized for real-time truck identification, achieving high precision across dense highway and logistics environments.
β¨ Features
| Feature | Description |
|---|---|
| π· Image Detection | Upload images (JPG, PNG, BMP, WEBP) for instant truck detection |
| π¬ Video Detection | Process videos (MP4, AVI, MOV, MKV, WMV) frame-by-frame with progress tracking |
| β‘ Real-Time Inference | Fast YOLO-based detection with GPU acceleration support |
| π― Adjustable Thresholds | Fine-tune confidence & NMS IoU via interactive sliders |
| π Rich Analytics | Detection counts, confidence distribution, class breakdown, inference timing |
| π¨ Custom Bounding Boxes | Color-coded boxes with corner accents, semi-transparent fills, confidence labels |
| β¬οΈ Export Results | Download annotated images (PNG) and videos (MP4) |
| π€ HF Model Hosting | Model auto-downloaded from Hugging Face Hub with caching |
| π Premium Dark UI | Gradient headers, glassmorphism cards, hover animations |
π Quick Start
Prerequisites
- Python 3.10 or higher
- pip (Python package manager)
- GPU recommended (CUDA-compatible) for faster inference
Installation
# Clone the repository
git clone https://github.com/hamidraiz786/HaulVision.git
cd HaulVision
# Install dependencies
pip install -r requirements.txt
Run the App
streamlit run app.py
The app will open at http://localhost:8501 in your default browser.
Note: On first launch, the model (~51MB) will be automatically downloaded from Hugging Face and cached locally.
π Project Structure
HaulVision/
βββ app.py # Main Streamlit application (single-file)
βββ kvision5.pt # Fine-tuned YOLO model weights
βββ requirements.txt # Python dependencies
βββ README.md # This file
βββ assets/
β βββ banner.jpg # Repository banner image
βββ .streamlit/
βββ config.toml # Streamlit theme configuration
π₯οΈ Usage
Image Detection
- Select π· Image mode in the sidebar
- Upload an image (JPG, PNG, BMP, or WEBP)
- Adjust Confidence and NMS IoU thresholds as needed
- View results in the Detection Result, Original Image, and Details tabs
- Click β¬οΈ Download Annotated Image to save results
Video Detection
- Select π¬ Video mode in the sidebar
- Upload a video (MP4, AVI, MOV, MKV, or WMV)
- Adjust Frame Skip to control processing speed (higher = faster)
- Click π Run Detection to begin processing
- Monitor real-time progress and frame previews
- Download the annotated video when processing completes
βοΈ Configuration
Sidebar Controls
| Control | Range | Default | Description |
|---|---|---|---|
| Confidence Threshold | 0.05 β 1.0 | 0.25 | Minimum detection confidence score |
| NMS IoU Threshold | 0.05 β 1.0 | 0.45 | Non-Maximum Suppression overlap threshold |
| Frame Skip (Video) | 1 β 10 | 2 | Process every N-th frame for speed |
Theme Customization
Edit .streamlit/config.toml to customize the app's appearance:
[theme]
primaryColor = "#00D4FF"
backgroundColor = "#0E1117"
secondaryBackgroundColor = "#161B22"
textColor = "#E6EDF3"
π§ Model Details
| Property | Value |
|---|---|
| Architecture | YOLO (Fine-tuned) |
| Task | Object Detection |
| Specialization | Truck identification in highway & logistics |
| Model Size | ~51 MB |
| Input Resolution | 640Γ640 |
| Hosted On | π€ Hugging Face |
π¦ Dependencies
streamlit>=1.38.0
ultralytics>=8.2.0
opencv-python-headless>=4.9.0
Pillow>=10.0.0
numpy>=1.24.0
torch>=2.0.0
torchvision>=0.15.0
huggingface-hub>=0.23.0
π³ Docker Deployment (Optional)
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
docker build -t haulvision .
docker run -p 8501:8501 haulvision
π€ Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
π License
This project is licensed under the MIT License β see the LICENSE file for details.
Built with β€οΈ using Streamlit & Ultralytics YOLO
Model hosted on π€ Hugging Face
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support