Problem Set 4. Danfei Xu CS 231A March 9th, (Courtesy of last year s slides)

Similar documents
CS 231A CA Session: Problem Set 4 Review. Kevin Chen May 13, 2016

Human detection using histogram of oriented gradients. Srikumar Ramalingam School of Computing University of Utah

Classification and Detection in Images. D.A. Forsyth

Case-Based Reasoning. CS 188: Artificial Intelligence Fall Nearest-Neighbor Classification. Parametric / Non-parametric.

CS 188: Artificial Intelligence Fall 2008

Robust PDF Table Locator

Development in Object Detection. Junyuan Lin May 4th

Object Category Detection. Slides mostly from Derek Hoiem

COMP 551 Applied Machine Learning Lecture 13: Unsupervised learning

CSSE463: Image Recognition Day 21

Kernels and Clustering

Feature Extractors. CS 188: Artificial Intelligence Fall Nearest-Neighbor Classification. The Perceptron Update Rule.

(Refer Slide Time: 00:02:00)

2/15/2009. Part-Based Models. Andrew Harp. Part Based Models. Detect object from physical arrangement of individual features

CS 343: Artificial Intelligence

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

Automatic Image Alignment

Deformable Part Models

Idea. Found boundaries between regions (edges) Didn t return the actual region

Automatic Image Alignment (feature-based)

Bag of Words Models. CS4670 / 5670: Computer Vision Noah Snavely. Bag-of-words models 11/26/2013

Classification: Feature Vectors

Project 3 Q&A. Jonathan Krause

Modern Object Detection. Most slides from Ali Farhadi

CSE 573: Artificial Intelligence Autumn 2010

Multivariate Analysis (slides 9)

Computer Vision. Exercise Session 10 Image Categorization

Object Category Detection: Sliding Windows

Information Retrieval and Organisation

Clustering and Visualisation of Data

Module 10 MULTIMEDIA SYNCHRONIZATION

Administrative. Machine learning code. Supervised learning (e.g. classification) Machine learning: Unsupervised learning" BANANAS APPLES

Clustering & Dimensionality Reduction. 273A Intro Machine Learning

SE 263 R. Venkatesh Babu. Object Tracking. R. Venkatesh Babu

Automatic Image Alignment

Object Detection on Self-Driving Cars in China. Lingyun Li

CLASSROOM INVESTIGATION:

Machine Learning using MapReduce

CS 221: Object Recognition and Tracking

Object Detection with Discriminatively Trained Part Based Models

Lecture: k-means & mean-shift clustering

Lecture: k-means & mean-shift clustering

Today s topic CS347. Results list clustering example. Why cluster documents. Clustering documents. Lecture 8 May 7, 2001 Prabhakar Raghavan

CS231A Course Project Final Report Sign Language Recognition with Unsupervised Feature Learning

CS 2750: Machine Learning. Clustering. Prof. Adriana Kovashka University of Pittsburgh January 17, 2017

CS6670: Computer Vision

Object Detection Design challenges

Classification of Surfaces

COMPUTER AND ROBOT VISION

Clustering: Overview and K-means algorithm

Category vs. instance recognition

Colorado School of Mines. Computer Vision. Professor William Hoff Dept of Electrical Engineering &Computer Science.

Using Flash Animation Basics

Image classification Computer Vision Spring 2018, Lecture 18

Using Microsoft Word. Working With Objects


Accelerometer Gesture Recognition

Alexandre Alahi Vignesh Ramanathan. Fei-Fei Li, Alexandre Alahi, Vignesh Ramanathan! Lecture 6-1!! 4-May-15!

Learning Spatial Context: Using Stuff to Find Things

Unsupervised Learning : Clustering

INF4820. Clustering. Erik Velldal. Nov. 17, University of Oslo. Erik Velldal INF / 22

Announcements. CS 188: Artificial Intelligence Spring Classification: Feature Vectors. Classification: Weights. Learning: Binary Perceptron

Parallel Physically Based Path-tracing and Shading Part 3 of 2. CIS565 Fall 2012 University of Pennsylvania by Yining Karl Li

Unsupervised learning in Vision

Unsupervised Learning

VK Multimedia Information Systems

Homework Assignment #3

Separable Kernels and Edge Detection

Performance Analysis and Culling Algorithms

