In this project, created a machine learning project to classify 20 fish species, and it is also able to distinguish between fish and non-fish.
There are lot of unique fish species around the world, for people who encounter a new fish species most of the they don’t have any knowledge about it, sometimes even with the expertise it’s hard to tell apart some species because they are having quite similar features. Some species have unique body and wing shapes, colors patterns, features. We use them to identify species. At present with the evolution of the computer vision and deep learning techniques we can use computers to identify unique features with ease. CNN (Convolutional Neural Network) can be used as a great technique when it comes to identifying patterns in the image. As for an application of CNN, it has shown great accuracy on predictions when it comes to feature extractions which can be a great tool for identifying fish species.
The aim of the project is to build a machine learning model that can accurately predict the fish species using an image as the user input. With this model, users will be able to know which species they have encountered. Without any effort.
First, we need to develop and train our CNN model, then we can proceed to deploy our model.
First, we are going to train a binary classification model by using a pre-trained model 'MobileNet'. Model have been trained by using 12000 Test Data and 68000 Training Data for two classes, which is Fish vs Not-Fish.
Then, We made our own custom model for the classification model and trained for 20 classes using 6000 Test data and 34000 training dataset.
Finally, By combining both models we are able to predict if the input image has a fish or not, if yes then what is the name of the fish species.
-
Fish/Non-Fish Detection
- Uses a custom detection model to identify fish regions in images.
- Filters out non-fish images to improve classification accuracy.
-
Feature Extraction
- MobileNet is used as a feature extractor.
- Pretrained layers are frozen to avoid overtraining and retain learned features.
-
Fish Classification
- A CNN model takes the extracted features and classifies the fish into species or categories.
- Efficient two-stage pipeline: detection → feature extraction → classification.
- Reduces false positives by separating fish/non-fish detection.
- Leverages transfer learning for faster and more accurate training.
With the help of the mobile application users will be able to upload an image of the fish species to the server and it will predict the species as the output. Technologies that will be used
- Python – Python as the main programming language it has many libraries which is related to the Machine learning concepts, and the back end of the server is also programmed via Python
- Tensorflow – Tensorflow is a free and open-source software library for machine learning and Artificial Intelligence. Very useful on training and inference of deep learning neural networks.
- Keras – Keras acts as an interface for the Tensorflow library
- Flutter – Flutter is used to develop mobile applications which are supported to Android/iOS platforms. (not included in this repository)
In this repository I contain machine learing model only. This app contains two machine learning models, one to identify an image as a fish or not and another one to classify that image into what fish it is. This can only classify the species mentioned below.
A Flutter Android application that includes an embedded Convolutional Neural Network (CNN) model for on-device inference.
The Flutter mobile application folder in this repository contains a Flutter application that runs an embedded CNN model on Android devices. The app demonstrates how to load a converted TensorFlow Lite (TFLite) model, preprocess input data, run inference on-device and display results in the UI.
- On-device inference using an embedded CNN model (TFLite)
- Image preprocessing pipeline
- The app allows users to take a photo with the camera or select an image from the gallery
- Simple UI to run inference and display predictions
/Flutter Mobile Application (mobile project root)
├─ android/ # Android native project files
├─ lib/ # Flutter Dart source files
│ ├─ main.dart
│ └─ ...
├─ assets/
│ └─ model.tflite # Embedded TFLite model (example)
└─ pubspec.yaml
- Anthias anthias
- Atherinomorus lacunosus
- Belone belone
- Boops boops
- Chlorophthalmus agassizi
- Coris julis
- Dasyatis centroura
- Epinephelus caninus
- Gobius niger
- Mugil cephalus
- Phycis phycis
- Polyprion americanus
- Pseudocaranx dentex
- Rhinobatos cemiculus
- Scomber japonicus
- Solea solea
- Squalus acanthias
- Tetrapturus belone
- Trachinus draco
- Trigloporus lastoviza
This model was designed for embedding in a mobile app, so MobileNet is a more suitable solution than ResNet because it is lighter in weight.
This project is licensed under the MIT License - see the LICENSE file for details.