"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

October 30, 2019

Day #292 - Gstream on Windows10

Note - Do "complete" instead of "typical" for both cases for it to work

This link was useful to experiment and follow.

Step 1. Download installer1 from link

Step 2. Download installer2 from link

Install both of them in Windows, Goto Folder - F:\gstreamer\1.0\x86_64\bin

Step #3 - Command
gst-launch-1.0.exe -v ksvideosrc device-index=0 ! video/x-raw, format=YUY2, width=320, heigh=240, framerate=30/1, pixel-aspect-ratio=1/1 ! videoconvert ! autovideosink

Stream Output

Next Post Stream from rasberry pi to windows

Happy Learning!!!

October 29, 2019

Day #291 - Working with chatterbot - Windows 10


Happy Learning!!!

Day #290 - Yolo from OpenCV DNN - Windows 10

OpenCV has examples to invoke Deep Network using readNet modules

Key Methods
  • cv.dnn.readNet - Load the network
  • cv.dnn.NMSBoxes - Non Max Suppression
  • cv.dnn.blobFromImage - Input for Deep Network
Steps

Results




Happy Learning!!!

October 25, 2019

Day #289 - Example code for Class Creation, Data Persistence, Email and Phone number Validation

Example code for Class Creation, Data Persistence, Email and Phone number validators

Happy Learning!!!

October 24, 2019

Day #288 - Messaging using pyzmq

pip install pyzmq

Example - python usage

Output


Real world use case - imagezmq: Transporting OpenCV images

Happy Learning!!!

October 19, 2019

Day #287 - Dlib Custom Detector

Learning's
  • Aspect ratio needs to be maintained
  • Trained for only one type of Object (Vim Dishwasher)
  • Trained with just a few images 30 images of train and 5 images of test
  • Environment - Windows 10, After all the Setup and Steps, It would take ~45 mins to develop for label, training, and testing
Data Set
  • Custom Shelf and Vim dishwash Detection
Image Pre-requisites
  • I resized data to 512 x 512 format to be consistent
  • Place all images in train and test directory respectively before next steps
Label Training Data
  • Img Lab Installation - Refer previous post
  • Use Shift key to select rectangle
  • Use Alt D to delete region
  • Each tool has its own commands



Label Testing Data


Training Code




Test Code



Result

Day #286 - Working with imglab Annotation Tool

Working with imglab annotation tool.


Happy Learning!!!

October 17, 2019

Learning Moments

Last three-four days, I was breaking my head for a segmentation task. There were a ton of tutorials. Everywhere I pick a code and ended up not working. Finally, I managed to segment it. When we sit and learn alone defintely there will be moments of long failures. Do whatever you do with a bit of curiosity and interest. Learning is an ongoing habit. We are not used to proper learning with focus, attention, curiosity, passion, and experimentation.  

Happy Learning!!!

Day #285 - Experimenting with Unet Segmentation

U-Net

  • Symmetric U-Shape - Convolutions + Poolings
  • Up-Convolutions - Upsampled layers
  • Encoder / Decoder
  • Contraction / Expansion
  • Skip Connections to learn pixel information

There are a ton of tutorials out there but it takes time to find to what works for us :) in our environment. I was experimenting on u-net based segmentation past few days. I will share my learnings on what worked for me.

Step 1 - The initial image is

I am interested in segmenting the parts (products)

Step 2 - The first step is to resize the image into 256 x 256 dimension



Step 3 - The Next Step is to binarize the image

This is the source image. The target image is


Step 4 - Tool - I used paint 3D and white brush in it to segment the required parts for my need

Step 5 - Follow the steps and create the train and label (source and segmented image)

Step 6 - Train the model, Got the repo and customized it link

Step 7 - The predictions for the test image are




Next Demo


 Happy Learning!!!


October 15, 2019

Day #284 - OpenCV Error in Windows server 2012


  • Turn windows features on or off
  • Skip the roles screen and directly go to Feature screen
  • Select "Desktop Experience" under "User Interfaces and Infrastructure"