CS1114 Section: SIFT April 3, 2013

Introduction to Artificial Intelligence

Cluster Analysis (b) Lijun Zhang

Feature Matching and Robust Fitting

CS264: Homework #1. Due by midnight on Thursday, January 19, 2017

Learning to Recognize Faces in Realistic Conditions

Clustering & Classification (chapter 15)

K-Means Clustering 3/3/17

Introduction to Information Retrieval

Table of Contents- How to Quickly Format CANS in Word 2010, PC

Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks

Clustering. Introduction to Data Science University of Colorado Boulder SLIDES ADAPTED FROM LAUREN HANNAH

Clustering: Overview and K-means algorithm

Announcements. CS 188: Artificial Intelligence Spring Generative vs. Discriminative. Classification: Feature Vectors. Project 4: due Friday.

Lecture 13 Segmentation and Scene Understanding Chris Choy, Ph.D. candidate Stanford Vision and Learning Lab (SVL)

Parallel Algorithms K means Clustering

CSE 7/5337: Information Retrieval and Web Search Document clustering I (IIR 16)

Flat Clustering. Slides are mostly from Hinrich Schütze. March 27, 2017

convolution shift invariant linear system Fourier Transform Aliasing and sampling scale representation edge detection corner detection

Karnaugh Maps. Ioan Despi. University of New England. September 13, 2013

Object Detection. Sanja Fidler CSC420: Intro to Image Understanding 1/ 1

Image Segmentation. Shengnan Wang

PV211: Introduction to Information Retrieval

ECE 5424: Introduction to Machine Learning

Today s lecture. Clustering and unsupervised learning. Hierarchical clustering. K-means, K-medoids, VQ

HISTOGRAMS OF ORIENTATIO N GRADIENTS

Image Processing. Bilkent University. CS554 Computer Vision Pinar Duygulu

Feature Detectors - Canny Edge Detector

Chapter One Modifying Your Fonts

Rich feature hierarchies for accurate object detection and semantic segmentation

Types of image feature and segmentation

Transcription:

Problem Set 4 Danfei Xu CS 231A March 9th, 2018 (Courtesy of last year s slides)

Outline Part 1: Facial Detection via HoG Features + SVM Classifier Part 2: Image Segmentation with K-Means and Meanshift

Part 1(a): Facial Detection via HoG Features + SVM Classifier

Main Idea We have a good facial detector (ie. classifier) which operates on HoG features of small images and we want to apply it to larger images from the real world. How do we do this? In a sliding window fashion! We slide a window over the image and - Compute the HoG features of the window, - Calculate the classifier score (SVM classifier) on those features - If the score is > the threshold we add the current window to our bounding box list.

Pictorially this looks like...

Pictorially this looks like...

Pictorially this looks like... Score = 0.3012... Don t add this to our bbox list!

Pictorally this looks like...

Pictorally this looks like...

Pictorally this looks like... Score = 0.3742... Don t add this to our bbox list!

Pictorally this looks like......

Pictorally this looks like...

Pictorally this looks like...

Pictorally this looks like... Score = 1.5489... Add this to our bbox list! x=90, y=50 25 25 Bounding Boxes 1) [90, 50, 25, 25] Scores 1) 1.5489...

Pictorally this looks like... Each red dot indicates the top-left corner of its bounding box. Bounding Boxes 1) [86, 46, 25, 25] 2) [90, 46, 25, 25] 3) [94, 46, 25, 25] 4) [86, 50, 25, 25] 5) [90, 50, 25, 25] 6) [94, 50, 25, 25] 7) [86, 54, 25, 25] 8) [90, 54, 25, 25] 9) [94, 54, 25, 25] Scores 1) 1.2348... 2) 1.2837... 3) 1.2352... 4) 1.4302... 5) 1.5489... 6) 1.4319... 7) 1.2397... 8) 1.3092... 9) 1.2345...

Part 1(b): Non-Maxima Suppression

How do we get rid of duplicate boxes? Non-maxima Suppression (NMS) - Standard post-processing step in detection methods Effectively eliminates duplicate detections in a local region Objectives - Eliminate duplicate boxes, i.e., boxes that overlap with other boxes - Don t want to eliminate boxes of high scores.

