Jellyfish Classification
Convolutional Neural Networks for Jellyfish Classification. Used deep learning tools including Keras, SkLearn, and TensorFlow.
My project is on deep learning for classification of 6 types of jellyfish (Barrel, Blue, Compass, Lions Mane, Mauve Stinger and Moon) using sklearn, keras, and tensorflow in addition to numpy and matplotlib for plotting. This data set is from kaggle- https://www.kaggle.com/datasets/anshtanwar/jellyfish-types
6 different models were implemented- simple_CNN, reg_CNN and batch_CNN with 3x3 filters and 5x5 filters
Simple_CNN - Has three convolutional layers, each followed by a max pooling layer, a flatten layer, a fully connected dense layer, and an output layer with softmax activation for multi-class classification.
Reg_CNN- includes dropout layers to regularize the model and prevent overfitting, potentially making it more robust but possibly requiring more training time and data to achieve optimal performance.
Batch_CNN- Uses batch normalization to stabilize and potentially speed up training by normalizing activations. Has a batch normalization after each convolutional layer
First, I created three data generators for the training, validation, and test dataset using the flow_from_directory method. Each instance reads images from the respective directories, resizes them to 150x150 pixels, rescales the pixel values, and yields batches of images and their corresponding labels (labels are one-hot encoded for categorical classification tasks).
code below
5 subplots of the moon Jelly using matplotlib
code and plot
Labeling the Classes
The the types of CNN models
Training on the 6 CNN models using 3x3 and 5x5 filters
Plotting results (Accuracy and Loss)
Code
Plots
Testing/Results
Highest test accuracy
Test Accuracy: 0.6499999761581421 for 5x5 no dropout CNN
F1 Score: is 0.17067307692307693 for 5x5 no dropout CNN
Visualizing feature detection at different convolutional layers using VGG16
code
Visualization of a 3x3 filter CNN no drop out, blue_jellyfish photo
This image depicts which parts of the image are being activated by different filters in the convolutional layers, providing insights into what the model is learning!!