Spaces:
Sleeping
Sleeping
|
Download README.md from EnYa32/LargeScaleFishClassification: direct link, hf CLI and curl.
- Browser
- Download file 2.99 kB
-
https://huggingface.co/spaces/EnYa32/LargeScaleFishClassification/resolve/main/README.md
- Command line
-
hf download hf://spaces/EnYa32/LargeScaleFishClassification/README.md
-
curl -L -o README.md https://huggingface.co/spaces/EnYa32/LargeScaleFishClassification/resolve/main/README.md
2.99 kB
| title: FishClassifier_CNN | |
| emoji: π | |
| colorFrom: blue | |
| colorTo: green | |
| sdk: streamlit | |
| app_file: src/streamlit_app.py | |
| pinned: false | |
| short_description: CNN from scratch for 9-class fish classification. | |
| license: mit | |
| # π Fish Classification (CNN From Scratch) | |
| 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. | |
| This model is part of a larger deep learning assignment where the goal is to build: | |
| 1. A CNN **without transfer learning** | |
| 2. A CNN **with transfer learning** (e.g., ResNet50) | |
| 3. A Streamlit app for each model | |
| 4. A technical PDF report for each dataset | |
| --- | |
| ## π Dataset | |
| **A Large Scale Fish Dataset** | |
| Kaggle link: https://www.kaggle.com/datasets/crowww/a-large-scale-fish-dataset | |
| Dataset structure (after download): | |
| Fish_Dataset/ | |
| βββ Black Sea Sprat | |
| βββ Gilt-Head Bream | |
| βββ Horse Mackerel | |
| βββ Red Mullet | |
| βββ Red Sea Bream | |
| βββ Sea Bass | |
| βββ Shrimp | |
| βββ Striped Red Mullet | |
| βββ Trout | |
| yaml | |
| Code kopieren | |
| --- | |
| ## π§ Model Overview | |
| The CNN was built using Keras Sequential API with: | |
| - **5 Convolutional Layers** | |
| - **3 MaxPooling Layers** | |
| - **1 Dense Layer (256 units)** | |
| - **Dropout (0.5)** | |
| - **Softmax output layer (9 classes)** | |
| **Training Setup:** | |
| - Loss: `sparse_categorical_crossentropy` | |
| - Optimizer: `Adam(lr=0.0005)` | |
| - Metrics: | |
| - `accuracy` | |
| - `top-3 accuracy` | |
| - Callbacks: | |
| - EarlyStopping | |
| - ModelCheckpoint (`best_fish_cnn.keras`) | |
| - ReduceLROnPlateau | |
| --- | |
| ## π Results | |
| Final model performance on validation data: | |
| - **Accuracy:** ~84% | |
| - **Top-3 Accuracy:** ~99% | |
| - **Validation Loss:** ~0.45 | |
| The model performed very well on distinct species (Shrimp, Red Mullet, Trout). | |
| Classes that look visually similar (Sea Bass, Bream types) caused some confusion. | |
| The technical report (PDF) contains: | |
| - Classification Report | |
| - Confusion Matrix | |
| - Full explanation of methods & reflection | |
| --- | |
| ## π Usage | |
| ### How to Use the Model (CNN From Scratch) | |
| __Load the model__ | |
| import tensorflow as tf | |
| model = tf.keras.models.load_model("best_fish_cnn.keras") | |
| _Predict on a new image_ | |
| import numpy as np | |
| from tensorflow.keras.preprocessing import image | |
| img = image.load_img("your_image.jpg", target_size=(224, 224)) | |
| img_array = np.expand_dims(image.img_to_array(img), axis=0) / 255.0 # normalize | |
| pred = model.predict(img_array) | |
| print(pred) | |
| __Streamlit App__ | |
| This HuggingFace Space includes an interactive Streamlit app where you can: | |
| Upload a fish image | |
| See the modelβs prediction | |
| View confidence scores for all 9 fish classes | |
| __Project Files__ | |
| File Description | |
| best_fish_cnn.keras Saved CNN model (from scratch, no transfer learning) | |
| streamlit_app.py Streamlit app code | |
| requirements.txt Required Python packages | |
| Fish_CNN_Report_English.pdf Technical report (simple English) | |
| ## π€ Author | |
| **Enes Yamac** | |
| Machine Learning & Computer Vision Project (2025) |