How do we get rid of duplicate boxes? How do we do it? 1. Sort the bounding boxes by their classifier score (high to low) 2. Loop through the sorted list 3. Add the bbox to a final list if the bbox DOES NOT overlap with the boxes that are already in the final list 4. Overlap criteria: center of a box is inside another box

Bounding Boxes 1) [86, 46, 25, 25] 2) [90, 46, 25, 25] 3) [94, 46, 25, 25] 4) [86, 50, 25, 25] 5) [90, 50, 25, 25] 6) [94, 50, 25, 25] 7) [86, 54, 25, 25] 8) [90, 54, 25, 25] 9) [94, 54, 25, 25] Scores 1) 1.2348... 2) 1.2837... 3) 1.2352... 4) 1.4302... 5) 1.5489... 6) 1.4319... 7) 1.2397... 8) 1.3092... 9) 1.2345... Final List

Bounding Boxes 1) [90, 50, 25, 25] 2) [94, 50, 25, 25] 3) [86, 50, 25, 25] 4) [90, 54, 25, 25] 5) [90, 46, 25, 25] 6) [86, 54, 25, 25] 7) [94, 46, 25, 25] 8) [86, 46, 25, 25] 9) [94, 54, 25, 25] Scores 1) 1.5489 2) 1.4319 3) 1.4302 4) 1.3092 5) 1.2837 6) 1.2397 7) 1.2352... 8) 1.2348... 9) 1.2345... Final List Reverse Sort

Bounding Boxes 1) [90, 50, 25, 25] 2) [94, 50, 25, 25] 3) [86, 50, 25, 25] 4) [90, 54, 25, 25] 5) [90, 46, 25, 25] 6) [86, 54, 25, 25] 7) [94, 46, 25, 25] 8) [86, 46, 25, 25] 9) [94, 54, 25, 25] Scores 1) 1.5489 2) 1.4319 3) 1.4302 4) 1.3092 5) 1.2837 6) 1.2397 7) 1.2352... 8) 1.2348... 9) 1.2345... Final List 1) [90, 50, 25, 25] Is bbox 1 within any bbox in the final list? No. Add it to the final list.

Bounding Boxes 1) [90, 50, 25, 25] 2) [94, 50, 25, 25] X 3) [86, 50, 25, 25] 4) [90, 54, 25, 25] 5) [90, 46, 25, 25] 6) [86, 54, 25, 25] 7) [94, 46, 25, 25] 8) [86, 46, 25, 25] 9) [94, 54, 25, 25] Scores 1) 1.5489 2) 1.4319 3) 1.4302 4) 1.3092 5) 1.2837 6) 1.2397 7) 1.2352... 8) 1.2348... 9) 1.2345... Final List 1) [90, 50, 25, 25] Is bbox 2 within any bbox in the final list? Yes. Don t add it to the final list. How do we calculate this? Exercise for you to decide!

Bounding Boxes 1) [90, 50, 25, 25] 2) [94, 50, 25, 25] 3) [86, 50, 25, 25] 4) [90, 54, 25, 25] 5) [90, 46, 25, 25] 6) [86, 54, 25, 25] 7) [94, 46, 25, 25] 8) [86, 46, 25, 25] 9) [94, 54, 25, 25] Scores 1) 1.5489 2) 1.4319 3) 1.4302 4) 1.3092 5) 1.2837 6) 1.2397 7) 1.2352... 8) 1.2348... 9) 1.2345... Final List 1) [90, 50, 25, 25] X X X X X X X X Is bbox 9 within any bbox in the final list? Yes. Don t add it to the final list.

Final List 1) [90, 50, 25, 25] x=90, y=50 25 25

Questions for Part 1?

Part 2(a): Image Segmentation with K-Means

Main Idea Segment an image into its semantic components, specifically using K-Means.

Hold up, what s K-Means? We haven t seen this yet! You re right, and you actually won t see K-Means in this class, hence this session. For part (a), you ll be implementing the K-Means algorithm.

K-Means Clustering Unsupervised Learning A technique to cluster data for which you have no labels. For us: A method of grouping together features that are similar in a feature space. Called K -means because there s K clusters (a hyperparameter that you choose before running the algorithm).

K-Means Clustering Algorithm: Initialization: Choose K random points to act as cluster centers Iterate until convergence (ie. the centroids don t change by much between iterations): 1. Assign points to closest center (forming K groups). 2. Reset the centers to be the mean of the points in their respective groups.

