diff --git a/Neural Networks/Butterfly Image Classification/Dataset/README.md b/Neural Networks/Butterfly Image Classification/Dataset/README.md new file mode 100644 index 00000000..d7ff36c7 --- /dev/null +++ b/Neural Networks/Butterfly Image Classification/Dataset/README.md @@ -0,0 +1,5 @@ +# **Butterfly Image Classification** + +The dataset features 75 different classes of Butterflies. The dataset contains about 1000+ labelled images including the validation images. Each image belongs to only one butterfly category. + +### Dataset Link : https://www.kaggle.com/datasets/phucthaiv02/butterfly-image-classification/data \ No newline at end of file diff --git a/Neural Networks/Butterfly Image Classification/Images/CNN Accuracy Plot.png b/Neural Networks/Butterfly Image Classification/Images/CNN Accuracy Plot.png new file mode 100644 index 00000000..2c30392f Binary files /dev/null and b/Neural Networks/Butterfly Image Classification/Images/CNN Accuracy Plot.png differ diff --git a/Neural Networks/Butterfly Image Classification/Images/Dataset.png b/Neural Networks/Butterfly Image Classification/Images/Dataset.png new file mode 100644 index 00000000..60ab9bde Binary files /dev/null and b/Neural Networks/Butterfly Image Classification/Images/Dataset.png differ diff --git a/Neural Networks/Butterfly Image Classification/Images/Distribution of Butterfly Classes.png b/Neural Networks/Butterfly Image Classification/Images/Distribution of Butterfly Classes.png new file mode 100644 index 00000000..197826e2 Binary files /dev/null and b/Neural Networks/Butterfly Image Classification/Images/Distribution of Butterfly Classes.png differ diff --git a/Neural Networks/Butterfly Image Classification/Images/EfficientNet Accuracy Plot.png b/Neural Networks/Butterfly Image Classification/Images/EfficientNet Accuracy Plot.png new file mode 100644 index 00000000..6d320387 Binary files /dev/null and b/Neural Networks/Butterfly Image Classification/Images/EfficientNet Accuracy Plot.png differ diff --git a/Neural Networks/Butterfly Image Classification/Images/ResNet Accuracy Plot.png b/Neural Networks/Butterfly Image Classification/Images/ResNet Accuracy Plot.png new file mode 100644 index 00000000..fd318a94 Binary files /dev/null and b/Neural Networks/Butterfly Image Classification/Images/ResNet Accuracy Plot.png differ diff --git a/Neural Networks/Butterfly Image Classification/Models/butterfly-classification-cnn.ipynb b/Neural Networks/Butterfly Image Classification/Models/butterfly-classification-cnn.ipynb new file mode 100644 index 00000000..7213f463 --- /dev/null +++ b/Neural Networks/Butterfly Image Classification/Models/butterfly-classification-cnn.ipynb @@ -0,0 +1,1253 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "22b85536", + "metadata": { + "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19", + "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5", + "execution": { + "iopub.execute_input": "2024-05-07T13:22:13.340009Z", + "iopub.status.busy": "2024-05-07T13:22:13.339735Z", + "iopub.status.idle": "2024-05-07T13:22:26.631704Z", + "shell.execute_reply": "2024-05-07T13:22:26.630611Z" + }, + "papermill": { + "duration": 13.303115, + "end_time": "2024-05-07T13:22:26.634091", + "exception": false, + "start_time": "2024-05-07T13:22:13.330976", + "status": "completed" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2024-05-07 13:22:16.401649: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n", + "2024-05-07 13:22:16.401763: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n", + "2024-05-07 13:22:16.563012: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n" + ] + }, + { + "data": { + "text/plain": [ + "\"\\nfor dirname, _, filenames in os.walk('/kaggle/input'):\\n for filename in filenames:\\n print(os.path.join(dirname, filename))\\n\"" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import numpy as np\n", + "import pandas as pd \n", + "import cv2\n", + "import matplotlib.pyplot as plt\n", + "import tensorflow as tf\n", + "import os" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "eefcba16", + "metadata": { + "execution": { + "iopub.execute_input": "2024-05-07T13:22:26.653874Z", + "iopub.status.busy": "2024-05-07T13:22:26.653275Z", + "iopub.status.idle": "2024-05-07T13:22:26.922440Z", + "shell.execute_reply": "2024-05-07T13:22:26.921575Z" + }, + "papermill": { + "duration": 0.281228, + "end_time": "2024-05-07T13:22:26.924678", + "exception": false, + "start_time": "2024-05-07T13:22:26.643450", + "status": "completed" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "gpus = tf.config.experimental.list_physical_devices('GPU')\n", + "for gpu in gpus:\n", + " tf.config.experimental.set_memory_growth(gpu, True)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "0b03a8d4", + "metadata": { + "execution": { + "iopub.execute_input": "2024-05-07T13:22:26.943904Z", + "iopub.status.busy": "2024-05-07T13:22:26.943086Z", + "iopub.status.idle": "2024-05-07T13:22:26.988549Z", + "shell.execute_reply": "2024-05-07T13:22:26.987404Z" + }, + "papermill": { + "duration": 0.057171, + "end_time": "2024-05-07T13:22:26.990742", + "exception": false, + "start_time": "2024-05-07T13:22:26.933571", + "status": "completed" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/html": [ + "
Model: \"sequential\"\n", + "
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโ\n", + "โ Layer (type) โ Output Shape โ Param # โ\n", + "โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ\n", + "โ rescaling (Rescaling) โ (None, 224, 224, 3) โ 0 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ random_flip (RandomFlip) โ (None, 224, 224, 3) โ 0 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ random_rotation โ (None, 224, 224, 3) โ 0 โ\n", + "โ (RandomRotation) โ โ โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ random_zoom (RandomZoom) โ (None, 224, 224, 3) โ 0 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ random_contrast โ (None, 224, 224, 3) โ 0 โ\n", + "โ (RandomContrast) โ โ โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ conv2d (Conv2D) โ (None, 220, 220, 16) โ 1,216 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ max_pooling2d (MaxPooling2D) โ (None, 110, 110, 16) โ 0 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ conv2d_1 (Conv2D) โ (None, 106, 106, 32) โ 12,832 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ max_pooling2d_1 (MaxPooling2D) โ (None, 53, 53, 32) โ 0 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ conv2d_2 (Conv2D) โ (None, 51, 51, 64) โ 18,496 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ max_pooling2d_2 (MaxPooling2D) โ (None, 25, 25, 64) โ 0 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ conv2d_3 (Conv2D) โ (None, 23, 23, 128) โ 73,856 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ dropout (Dropout) โ (None, 23, 23, 128) โ 0 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ flatten (Flatten) โ (None, 67712) โ 0 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ dense (Dense) โ (None, 128) โ 8,667,264 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ dense_1 (Dense) โ (None, 128) โ 16,512 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ dense_2 (Dense) โ (None, 128) โ 16,512 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ dropout_1 (Dropout) โ (None, 128) โ 0 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค\n", + "โ dense_3 (Dense) โ (None, 75) โ 9,675 โ\n", + "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโ\n", + "
Total params: 8,816,363 (33.63 MB)\n", + "
Trainable params: 8,816,363 (33.63 MB)\n", + "
Non-trainable params: 0 (0.00 B)\n", + "