MVS_Expt8 Object Detection and Reconstruction Using CNN
MVS_Expt8 Object Detection and Reconstruction Using CNN
Introduction
In this practical we'll delve into implementing vision two essential computer vision task using
Convolutional Neural Network (CNN). The first task involves abject detection using a CNN
model trained on the CIFAR-10 dataset.
There are many popular tools and frameworks for developing CNNs, including:
Step Involved
TensorFlow: For deep learning operations and building the CNN model.
NumPy: For numerical operations.
Matplotlib: For visualizing the image and predictions.
OpenCV: Imported but not directly used in this code.
JSPM’s
RAJARSHI SHAHU COLLEGE OF ENGINEERING
TATHAWADE, PUNE-33
(An Autonomous Institute Affiliated to Savitribai Phule Pune
University, Pune)
DEPARTMENT OF AUTOMATION AND ROBOTICS
Normalization: Divide pixel values by 255 to scale them to the range [0, 1].
One-Hot Encoding: Convert class labels into a binary matrix for compatibility with
the categorical cross-entropy loss function.
Load an external image and resize it to match the model's input dimensions (32x32).
Convert the image to an array and add a batch dimension using np.expand_dims.
Predict: Use the trained model to get class probabilities for the input image.
JSPM’s
RAJARSHI SHAHU COLLEGE OF ENGINEERING
TATHAWADE, PUNE-33
(An Autonomous Institute Affiliated to Savitribai Phule Pune
University, Pune)
DEPARTMENT OF AUTOMATION AND ROBOTICS
Class Label: Use np.argmax to extract the index of the highest probability,
corresponding to the predicted class.
Display the input image and overlay the predicted class label using Matplotlib.
Applications:
Conclusion:
Code:
Output: