--- 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.