EnYa32's picture
Update README.md
9630948 verified
|
Raw History Blame Contribute Delete
2.93 kB
---
title: DateFruitClassifierResNet50
emoji: 🌴
colorFrom: gray
colorTo: green
sdk: streamlit
app_file: src/streamlit_app.py
pinned: false
short_description: Date fruit image classifier app using ResNet50.
license: mit
---
# πŸ“¦ Date Fruit Classification using ResNet50 (Transfer Learning)
## πŸ“˜ Project Summary
This project classifies different types of date fruits using deep learning.
Because the dataset is small and the fruits look very similar, I used **Transfer Learning with ResNet50**, a model pre-trained on ImageNet. This helped improve accuracy and reduce training time.
---
## 🎯 Goals
- Classify multiple date fruit types using images
- Use ResNet50 with transfer learning
- Compare model results with a CNN trained from scratch
- Evaluate with accuracy/loss curves and classification report
- Write a technical report (included as PDF)
---
## πŸ“Š Results
| Model | Validation Accuracy | Validation Loss | Macro F1-score |
|-------|---------------------|-----------------|----------------|
| Custom CNN (no TL) | ~90% | ~0.30 | ~0.88 |
| **ResNet50 (with TL)** | **94.22%** | **0.1842** | **0.94** |
βœ” Transfer Learning improved accuracy
βœ” Model did not overfit
βœ” Works well at classifying most types
---
## 🧠 Model Used
ResNet50 (ImageNet weights, frozen)
β†’ GlobalAveragePooling2D
β†’ Dense(256, relu)
β†’ Dropout(0.5)
β†’ Dense(num_classes, softmax)
yaml
Code kopieren
---
## πŸ”§ Training Settings
| Option | Value |
|--------|-------|
| Optimizer | Adam (lr = 0.001) |
| Loss | sparse_categorical_crossentropy |
| Batch Size | 16 |
| Epochs | 40 |
| Validation Split | 20% |
| Callbacks | ReduceLROnPlateau, ModelCheckpoint, EarlyStopping |
---
## πŸ“ Files
πŸ“‚ project_folder
β”‚
β”œβ”€β”€ app.py # Optional Streamlit app
β”œβ”€β”€ model_resnet50.keras # Trained model
β”œβ”€β”€ notebook.ipynb # Training notebook
β”œβ”€β”€ history_resnet50.pkl # Training history
β”œβ”€β”€ resnet50_transfer_learning_report.pdf # Full report (EN + DE)
└── README.md # This file
yaml
Code kopieren
---
## πŸš€ How to Use the Model
```python
from tensorflow.keras.models import load_model
import numpy as np
from tensorflow.keras.preprocessing import image
model = load_model('model_resnet50.keras')
img = image.load_img('test_image.jpg', target_size=(224, 224))
img_array = image.img_to_array(img)
img_array = np.expand_dims(img_array, axis=0)
prediction = model.predict(img_array)
print(prediction)
πŸ” Next Steps (Optional)
Fine-tune ResNet50 (unfreeze some layers, lower learning rate)
Add more images to improve weak classes
Try class weighting
πŸ“„ **Download Technical Report (PDF)**
[CNN_Date_Report.pdf](./resnet50_report.pdf)
πŸ§‘β€πŸ’» Author
Enes Yamac
Deep Learning Project – Transfer Learning with ResNet50
πŸ“… November 2025
πŸ“Œ Final Note
Transfer Learning helped achieve high accuracy and reliable classification performance.