Think answer was useful link

Happy Learning!!!

October 11, 2019

Day #283 - Clustering to group similar Images


For large retail datasets, before object detection. Clustering becomes essential to focus on each cluster to take it forward. Today's post is clustering images into similar groups

  • Generate Feature Data based on VGG / Resnet
  • Cluster them using Kmeans
  • Result output to their respective cluster directory


Input - Mixed Set of Images
Output 
Cluster 1
Cluster 2

Cluster 3
More Reads - Example (in R)

Happy Learning!!!

October 10, 2019

Day #282 - Retail Product Detection / Retail Object Detection


Paper #1 - Automatic Detection of Out-Of-Shelf Products in the Retail Sector Supply Chain

Rule-based information system
  • OOS Contribution factors - Measurement of product availability, Measurement of shelf availability
  • Approach - Radio-Frequency Identification based
  • Rule - “IF (a product is fast-moving) AND (has low sales volatility) AND (POS sales = 0 for today) THEN the product is OOS
  • IF Fastmoving product sales count is zero then there is a problem
  • Detection approach = Historical data -> Patterns -> Rules = Apply on Current Data
Paper #2 - Retail Shelf Analytics Through Image Processing and Deep Learning
Analysis
  • Tasks - Automatic product checkout using segmentation, Object detection of products on store shelves
  • Approach - Shelf Image -> Detector for regions (Class, BBox, Mask) -> Crop Each Region -> Object -> Feature Extractor -> KNN Classifier

Paper #3 - A deep learning pipeline for product recognition on store shelves
Analysis
  • Shelf Image -> Region proposals -> Crop -> Reference Images -> Refinement -> Detection

Paper #4 - Planogram Compliance Checking Based on Detection of Recurring Patterns
Analysis
  • Shelf Image -> Region Partition -> Recurring Pattern Detection -> Compliance Checking

High Level Recommendations (Apply Combination of techniques)
  • Shelf Image -> Region Partition -> Region proposals -> Detect Recurring Pattern, Reference Images for refinement -> Prediction
Project Analysis 
The Shelf Detector System For Retail Stores Using Object Detection

pip install -r requirements.txt
python train_obj_detector.py testNutella1

Code Details - https://github.com/bobquest33/dlib_obj_count/blob/master/nutella.pdf
Tool Used - https://imglab.in/

Interesting Read
Retail Product Recognition on Supermarket Shelves

Paper #5 - Rethinking Object Detection in Retail Stores
Key Notes
  • Simultaneously object localization and counting, abbreviated as Locount
  • Algorithms to localize groups of objects of interest with the number of instances
  • Most of the state-of-the-art object detectors use non-maximal suppression (NMS) to post-process object proposals to produce final detections
New Approach
  • Cascaded localization and counting network (CLCNet)
  • Localize groups of objects of interest with the numbers of instances
Dataset
  • Grozi-120 dataset
  • Freiburg Groceries dataset
  • GameStop dataset
  • Retail-121 dataset
  • Sku110k dataset
  • TGFS dataset
Cascade R-CNN [1] proposes a multi-stage object detection architecture, which is formed by a sequence of detectors trained with increasing IoU thresholds

