EnYa32 commited on
Commit
e6d4118
Β·
verified Β·
1 Parent(s): 38c8d2a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +113 -13
README.md CHANGED
@@ -1,20 +1,120 @@
1
  ---
2
- title: LargeFishClassifcationResNet50
3
- emoji: πŸš€
4
- colorFrom: red
5
- colorTo: red
6
- sdk: docker
7
- app_port: 8501
8
- tags:
9
- - streamlit
10
  pinned: false
11
- short_description: CNN with ResNet50 for 9-class fish classification
12
  license: mit
13
  ---
14
 
15
- # Welcome to Streamlit!
16
 
17
- Edit `/src/streamlit_app.py` to customize this app to your heart's desire. :heart:
 
18
 
19
- If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
20
- forums](https://discuss.streamlit.io).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: FishClassifier_CNN
3
+ emoji: 🐠
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: streamlit
7
+ app_file: src/streamlit_app.py
 
 
8
  pinned: false
9
+ short_description: CNN with ResNet50 for 9-class fish classification.
10
  license: mit
11
  ---
12
 
13
+ # 🐟 Fish Species Classification – ResNet50 Transfer Learning
14
 
15
+ This project uses **Transfer Learning with ResNet50** to classify images of 9 different fish species.
16
+ The model was trained using the **A Large Scale Fish Dataset** from Kaggle.
17
 
18
+ The goal of this project is to build a strong image classifier as part of my Deep Learning assignments.
19
+ I also built a CNN model without transfer learning for comparison.
20
+
21
+ ---
22
+
23
+ ## πŸ“¦ Dataset
24
+
25
+ The dataset contains 9 fish classes:
26
+
27
+ - Black Sea Sprat
28
+ - Gilt-Head Bream
29
+ - Horse Mackerel
30
+ - Red Mullet
31
+ - Red Sea Bream
32
+ - Sea Bass
33
+ - Shrimp
34
+ - Striped Red Mullet
35
+ - Trout
36
+
37
+ The dataset is balanced and includes several thousand images.
38
+
39
+ Source: https://www.kaggle.com/datasets/crowww/a-large-scale-fish-dataset
40
+
41
+ ---
42
+
43
+ ## 🧠 Model Overview (ResNet50)
44
+
45
+ This project uses **ResNet50 with ImageNet weights** as a feature extractor.
46
+
47
+ ### Model pipeline:
48
+
49
+ 1. Load ResNet50 without top layers (`include_top=False`)
50
+ 2. Freeze all base layers
51
+ 3. Add custom layers:
52
+ - GlobalAveragePooling2D
53
+ - Dense(256, activation='relu')
54
+ - Dropout(0.5)
55
+ - Dense(9, activation='softmax')
56
+
57
+ ### Training Settings
58
+
59
+ - Loss: `sparse_categorical_crossentropy`
60
+ - Optimizer: Adam (learning rate reduced automatically)
61
+ - Metrics:
62
+ - Accuracy
63
+ - Top-3 Accuracy
64
+ - Callbacks:
65
+ - EarlyStopping
66
+ - ReduceLROnPlateau
67
+ - ModelCheckpoint (saves the best model)
68
+
69
+ ---
70
+
71
+ ## πŸ“ˆ Model Performance
72
+
73
+ Results on validation data:
74
+
75
+ - **Validation Accuracy:** ~98.5%
76
+ - **Top-3 Accuracy:** 100%
77
+ - **Validation Loss:** ~0.05
78
+
79
+ The ResNet50 model performs extremely well and clearly outperforms the CNN built from scratch.
80
+
81
+ ---
82
+
83
+ ## πŸš€ How to Use the Model
84
+
85
+ ### Load model:
86
+ ```python
87
+ import tensorflow as tf
88
+ model = tf.keras.models.load_model("best_fish_resnet50.keras")
89
+ Predict:
90
+ python
91
+ import numpy as np
92
+ from tensorflow.keras.preprocessing import image
93
+
94
+ img = image.load_img("your_image.jpg", target_size=(224, 224))
95
+ img_array = np.expand_dims(image.img_to_array(img), axis=0)
96
+
97
+ pred = model.predict(img_array)
98
+ print(pred)
99
+ 🌐 Streamlit App
100
+ This HuggingFace Space includes an interactive Streamlit app where you can:
101
+
102
+ Upload a fish image
103
+
104
+ See the model prediction
105
+
106
+ View confidence scores for all 9 classes
107
+
108
+ πŸ“„ Project Files
109
+ File Description
110
+ best_fish_resnet50.keras Saved ResNet50 model
111
+ streamlit_app.py Streamlit app code
112
+ requirements.txt Required Python packages
113
+ ResNet50_Fish_Report.pdf Technical report
114
+ fish_resnet50_history.pkl Training history
115
+
116
+ ## πŸ‘€ Author
117
+
118
+ **Enes Yamac**
119
+
120
+ Machine Learning & Computer Vision Project (2025)