0% found this document useful (0 votes)
26 views43 pages

Image Data

The document outlines a comprehensive workflow for image data processing, including data collection, pre-processing, segmentation, feature extraction, classification, and evaluation. It details various techniques for each step, such as resizing, noise reduction, and edge detection, as well as methods for classification and evaluation metrics. The document emphasizes the importance of these processes in enhancing model performance and accuracy in applications like medical imaging and object recognition.

Uploaded by

dkarthibala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views43 pages

Image Data

The document outlines a comprehensive workflow for image data processing, including data collection, pre-processing, segmentation, feature extraction, classification, and evaluation. It details various techniques for each step, such as resizing, noise reduction, and edge detection, as well as methods for classification and evaluation metrics. The document emphasizes the importance of these processes in enhancing model performance and accuracy in applications like medical imaging and object recognition.

Uploaded by

dkarthibala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 43

IMAGE DATA

WORKFLOW

1. Data Collection
2. Pre-processing
3. Segmentation
4. Feature Extraction
5. Classification
6. Evaluation
1. DATA COLLECTION:

 Public Datasets:
Websites like Kaggle, ImageNet, COCO (Common Objects in
Context), and Open Images provide large collections of annotated images for various
purposes.
 Web Scraping:
Automated tools can be used to scrape images from the web,
though this requires attention to copyright and ethical considerations.
 APIs:
Some platforms, like Google Images, provide APIs that allow developers
to fetch images based on specific queries.
 Manual Collection:
Curating images manually from specific sources or
databases.
2. PREPROCESSING

 Data pre-processing for image data involves preparing images for analysis or model
training.
Image pre-processing is the process of manipulating raw image data into a usable and
meaningful format.
 It allows you to eliminate unwanted distortions and enhance specific qualities essential for
computer vision applications.
 Pre-processing is a crucial first step to prepare your image data before feeding it into
machine learning models.
TECHNIQUES USED IN IMAGE PRE-PROCESSING:

Resizing: Resizing images to a uniform size is important for machine learning algorithms to function
properly. We can use OpenCV’s resize() method to resize images.

Grayscaling: Converting color images to grayscale can simplify your image data and reduce
computational needs for some algorithms. The cvtColor() method can be used to convert RGB to
grayscale.

Noise reduction: Smoothing, blurring, and filtering techniques can be applied to remove unwanted
noise from images. The gaussianBlur () and medianBlur () methods are commonly used for this.
Normalization: Normalization adjusts the intensity values of pixels to a desired range, often between
0 to 1. This can improve the performance of machine learning models. normalize() from scikit-image
can be used for [Link] pixel value:255/pixel value.

Binarization: Binarization converts grayscale images to black and white by thresholding. The
threshold() method is used to binarize images in OpenCV.

Contrast enhancement: The contrast of images can be adjusted using histogram equalization. The
equalizeHist () method enhances the contrast of images.
Normalization: Normalization adjusts the intensity values of pixels to a desired range, often between
0 to 1. This can improve the performance of machine learning models. normalize() from scikit-image
can be used for [Link] pixel value:255/pixel value.

Binarization: Binarization converts grayscale images to black and white by thresholding. The
threshold() method is used to binarize images in OpenCV.

Contrast enhancement: The contrast of images can be adjusted using histogram equalization. The
equalizeHist () method enhances the contrast of images.
Value
Color

0 Black

50 Very dark gray

100 Dark gray (but still brighter than black)

127 Medium gray

200 Light gray

255 White
RESIZING AND CROPPING IMAGES

ORIGINAL IMAGE TO GRAYSCALE


1. Mean Filter
Replaces center pixel with average of surrounding pixels.
Simple and fast smoothing technique.
Reduces random noise, but blurs edges.
Best for light noise in smooth areas.

