Unveiling Monkey BreadID: Deep Learning for Precise Monkey Breed Identification

Piyush Panchariya
3 min readDec 17, 2023

--

Monkey’s Learning :)

Introduction:

In the realm of computer vision and deep learning, Monkey BreadID stands as a testament to the power of innovative technology in addressing real-world challenges. This project, developed with a combination of Convolutional Neural Networks (CNN), Keras, and MobileNet, redefines our ability to identify monkey breeds with unprecedented precision through photographs.

The Essence of Monkey BreadID: Monkey BreadID is an advanced system designed to accurately identify and classify monkey breeds based on images. This ambitious project utilizes state-of-the-art deep learning technologies, including CNN, Keras, and MobileNet, to revolutionize breed recognition.

The Technological Backbone:

Convolutional Neural Networks (CNN): At the heart of Monkey BreadID lies a sophisticated CNN architecture, enabling the extraction of intricate features from monkey images for precise breed identification

Keras Integration: The project leverages the Keras deep learning library to develop and train the neural network, ensuring a streamlined and user-friendly implementation of the model

MobileNet Architecture: MobileNet, a lightweight deep learning architecture, is integrated to optimize the model for efficient performance on various devices without compromising accuracy

Enhancing Model Training with ImageDataGenerator: The implementation of ImageDataGenerator is pivotal to Monkey BreadID’s success. This technique augments and preprocesses training data, allowing the model to generalize effectively and perform well under diverse image conditions.

Achieving Precision in Diverse Conditions: Monkey BreadID’s robustness is demonstrated by its ability to achieve high precision in breed recognition, even when faced with variations in lighting, background, and pose. This ensures practical applicability in real-world scenarios.

Scalability and Continuous Learning: The project is designed with scalability in mind, ensuring seamless integration across different devices and platforms. Additionally, a continuous learning mechanism has been incorporated, enabling the model to adapt and improve its accuracy over time with exposure to new and diverse monkey images.

#!/usr/bin/env python

from keras.applications import mobilenet

model= mobilenet.MobileNet(weights = 'imagenet',input_shape=(224,224,3), include_top =False)
model.layers[0].input
model.summary()


for layer in model.layers:
layer.trainable=False

model.layers[34].trainable


from keras.layers import Dense
from keras.models import Sequential

nmodel=Sequential(model.layers)

nmodel.summary()


from keras.layers import Flatten

nmodel.add(Flatten())

nmodel.summary()

nmodel.add(Dense(units=164,activation='relu'))

nmodel.add(Dense(units=128,activation='relu'))

nmodel.add(Dense(units=32,activation='relu'))

nmodel.add(Dense(units=32,activation='relu'))

nmodel.add(Dense(units=10,activation='softmax'))

nmodel.compile(optimizer='adam',loss='categorical_crossentropy',metrics=['accuracy'])


from keras.models import Model
from keras.preprocessing.image import ImageDataGenerator
from keras.preprocessing.image import ImageDataGenerator
# Let's use some data augmentaiton

train_datagen = ImageDataGenerator(
rescale=1./255,
rotation_range=45,
width_shift_range=0.3,
height_shift_range=0.3,
horizontal_flip=True,
fill_mode='nearest')

validation_datagen = ImageDataGenerator(rescale=1./255)

# set our batch size
batch_size = 32

training_set = train_datagen.flow_from_directory(
'E:/Documents/Arth/Data_Science/Machine-Learning/Deep_Learning/CNN/Monkeys/monkey_breed/train',
target_size=(224, 224),
batch_size=batch_size,
class_mode='categorical')

test_set = validation_datagen.flow_from_directory(
'E:/Documents/Arth/Data_Science/Machine-Learning/Deep_Learning/CNN/Monkeys/monkey_breed/validation',
target_size=(224, 224),
batch_size=batch_size,
class_mode='categorical')

nmodel.fit(
training_set,
steps_per_epoch = len(training_set),
epochs=5,
validation_data=test_set,
validation_steps=len(training_set))


from keras.preprocessing import image

img = image.load_img("n006.jpg",target_size=(224,224))

import numpy
nimg=image.img_to_array(img)
nimg = numpy.expand_dims(nimg, axis=0)
nmodel.predict(nimg)

Conclusion:

Monkey BreadID not only showcases the technical prowess in deep learning and computer vision but also exemplifies a commitment to delivering innovative solutions for real-world challenges. As we navigate the frontiers of technology, this project underscores the potential of AI to contribute meaningfully to our understanding of the animal kingdom, making strides toward a more connected and technologically advanced future.

--

--

No responses yet