File size: 2,925 Bytes
d9d9ed1 9630948 d9d9ed1 3ec7a30 d9d9ed1 9630948 d9d9ed1 9630948 d9d9ed1 9630948 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | ---
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. |