Uploaded by sk0166

Deep learning assignment 1

advertisement
DEEP LEARNING ASSIGNMENT (IMAGE
CLASSIFICATION MODEL USING A DEEP
LEARNING ALGORITHM)
BY:
S.SABARISH KUMAR (RA2011027020056)
G.RISHIKRISHNAN (RA2011027020008)
K.KARTHIKEYAN (RA2011027020037)
EPLN PARTHASARADHI (RA2011027020019)
SIVA KARTHIKEYAN.B (RA2011027020062)
PROJECT DESCRIPTION:
Convolutional Neural Networks (CNNs) are a popular deep learning algorithm used
for image classification tasks. These networks apply convolutional filters to input
images to extract relevant features, which are then passed through a series of fully
connected layers to perform classification.
To classify an image using CNN, we first need to define and train our model using
a labeled image dataset. The training process involves feeding the network with
batches of images and their corresponding labels, adjusting the network's weights
and biases to minimize the error between the predicted and actual labels.
Once the model is trained, we can use it to classify new, unseen images by passing
them through the network and obtaining the predicted label based on the output of
the final softmax layer. We can evaluate the accuracy of the classification by
comparing the expected label with the actual title of the image.
In this example, we will be using images of various types of vehicles for image
classification. The first step is to collect the data by downloading images of vehicles
from multiple sources, ensuring that we have a good mix of different types of
vehicles, such as cars, trucks, and motorcycles. Web scraping tools can be used to
automate this process.
Next, we need to preprocess the data by resizing the images to a standard size,
converting them to grayscale or RGB, and normalizing the pixel values. These steps
are essential to ensure that the images are in a consistent format for the network to
learn from.
DATASET URL:
CIFAR-10 - https://www.cs.toronto.edu/~kriz/cifar.html
ImageNet - http://www.image-net.org/
MNIST - http://yann.lecun.com/exdb/mnist/
PROGRAM CODE & OUTPUT:
PROGRAM:
from imageai.Classification import ImageClassification
import os
execution_path = os.getcwd()
prediction = ImageClassification()
prediction.setModelTypeAsResNet50()
prediction.setModelPath(os.path.join(execution_path,
"resnet50-
19c8e357.pth"))
prediction.loadModel()
predictions,
probabilities
prediction.classifyImage(os.path.join(execution_path,
result_count=5 )
=
'house.jpg'),
for eachPrediction, eachProbability in zip(predictions, probabilities):
print(eachPrediction , " : " , eachProbability)
OUTPUTS:
INPUT IMAGE:
OUTPUT IMAGE:
DISCUSSION:
Image classification is an essential problem in computer vision that involves
categorizing images into a set of predefined categories. Deep learning algorithms,
such as Convolutional Neural Networks (CNNs), have shown great success in image
classification tasks due to their ability to learn and extract relevant features from
images automatically.
To build an image classification model using a deep learning algorithm, we first need
a dataset of labeled images to train and test the model. The dataset should contain
images belonging to different classes that the model needs to classify. In the training
phase, we feed batches of images to the model, and the algorithm learns to adjust the
weights and biases of the network to minimize the difference between the predicted
and actual labels.
CNNs are particularly well-suited for image classification tasks because they can
automatically learn and extract features from images. They apply convolutional
filters to the input images, which extract features such as edges, corners, and
patterns. These features are then passed through a series of fully connected layers to
perform classification.
One of the main advantages of using deep learning algorithms for image
classification is their ability to generalize to new, unseen images. After training, the
model can classify images that it has never seen before with a high level of accuracy.
However, this requires careful training, validation, and testing to ensure that the
model is not overfitting to the training data.
While deep learning algorithms have shown great success in image classification,
there are still many challenges and limitations to overcome. For example, they
require a large amount of labeled data for training, and the training process can be
computationally intensive, especially for large datasets. Additionally, they can be
susceptible to adversarial attacks, where small, imperceptible changes to an image
can cause the algorithm to misclassify it.
In summary, image classification using deep learning algorithms is a powerful tool
for a wide range of applications, but careful consideration must be given to the
dataset, training, and testing procedures to ensure accurate and reliable performance.
Ongoing research and development in this area will continue to improve the
performance of these algorithms and enable even more advanced image
classification tasks.
CONCLUSION:
The dataset used to train and test CNNs categorizes pictures based on their visual
content, with an accuracy percentage exceeding 98%. To train the network, tiny
grayscale images are used as teaching resources, which require more processing time
compared to regular JPEG photos.
To achieve even more accurate image classification, a model with more layers and
a larger dataset of pictures could be trained on a cluster of GPUs. In the future, efforts
will focus on categorizing large, colored images, which are particularly useful for
image segmentation.
Overall, the high accuracy of the current dataset and the potential for further
improvement suggest that CNNs hold promise for a wide range of image
classification tasks.
Download