Deep Learning-powered Coffee Bean Roast Classification — Validate roast consistency against production standards in real time.
- Multi-Architecture Benchmarking: Trained and evaluated InceptionV3, ResNet-152 V2, and VGG-16 on identical splits
- 95% Accuracy: InceptionV3 achieves state-of-the-art performance on the 4-class roast dataset
- Real-Time QC Validation: Upload a batch photo and instantly verify it against a target roast profile
- Modular ML Pipeline: Clean
src/package separating ingestion, preprocessing, model engine, and inference - Dockerized: Single
docker build+docker runfor fully reproducible deployments - Streamlit UI: Intuitive interface for quality control operators — no ML knowledge required
| Model | Accuracy | Precision | Recall | F1 Score |
|---|---|---|---|---|
| InceptionV3 ⭐ | 0.95 | 0.97 | 0.97 | 0.97 |
| ResNet-152 V2 | 0.96 | 0.96 | 0.96 | 0.96 |
| VGG-16 | 0.91 | 0.92 | 0.91 | 0.91 |
- Source: Kaggle — Coffee Bean Dataset (224×224)
- Size: 1,600 images across 4 classes
- Classes:
Dark·Green·Light·Medium - Split: 90% train / 10% validation
┌──────────────┐ ┌─────────────────┐ ┌──────────────────┐ ┌──────────────┐
│ Upload Image│ -> │ Preprocessing │ -> │ InceptionV3 │ -> │ QC Result │
│ (JPG/PNG) │ │ Resize 224×224 │ │ + Custom Head │ │ PASS / FAIL │
└──────────────┘ └─────────────────┘ └──────────────────┘ └──────────────┘
Each model uses the same custom head on top of ImageNet-pretrained base:
BaseModel (frozen) → GlobalAveragePooling2D → Dense(1024, ReLU) → Dropout(0.5) → Dense(4, Sigmoid)
Trained with Adam optimizer, Categorical Cross-Entropy loss, for 25 epochs with data augmentation (rotation, flip, zoom, shear).
| Upload Batch Photo | Quality Verdict |
|---|---|
| Select target roast from sidebar | System predicts roast type and compares |
| ✅ PASS — batch matches the target profile | ❌ FAIL — roast mismatch with corrective guidance |
Live demo: coffeeroastclassification.streamlit.app
git clone https://github.com/<your-username>/CoffeeBeanRoastClassification.git
cd CoffeeBeanRoastClassification
docker build -t coffee-roast-ai .
docker run -p 7860:7860 coffee-roast-aiOpen http://localhost:7860
git clone https://github.com/<your-username>/CoffeeBeanRoastClassification.git
cd CoffeeBeanRoastClassification
pip install -r requirements.txt
pip install -e .
streamlit run app.py├── app.py # Streamlit UI entry point
├── main.py # Training pipeline entry point
├── params.yaml # All hyperparameters & config
├── Dockerfile # Container definition
├── requirements.txt # Python dependencies
├── setup.py # Installable src package
├── config/
│ └── config.yaml
├── models/
│ └── inception_v1.hdf5 # Best trained model
├── src/
│ └── coffee_roast_ai/
│ ├── data_ingest.py # Kaggle dataset download
│ ├── data_loader.py # Augmented data generators
│ ├── preprocessing.py # Inference image processing
│ ├── model_engine.py # Build / train / load models
│ ├── utils.py # Config reader
│ └── logger.py # Logging setup
└── research/
├── CoffeebeansClassification-Inception.ipynb
└── CoffeebeansClassification-Resnet.ipynb
All tunable parameters live in params.yaml — no code changes needed:
data:
image_size: [224, 224]
batch_size: 64
class_names: ['Dark', 'Green', 'Light', 'Medium']
model:
base_model: "InceptionV3"
learning_rate: 0.001
dropout_rate: 0.5
dense_units: 1024
epochs: 25# Install in editable mode
pip install -e .
# Run training pipeline
python main.py
# Run app locally
streamlit run app.py
# Rebuild Docker image
docker build -t coffee-roast-ai .- Kaggle — gerry pio senka for the dataset
- TensorFlow / Keras for model training infrastructure
- Streamlit for the interactive UI framework
Made with ❤️ and a lot of ☕