How hotarouuu/orangedetect works
Project type and purpose
• This is a machine-learning pipeline with a web-based front end.
• Purpose: fine-tune a pre-trained ResNet model to detect orange diseases, track experiments via Weights & Biases, and expose inference through a Streamlit app.
File structure
• Top-level scripts and config:
• .env-example, Makefile, requirements.txt, setup.py → environment, build & install
• app.py → Streamlit entry point
• Data directories:
• data/ → raw & ingested data
• notebooks/ → exploratory/prototyping code
• Model artifacts:
• models/ → saved PyTorch checkpoints
• Core src and scripts:
• scripts/ (data_treatment.py, download_data.py, training.py) → batch data prep & model training
• src/ (dataloader.py, model.py, train.py, predict.py) → reusable library modules
README for additional insights
• Key external services: Kaggle (data), Weights & Biases (experiment tracking)
• Deployment: Streamlit UI accepts image uploads, returns disease prediction
Sketch the main components and their interactions
a. Components
1. Data Ingestion & Storage
• External Data Source (Kaggle)
• Raw Data Folder (data/)
2. Data Processing
• scripts/data_treatment.py → cleans, augments, splits data
3. Model Training Pipeline
• scripts/training.py (or src/train.py)
• PyTorch + transfer learning (ResNet50/101)
• WandB integration for metrics & checkpoints
4. Model Registry & Storage
• Local models/ directory
• WandB artifact store (optional external registry)
5. Inference & Serving
• Streamlit app (app.py + src/predict.py)
• Loads model from models/ and .env config
6. Prototyping & Experimentation
• notebooks/ for exploratory analysis
b. Relationships & Data Flow
1. Download raw images from Kaggle → store in data/
2. Run data treatment → produce processed datasets → still under data/ or ephemeral
3. Training pipeline reads processed data → fine-tunes model → logs to WandB & saves checkpoint in models/
4. Streamlit app reads the final checkpoint from models/ (path from .env) → user uploads image → src/predict.py processes the image → model inference → UI displays result
c. Architectural patterns & principles
• Modular layering: separation of data, processing, training, and serving
• Reusable library (src/) vs. orchestration scripts (scripts/)
• External service abstraction: treat WandB and Kaggle as interchangeable providers
• Environment-based configuration (.env) for paths and credentials
d. Key technologies
• Python 3.x, PyTorch, Torchvision
• Streamlit for UI
• Weights & Biases for tracking
• Kaggle API for data download