Butterfly Image Classification Using Convulational Neural Network (CNN)
Butterfly Image Classification Using Convulational Neural Network (CNN)
Abstract:- Butterfly species identification through image help track population dynamics, understand ecological
classification is now a major use of computer vision, interactions, and protect endangered species. Recent
utilizing supervised learning methods to classify different advances in machine learning, particularly supervised
types of butterflies based on images. This article gives a learning, have enabled the development of sophisticated
detailed overview of the latest progress in classifying models capable of distinguishing between different butterfly
butterfly images through supervised learning techniques species with high accuracy.
on Google Colab, a widely-used cloud-based platform for
machine learning projects. The review starts by Supervised learning, a branch of machine learning
discussing the significance of precise butterfly where models are trained on labelled data, has been shown to
categorization for biodiversity research and conservation be particularly effective for image classification tasks.
endeavors. It then goes into specifics about different Techniques such as convolutional neural networks (CNN),
methods used in supervised learning for this purpose, support vector machines (SVM) and k-nearest neighbours (k-
such as convolutional neural networks (CNNs), support NN) have been used to address the complexity of butterfly
vector machines (SVMs), and k-nearest neighbors (k-NN). image classification. CNNs, with their ability to
automatically learn hierarchical features of images, have
The review discusses the pros and cons of using these become the method of choice for many researchers due to
methods on butterfly image data, emphasizing on their exceptional performance in visual recognition tasks.
accuracy, efficiency, and generalization. Special focus is
placed on the preprocessing procedures necessary to This paper explores the use of these supervised learning
improve image quality and extract features, including techniques within Google Colab, a widely used cloud-based
image augmentation, normalization, and feature scaling. platform that facilitates easy experimentation with machine
The article also investigates various butterfly image learning models. Google Colab provides an accessible
datasets that are accessible to the public, analyzing how environment for developing and training models using
they are used for training and assessing classification popular machine learning libraries such as TensorFlow and
models. PyTorch. Its integration with these libraries allows for
seamless execution of complex algorithms and offers tools for
Google Colab is highlighted as a potent instrument efficient model training and evaluation.
for creating and testing these models because of its
convenience, user-friendliness, and compatibility with II. BACKGROUND
leading machine learning libraries such as TensorFlow
and PyTorch. Furthermore, the article examines recent Supervised Learning- Supervised learning involves
research and initiatives that have effectively utilized training a model on a labelled dataset, where each input image
butterfly image categorization with Colab, demonstrating is associated with a specific label (butterfly species in this
ideal methods and insight gained. case). The model learns to associate input images with their
corresponding labels through a training process and its
Image Preprocessing, Feature Extraction, Machine performance is evaluated on a separate test data set.
Learning Libraries, TensorFlow, PyTorch, Image
Augmentation, Publicly Available Datasets.
Classification Models: The Following are the Different
Keywords:- Butterfly Image Classification, Supervised Types of Classification Models-
Learning, Google Colab, Convolutional Neural Networks
(Cnns), Support Vector Machines (Svms), K-Nearest Support Vector Machines (SVM): SVMs are efficient for
Neighbors (K-NN), high-dimensional spaces and can handle cases where the
number of features exceeds the number of samples. They
I. INTRODUCTION are particularly useful when the number of classes is
limited.
Butterfly image classification has become an essential Decision trees and random forests: These models are
task in the field of computer vision, due to its importance in simple and interpretable, with random forests providing a
biodiversity monitoring and conservation. Accurately unified approach to improve robustness.
classifying butterfly species from images can significantly
Image Resizing: Standardize the image dimensions for Evaluate Model: Assess the model's performance using
consistent input to the model. metrics such as accuracy, precision, recall, and F1 score.
Normalization: Scale pixel values to a range between 0 Hyperparameter Tuning: Optimize hyperparameters to
and 1 to aid in faster convergence during training. improve performance.
Augmentation: Apply transformations such as rotations,
flips, and zooms to increase the diversity of the training Visualisation:
set and improve model generalization.
Visualize the training and validation accuracy/loss curves
B. Model Selection for the CNN model to assess learning patterns over
epochs.
CNN Architectures: Plot confusion matrices for all models to illustrate the
classification performance, highlighting correctly and
LeNet-5: An early CNN model that is relatively simple incorrectly classified instances.
and suitable for baseline comparisons.
AlexNet: Introduced deeper layers and dropout, providing IV. PROGRAM CODE
better performance on larger datasets.
VGGNet: Known for its deep architecture and use of import numpy as np
small convolutional filters. import pandas as pd
ResNet: Uses residual blocks to address vanishing import tensorflow as tf
gradient problems and is effective for very deep networks. from tensorflow import keras
from tensorflow.keras.preprocessing.image import Image
Transfer Learning: Data Generator
Pre-trained Models: Leverage models like VGG16, from tensorflow.keras.utils import to_categorical
ResNet50, or InceptionV3 trained on large datasets (e.g., from sklearn.model_selection import train_test_split
ImageNet) and fine-tune them on the butterfly dataset. import matplotlib.pyplot as plt
import random
import pathlib
import os
tf.random.set_seed(42)
train_data =
keras.utils.image_dataset_from_directory('/content/dataset/tr
ain',validation_split = 0.2, subset = 'training', seed = 1, shuffle
Fig 3: Output 3
Fig.4: Output 4
Fig 1: Output 1
VI. CONCLUSION
REFERNCES