Locount Dataset
  • 140 common commodities, including 9 big subclasses
  • Cascaded localization and counting network (CLCNet
    • count-regression strategy for counting
    • count-classification strategy for counting
  • Locount to localize groups of objects with the instance numbers, which is more practical in retail scenarios



Happy Learning!!!

October 09, 2019

Day #281 - Yolo based Object Counting and Duplicate Removal

Today's learning is Yolo based object counting, duplicate removal using intersection over union metric.

Happy Learning!!!

October 08, 2019

Day #280 - Human detection and Tracking

Project #1 - Human Detection and Tracking 

Overview
  • Detecting a human and its face in a given video and storing Local Binary Pattern Histogram
  • Recognize them in any other videos
  • Local Binary Pattern Histogram - type of visual descriptor, clockwise direction check neighbour values
Execution Steps
Clone the project
Step 1 - python create_face_model.py -i data
Step 2 - python main.py -v video

Project #2 - Person-Detection-and-Tracking  (Pending Execution)

Overview
  • The person detection in Real-time is done with the help of Single Shot MultiBox Detector
  • Single Shot MultiBox Detector
  • Tracking - Kalman Filter is fed with the velocity, position and direction of the person which helps it to predict the future location 
Single Shot MultiBox Detector
  • The core of SSD is predicting category scores and box offsets for a fixed set of default bounding boxes using small convolutional filters applied to feature maps
  • The key difference between training SSD and training a typical detector that uses region proposals, is that ground truth information needs to be assigned to specific outputs in the fixed set of detector outputs
Execution Steps
Clone the project https://github.com/ambakick/Person-Detection-and-Tracking

Execute - camera.py in Spyder

Project #3 - Tracker Types Demo Project (Pending Execution)

Overview
  • Track Multiple faces
  • Download and Experiment
Run Below Demos
demo - track multiple faces.py
Multiple_Trackers.py
face_eye.py
distance_to_camera.py

Datasets - Link

Object Motion Detection and Tracking for Video Surveillance
Measuring size and distance with OpenCV
Calculate X, Y, Z Real World Coordinates from Image Coordinates using OpenCV

Happy Learning!!!

October 07, 2019

Learning and Growth

Every job / role / growth is more about understanding the problem / perspective / business and technical dimensions. AI has a lot of tools, languages, architecture, research insights. It is ongoing learning to evaluate all possible solutions, productize with certain boundaries, keep learning to expand other architectures. Be open to learning, titles/roles are a cascade effect of your consistent efforts.

Keep Going!!!


October 03, 2019

Day #279- Multi-Object Tracking

Project #1 - vehicle-speed-check

Clone Repository - Link

On Anaconda prompt,
cd vehicle-speed-check
pip install -r requirements.txt
python speed_check.py

Comments - Very good project to get started. The logic of speed computation with respect to frames per second, pixel movement can be reused in other use cases. Use of dlib correlation tracker. The tracking logic can be reused in other similar implementation

Project #2 - Simple Example code (ROI Based)



Project #3 - Another interesting project from Adrian blog 

Cloned the project and executed the demo. This code does not work in windows 10 though. Someone has fixed the code. The working code is in link 

python multi_object_tracking_fast.py --prototxt E:\Code_Repo\multiobject-tracking-dlib\mobilenet_ssd\MobileNetSSD_deploy.prototxt  --model E:\Code_Repo\multiobject-tracking-dlib\mobilenet_ssd\MobileNetSSD_deploy.caffemodel --video E:\Code_Repo\multiobject-tracking-dlib\race.mp4 --output E:\Code_Repo\multiobject-tracking-dlib\race_output_fast.avi

October 02, 2019

Day #278 - Object Tracking - TensorFlow Object Counting API

I came across this project. Fantastic work!! The Detection part needs to be finetuned for the Indian scenario, the tracking seems fine performing decently. You can spot a few false positives, Trucks on the other side of the lane are not detected, Indian Trucks are not well recognized. This can be handled by a custom detection model. Overall the tracking and counter approach can be reused in multiple scenarios.

Clone the project - object_counting_api

vehicle_counting.py - Executed this for some of my highway videos.

The objects passing through the line will be counted and incremented. Minor changes to roi

Output of the same



Happy Learning!!!

Analytics in Elections

If Analytics is used to target people, neutralize opinions, create digital impressions. This would lead to the creation of bias. This is not an ethical use of AI.

Analytics is needed to create affordable health care, forecast economy, provide good insights to develop people, economy jobs. AI should be used in the right sense. AI for politics will benefit in the short term but it is a curse in the long term.

When the truth is neutralized with biased facts the consequences of power with the wrong leaders will be a curse for the future generations

Keep Thinking!!!