[Link] Filter
Replaces center pixel with the median (middle) value.
Very effective for salt-and-pepper noise.
Preserves edges better than mean filter.
Ideal for removing impulse noise.
[Link] Filter
Uses a weighted average: center pixels have more weight. Example:
1 2 1
Based on the Gaussian (bell-shaped) function.
2 4 2
Smooths image while maintaining more detail. 1 2 1
Best for natural-looking blur and edge preservation.
Gaussian and median image display
Laplacian Filter

 Laplacian Filter detects edges by highlighting areas of rapid intensity change.

 It uses a kernel with a strong center value and negative surrounding weights.

 Ideal for feature extraction and edge detection in image processing tasks.
Bilateral Filter

 Bilateral Filter smooths images while keeping edges sharp.


 It uses both spatial distance and pixel intensity difference for filtering.
 Ideal for noise reduction in photos and medical images where edges matter.
Wiener filter
• Wiener filter adapts to local mean and variance to reduce noise.
• It balances image restoration and smoothing for better clarity.
• Best used when the image is degraded by both noise and blur

Advantages
Excellent for denoising blurred or degraded images.
Works well for medical, satellite, and low-light images.
Data augmentation
Data augmentation is the process of artificially increasing the size and variety of your dataset.
It helps improve model accuracy and prevent overfitting.

Rotation – helps model recognize tilted objects.


Flipping – accounts for changes in direction.
Zooming – handles different object sizes.
Brightness change – adjusts for lighting conditions.
Shifting – moves the object left/right/up/down.
Adding noise – simulates camera imperfections.
IMAGE SEGMENTATION

• Divides an image into multiple regions or objects.


• Helps in locating and identifying objects within an image.
• Essential for object detection, medical imaging, face recognition, etc.
• Works by grouping similar pixels based on color, texture, or intensity.
• Output: A mask or label map that highlights different regions.

Example:
In a medical image → segment tumor from healthy tissue
In a leaf image → separate diseased part from healthy part
In self-driving cars → identify road, vehicles, people, etc.
Thresholding

 Thresholding is a method to turn a grayscale image into black and white.


It helps in separating objects in an image from the background.
 Select a threshold value (commonly 127).
If pixel > 127 → white (255)
If pixel ≤ 127 → black (0)

Advantages
Easy and fast to apply
Reduces complexity
Useful in pre-processing for ML models
Edge Detection
• A technique used to find the boundaries between different regions in an image.
• Edges are areas where the image brightness changes sharply (like object outlines).
• Helps to identify shapes, objects, and boundaries.
• Used in segmentation, object recognition, and feature extraction.

Common Edge Detection Methods


Sobel Operator – Detects vertical and horizontal edges.
Prewitt Operator – Similar to Sobel, used for detecting gradients.
Canny Edge Detector – Advanced method; reduces noise and finds clear edges.
Laplacian Operator – Detects all directional edges (2nd order derivative).
Applications
Detecting leaf edges for disease area detection.
Finding object boundaries in satellite images.
Scanning and cropping documents.
Region Growing
 A segmentation technique that starts from a seed pixel and expands by adding similar neighboring pixels.
 Grows the region based on color, intensity, or texture similarity.

Step-by-Step Process
• Select a seed pixel in the target region.
• Check neighboring pixels for similar properties.
• Add matching pixels to the region.
• Repeat the process with newly added pixels.
• Stop when no more similar neighbors are found.

Advantages
• Effective for connected and irregularly shaped objects.
• More accurate for noisy or complex images compared to simple thresholding.
Clustering Segmentation
• A method that groups pixels into clusters based on similar features such as color, texture, or intensity.
• Does not need labeled data – works in an unsupervised way.
Purpose
• To identify and separate regions in an image that share common characteristics.
• Helps divide an image into meaningful parts for further analysis.

Common Clustering Methods


K-Means Clustering

is an unsupervised machine learning algorithm used to group similar data points into K distinct clusters. It’s

mainly used when you don’t have labeled data and want to discover patterns or groupings.

• Divides pixels into K groups based on feature similarity.

• Fast and widely used.


