EnYa32 commited on
Commit
1ca5362
Β·
verified Β·
1 Parent(s): bba23fc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +120 -12
README.md CHANGED
@@ -1,20 +1,128 @@
1
  ---
2
- title: LargeScaleFishClassification
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 from scratch 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 from scratch for 9-class fish classification.
10
  license: mit
11
  ---
12
 
13
+ # 🐟 Fish Classification (CNN From Scratch)
14
 
15
+ This project builds a **Convolutional Neural Network (CNN) from scratch** to classify images from the **"A Large Scale Fish Dataset"**, containing 9 different fish species.
16
 
17
+ This model is part of a larger deep learning assignment where the goal is to build:
18
+ 1. A CNN **without transfer learning**
19
+ 2. A CNN **with transfer learning** (e.g., ResNet50)
20
+ 3. A Streamlit app for each model
21
+ 4. A technical PDF report for each dataset
22
+
23
+ ---
24
+
25
+ ## πŸ“‚ Dataset
26
+ **A Large Scale Fish Dataset**
27
+ Kaggle link: https://www.kaggle.com/datasets/crowww/a-large-scale-fish-dataset
28
+
29
+ Dataset structure (after download):
30
+
31
+ Fish_Dataset/
32
+ β”œβ”€β”€ Black Sea Sprat
33
+ β”œβ”€β”€ Gilt-Head Bream
34
+ β”œβ”€β”€ Horse Mackerel
35
+ β”œβ”€β”€ Red Mullet
36
+ β”œβ”€β”€ Red Sea Bream
37
+ β”œβ”€β”€ Sea Bass
38
+ β”œβ”€β”€ Shrimp
39
+ β”œβ”€β”€ Striped Red Mullet
40
+ └── Trout
41
+
42
+ yaml
43
+ Code kopieren
44
+
45
+ ---
46
+
47
+ ## 🧠 Model Overview
48
+
49
+ The CNN was built using Keras Sequential API with:
50
+
51
+ - **5 Convolutional Layers**
52
+ - **3 MaxPooling Layers**
53
+ - **1 Dense Layer (256 units)**
54
+ - **Dropout (0.5)**
55
+ - **Softmax output layer (9 classes)**
56
+
57
+ **Training Setup:**
58
+
59
+ - Loss: `sparse_categorical_crossentropy`
60
+ - Optimizer: `Adam(lr=0.0005)`
61
+ - Metrics:
62
+ - `accuracy`
63
+ - `top-3 accuracy`
64
+ - Callbacks:
65
+ - EarlyStopping
66
+ - ModelCheckpoint (`best_fish_cnn.keras`)
67
+ - ReduceLROnPlateau
68
+
69
+ ---
70
+
71
+ ## πŸ“ˆ Results
72
+
73
+ Final model performance on validation data:
74
+
75
+ - **Accuracy:** ~84%
76
+ - **Top-3 Accuracy:** ~99%
77
+ - **Validation Loss:** ~0.45
78
+
79
+ The model performed very well on distinct species (Shrimp, Red Mullet, Trout).
80
+ Classes that look visually similar (Sea Bass, Bream types) caused some confusion.
81
+
82
+ The technical report (PDF) contains:
83
+ - Classification Report
84
+ - Confusion Matrix
85
+ - Full explanation of methods & reflection
86
+
87
+ ---
88
+
89
+ ## πŸš€ Usage
90
+
91
+ ### How to Use the Model (CNN From Scratch)
92
+
93
+ __Load the model__
94
+
95
+ import tensorflow as tf
96
+
97
+ model = tf.keras.models.load_model("best_fish_cnn.keras")
98
+
99
+ _Predict on a new image_
100
+ import numpy as np
101
+ from tensorflow.keras.preprocessing import image
102
+
103
+ img = image.load_img("your_image.jpg", target_size=(224, 224))
104
+ img_array = np.expand_dims(image.img_to_array(img), axis=0) / 255.0 # normalize
105
+
106
+ pred = model.predict(img_array)
107
+ print(pred)
108
+
109
+ __Streamlit App__
110
+
111
+ This HuggingFace Space includes an interactive Streamlit app where you can:
112
+
113
+ Upload a fish image
114
+
115
+ See the model’s prediction
116
+
117
+ View confidence scores for all 9 fish classes
118
+
119
+ __Project Files__
120
+ File Description
121
+ best_fish_cnn.keras Saved CNN model (from scratch, no transfer learning)
122
+ streamlit_app.py Streamlit app code
123
+ requirements.txt Required Python packages
124
+ Fish_CNN_Report_English.pdf Technical report (simple English)
125
+
126
+ πŸ™Œ Author
127
+ Enes Yamac
128
+ Deep Learning Portfolio Project (2025)