L-layer Deep Neural Network Model is developed from scratch with python for Cat vs non-cat image binary classification. Notebook
L-layer Deep Neural Network Model Architecture
- Initialize weight and bias parameters for L-layer deep neural network
- Compute Linear Forward Activation LINEAR->RELU for
$L-1$ layers and LINEAR->SIGMOID for last layer - Compute the loss with Binary Cross Entropy cost function
- Compute gradients of loss function respect to parameters of hidden layers in Linear Backward Activation
- Update hidden layer parameters for gradient descent using learning rate
- "Cat vs non-Cat" dataset stored as
train_catvnoncat.h5
andtest_catvnoncat.h5
contains 64 x 64 dimension labelled images. - Binary Classification Model contains hidden layers with [12288, 20, 7, 5] units and output layer with 1 unit.
- Learning Rate : 0.0075
- Loss : Binary Crossentropy
- Cat vs non-cat classification model achieved 78% accuracy and 0.83 F1 Score on test dataset
K-means clustering algorithm is implemented to compress image in this project. Notebook
In a 24-bit color representation of an image, each pixel is represented as three 8-bit unsigned integers (ranging from 0 to 255) specifically Red, Green and Blue intensity values which is known as RGB encoding. Every image contains thousands of colors and we can compress an Image by reducing the numbers of colors to 16 colors. Thus we will only store the RGB values of the 16 colors, and for each pixel we only need to store the index (4 bit to represent 16 color ) of assigned color.
K-means clustering algorithm is used to partition image pixel color values in to 16 color values which is used to compress image.
% Initialize centroids
centroids = kMeansInitCentroids(X, K)
for iter = 1:iterations
% Assign each data point to the closest centroid
idx = findClosestCentroids(X, centroids)
% Compute means based on centroid assignments
centroids = computeMeans(X, idx, K);
end
-
Image data is normalized into range [0,1] after loading
-
Image data is reshaped from (width, height, 3) to (width * height, 3)
-
K-means clustering is run 20 times using
kMeanClustering
with parameter K = 16 and clustering iteration = 10. -
Optimum Clustering Error : 8.65%
-
Clustering Error
- Compressed Image
A transfer learning model is developed using Keras MobileNetV2 to classify 8 different species of Parrot. Notebook
- Deep CNN model MobileNetV2 pretrained on ImageNet dataset is used for Transfer Learning.
- 900 Parrot Species images are gathered from internet with dimension 160 x 160.
- Data augmentation and normalization are applied before model training
- Keras MobileNetV2 model loaded with ImageNet weights (Freeze all layers) and top layer is replaced with Softmax classifier
- Transfer learning model is fine-tuned by unfreezing final 30 layers of MobileNetV2 model and retrain with low learning rate
- Bird model accuracy increased from 89% to 93% after fine-tuning and loss decresed 35% to 15% in test dataset.
Model Accuracy | Train | Validation | Test |
---|---|---|---|
Bird Model | 95% | 94% | 89% |
Bird Model Fine-tuned | 98% | 96% | 93% |
A Deep Learning Model is developed in this project to predict death risk of COVID-19 patients. Notebook
- COVID-19 Dataset provided by the Mexican government.
- Deep Learning Logistic Regression Model used for COVID-19 Death Prediction
- Logistic Regression Model achieved 91% test accuracy and 0.91 F1 Score
Model | Accuracy | Precision | Recall | F1 Score |
---|---|---|---|---|
LR Model | 0.938971 | 0.638825 | 0.369167 | 0.467926 |
LR Model Under Sampled | 0.910423 | 0.882462 | 0.947661 | 0.913900 |
Deep CNN model YOLO (You Only Look Once) is used to detect Car object in image and video. Notebook
YOLO pre-trained model YOLO_v2 based on paper YOLO9000: Better, Faster, Stronger (2016) is used for Car object detection. YOLO_v2 Model is loaded from Official YOLO website and Allan Zelener provided functions in YAD2K for converting YOLO_v2 model into Keras model. YOLO_v2 model was trained on MS-COCO dataset with over 300K labeled images, 5 anchors per image and 80 object categories.
Image Car Detection
- Load image from file and detect car in the image with
yolo_model_prediction
Video Car Detection
- Extract frames from video file with OpenCV and predict car object with
yolo_video_car_detection