Abstract For My Project
Abstract For My Project
FLAT
1. System Overview
This code snippet outlines a practical approach for detecting flat tires using a
deep learning model, specifically MobileNetV2, through TensorFlow. The system
is designed to classify images of tires to determine if they are flat or not. The
process begins with setting up the environment, including installing TensorFlow
and creating directories for storing images.
Images of tires are downloaded and saved in known and Unknown directories.
2. System Architecture
A. Data Acquisition
1. Image Sources:
a. Known Images: Images of flat tires stored in a known/
directory for reference or model training.
b. Unknown Images: Images of wheels that require
classification, stored in an
Unknown/ directory.
2. Image Downloads:
a. Images are sourced from URLs and saved locally for
processing.
B. Core Components
1. Dependencies:
a. TensorFlow: Utilised for loading and running the
MobileNetV2 model.
b. OpenCV: Employed for image processing and visualisation
tasks.
c. NumPy: Used for numerical operations on image data.
2. Model Loading:
a. The MobileNetV2 model is loaded with pre-trained ImageNet
weights, which provides a foundation for feature extraction and
classification.
3. Image Processing Workflow:
a. read_img(path) Function: Responsible for loading, resizing,
and normalising images to the input size required by
MobileNetV2 (224x224 pixels).
b. predict_flat_tire(model, image_path) Function: Executes
model prediction to classify the tire condition based on the
processed image.
4. Result Visualisation:
a. Annotation: The image is annotated with labels indicating "Flat" or
"Not Flat" based on the prediction outcome.
b. Display: Processed images are displayed with annotations using
OpenCV.
3. Detailed Process Flow
1. Download Images:
a. Utilise wget to download images and store them in designated
directories (known/ and Unknown/).
2. Image Preparation:
a. Read images from storage using OpenCV.
b. Resize and normalise images to match the MobileNetV2 input
specifications.
B. Model Inference
1. Annotate Images:
a. Draw labels on images indicating whether the tire is flat or not.
Use colour coding (red for flat, green for not flat) to enhance
visibility.
2. Display Results:
a. Utilise cv2_imshow to display annotated images for review.
4. Code Implementation
import tensorflow
as tf import cv2
import numpy as
np import os
from
google.colab.patc
hes import
cv2_imshow
MobileNetV2 model
model =
if img is None:
def predict_flat_tire(model,
image_path): image =
read_img(image_path) prediction
= model.predict(image)
print(prediction)
return is_flat
# Directory paths
unknown_dir =
'Unknown'
for file in
os.listdir(unknown_dir)
:
file_path = os.path.join(unknown_dir,
img =
cv2.imread(file_path) if
img is None:
# Display result
print(f"Unable toon image
load image at path:
{file_path}")
label continue
= "Flat" if is_flat else "Not
Flat"
is_flat = predict_flat_tire(model, file_path)
color = (0, 0, 255) if is_flat else (0, 255, 0) # Red for flat, Green for
not flat
color, 2) cv2_imshow(img)
5.Output