K-Means Clustering - Example Data

K-Means Clustering - Initialization

K-Means Clustering - Step 1

K-Means Clustering - Step 2

K-Means Clustering - Step 1

Repeat until Convergence... Convergence: When the centroids don t change anymore between iterations. For this assignment you can literally do: if np.all(new_centroids == centroids): break

Now we know what K-Means is, how do we use it? We now know how to cluster things in feature space, but how do we go from an image to feature space? For this assignment we ll be using [r, g, b, x, y] as the feature vector per pixel (since we want a pixel-wise segmentation). [81, 125, 19, 500, 130] [r, g, b, x, y] is a pretty standard choice when using K-Means, since you re encoding a belief in spatial locality as well as colour similarity.

Part 2(b): Image Segmentation with Meanshift

Main Idea Segment an image into its semantic components, specifically using Meanshift.

Thankfully, you have seen Meanshift in class

The way you ll implement it is slightly different... The meanshift algorithm can be done in the following steps: (1) Keep track of an array whether we have seen each pixel or not. Initialize it such that we haven't seen any.

The way you ll implement it is slightly different... (2) While there are still pixels we haven't seen do the following: - Pick a random pixel we haven't seen - Until convergence (mean is within 1% of the bandwidth of the old mean), mean shift. The output of this step will be a mean vector. - For each iteration of the meanshift, if another pixel is within the bandwidth circle (in feature space), then that pixel should also be marked as seen - If the output mean vector from the mean shift step is sufficiently close (within half a bandwidth) to another cluster center, say it's part of that cluster - If it's not sufficiently close to any other cluster center, make a new cluster

The way you ll implement it is slightly different... (3) After finding all clusters, assign every pixel to the nearest cluster in feature space.

Meanshift Segmentation (Pictorally) Clusters

Meanshift Segmentation (Pictorally) Points within the circle (and green shaded area) are seen Clusters

Meanshift Segmentation (Pictorally) Points within the circle (and green shaded area) are seen Clusters

Meanshift Segmentation (Pictorally) Points within the circle (and green shaded area) are seen Clusters (3.8, 4.0)

Meanshift Segmentation (Pictorally) Points within the circle (and green shaded area) are seen Clusters (3.8, 4.0)

Meanshift Segmentation (Pictorally) Points within the circle (and green shaded area) are seen Clusters (3.8, 4.0)

Meanshift Segmentation (Pictorally) Points within the circle (and green shaded area) are seen Clusters (3.8, 4.0) (8.0, 3.0)

Meanshift Segmentation (Pictorally) Points within the circle (and green shaded area) are seen Clusters (3.8, 4.0) (8.0, 3.0)

Meanshift Segmentation (Pictorally) Points within the circle (and green shaded area) are seen Clusters (3.8, 4.0) (8.0, 3.0) (1.5, 1.0)

Meanshift Segmentation (Pictorally) Points within the circle (and green shaded area) are seen Note, this continues until every point is seen, meaning we ll have cases where clusters overlap (shown in the next slides). Clusters (3.8, 4.0) (8.0, 3.0) (1.5, 1.0)

Meanshift Segmentation (Pictorally) Points within the circle (and green shaded area) are seen Note, this continues until every point is seen, meaning we ll have cases where clusters overlap. Clusters (3.8, 4.0) (8.0, 3.0) (1.5, 1.0)

Meanshift Segmentation (Pictorally) Points within the circle (and green shaded area) are seen Note, this continues until every point is seen, meaning we ll have cases where clusters overlap. Clusters (3.8, 4.0) (8.0, 3.0) (1.5, 1.0)

Meanshift Segmentation (Pictorally) As said in the algorithm, If the output mean vector from the meanshift step is sufficiently close (within half a bandwidth) to another cluster center, say it's part of that cluster. Clusters (3.8, 4.0) (8.0, 3.0) (1.5, 1.0) Note we don t add the red cluster to this list since it overlaps with another on the list!

Meanshift Segmentation (Pictorally) The final step is to assign every pixel to the nearest cluster in feature space. Clusters (3.8, 4.0) (8.0, 3.0) (1.5, 1.0)

Questions for Part 2?

Thanks!