K-Means Clustering
Gaussian Mixture Models (GMM)
• Assumes data comes from multiple Gaussian distributions.
• Allows for softer boundaries between clusters.
Fuzzy C-Means (FCM)
Fuzzy C-Means (FCM) is a clustering algorithm like K-Means, but instead of assigning each data point to one cluster
only, it allows a data point to belong to multiple clusters with different degrees (weights or probabilities).
• Allows pixels to belong to multiple clusters with varying degrees.
• Useful for overlapping regions.
Feature extraction
Feature extraction is the process of identifying and pulling out important information or patterns from an
image.
These features are used by machine learning or deep learning models to make predictions or classifications.
• Reduces the image data to essential information.
• Helps the algorithm focus on key structures, patterns, or textures.
• Makes the model faster, more accurate, and less complex.

Common Image Features


Edges
Boundaries of objects (detected using Sobel, Canny filters).
Corners
Points where two edges meet; useful for object recognition.
Texture
Patterns in surface appearance (e.g., smooth, rough, patchy).
Color
Useful in classification tasks like identifying disease in leaves.
Shape
The geometry or outline of objects in the image.

Benefits Feature Extraction


• Simplifies data while preserving essential info.
• Improves model training time and accuracy.
• Enables better object recognition and segmentation.
Feature Extraction Techniques

Method Purpose

SIFT (Scale-Invariant Feature Transform) Detects key points invariant to scale and rotation

HOG (Histogram of Oriented Gradients) Captures edge and shape information

LBP (Local Binary Patterns) Extracts texture features

CNNs (Convolutional Neural Networks) Automatically extract high-level features


Classification
• Classification is the process of assigning a label or category to input data (like an image or its features).
• In image processing, it involves identifying what is present in an image — for example, classifying
whether a leaf is healthy or diseased.

Classification Works
Input: Features extracted from an image (e.g., color, texture, shape).
Model: A machine learning or deep learning model (e.g., SVM, Decision Tree, CNN).
Output: A predicted class label (e.g., “Healthy Leaf”, “Diseased Leaf”).
Common Classification Algorithms

Algorithm Description
Real-Life Example(classification
Imagine you're a teacher separating students:
Group A: Students who passed (green dots)
Group B: Students who failed (red dots)
SVM(Support Vector Machine)
SVM will draw a line (or curve) between them that:
Best separates both groups
Leaves maximum margin (space) between the line
and the nearest points from both groups

Decision Tree Classification (e.g., pass/fail, yes/no, spam/ham)


Regression (e.g., predicting a number like house price)
K-NN
K-NN (K-Nearest Neighbors) is a supervised machine learning algorithm used for:
Classification (most common)
Regression (less common)

Let's say you choose K = 3. You want to classify a new point (X).
You calculate distances:

Neighbor Class Distance


A Cat 2.1
B Dog 2.2
C Dog 2.3
D Cat 3.0

The 3 nearest neighbors are A, B, and C → Vote: Dog (2 votes) → So X


is classified as Dog.
Example: Leaf Disease Classification
After extracting features (color, texture) from a tomato leaf image:
A classifier predicts if it's:
• Healthy Leaf
• Scorch
• Red Rust
• Insect Bite
• Multiple Disease

Benefits of Classification
• Automates complex image analysis.
• Saves time and improves accuracy.
• Essential for real-time applications (e.g., crop monitoring, medical scans).
Evaluation
• Evaluation measures how well a machine learning or deep learning model performs.
• It helps us understand the accuracy, reliability, and quality of the model's predictions.
• Used after training to test the model on new (unseen) data.

Why Evaluation is Important?


• Tells us if the model is making correct predictions.
• Helps in comparing different models or techniques.
• Identifies if the model is overfitting or underperforming.
Common Evaluation Metrics

For classification

Metric Meaning
Overall correctness (% of total correct
Accuracy
predictions)
How many predicted positives are actually
Precision
correct
How many actual positives are correctly
Recall
identified
F1 Score Balanced average of precision and recall
Confusion Matrix Breakdown of TP, TN, FP, FN for detailed insight
Example: Leaf Disease Classification
:
Accuracy: 94% (Model correctly classified 94 out of 100 leaves)
F1 Score: 0.91 (Balanced measure of precision and recall)

You might also like