EECS150 - Digital Design Lecture 15 SIFT2 + FSM. Recap and Outline

Similar documents
EECS150 - Digital Design Lecture 23 - FSMs & Counters

Parity Checker Example. EECS150 - Digital Design Lecture 9 - Finite State Machines 1. Formal Design Process. Formal Design Process

EECS Components and Design Techniques for Digital Systems. FSMs 9/11/2007

EECS150 - Digital Design Lecture 11 - Shifters & Counters. Register Summary

EECS150 - Digital Design Lecture 25 Shifters and Counters. Recap

SIFT: SCALE INVARIANT FEATURE TRANSFORM BY DAVID LOWE

Lecture 10: Synchronous Sequential Circuits Design

Generalized FSM model: Moore and Mealy

INTEREST POINTS AT DIFFERENT SCALES

EECS150 - Digital Design Lecture 18 - Counters

EECS150 - Digital Design Lecture 18 - Counters

EECS150 - Digital Design Lecture 17 - Sequential Circuits 3 (Counters)

SIFT: Scale Invariant Feature Transform

Lecture 8: Interest Point Detection. Saad J Bedros

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Review: Designing with FSM. EECS Components and Design Techniques for Digital Systems. Lec 09 Counters Outline.

Synchronous Sequential Circuit Design. Digital Computer Design

LoG Blob Finding and Scale. Scale Selection. Blobs (and scale selection) Achieving scale covariance. Blob detection in 2D. Blob detection in 2D

EECS150 - Digital Design Lecture 16 Counters. Announcements

Example: vending machine

Achieving scale covariance

Review: Designing with FSM. EECS Components and Design Techniques for Digital Systems. Lec09 Counters Outline.

Vlad Estivill-Castro (2016) Robots for People --- A project for intelligent integrated systems

Detectors part II Descriptors

Feature extraction: Corners and blobs

ENGG 1203 Tutorial _03 Laboratory 3 Build a ball counter. Lab 3. Lab 3 Gate Timing. Lab 3 Steps in designing a State Machine. Timing diagram of a DFF

Edges and Scale. Image Features. Detecting edges. Origin of Edges. Solution: smooth first. Effects of noise

Last lecture Counter design Finite state machine started vending machine example. Today Continue on the vending machine example Moore/Mealy machines

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

CS5670: Computer Vision

Blob Detection CSC 767

Corners, Blobs & Descriptors. With slides from S. Lazebnik & S. Seitz, D. Lowe, A. Efros

Finite State Machine (FSM)

Ch 7. Finite State Machines. VII - Finite State Machines Contemporary Logic Design 1

EECS150 - Digital Design Lecture 23 - FFs revisited, FIFOs, ECCs, LSFRs. Cross-coupled NOR gates

ELEC Digital Logic Circuits Fall 2014 Sequential Circuits (Chapter 6) Finite State Machines (Ch. 7-10)

Clocked Synchronous State-machine Analysis

EECS Components and Design Techniques for Digital Systems. Lec 26 CRCs, LFSRs (and a little power)

Advanced Features. Advanced Features: Topics. Jana Kosecka. Slides from: S. Thurn, D. Lowe, Forsyth and Ponce. Advanced features and feature matching

Clocked Sequential Circuits UNIT 13 ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITS. Analysis of Clocked Sequential Circuits. Signal Tracing and Timing Charts

Design of Datapath Controllers

FSM Optimization. Counter Logic Diagram Q1 Q2 Q3. Counter Implementation using RS FF 10/13/2015

Appendix B. Review of Digital Logic. Baback Izadi Division of Engineering Programs

Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1>

Harris Corner Detector

Models for representing sequential circuits

Blobs & Scale Invariance

Digital Logic and Design (Course Code: EE222) Lecture 19: Sequential Circuits Contd..

Advances in Computer Vision. Prof. Bill Freeman. Image and shape descriptors. Readings: Mikolajczyk and Schmid; Belongie et al.

EECS150 - Digital Design Lecture 21 - Design Blocks

Different encodings generate different circuits

Scale-space image processing

EECS 151/251A Fall 2018 Digital Design and Integrated Circuits. Instructor: John Wawrzynek & Nicholas Weaver. Lecture 5 EE141

EECS150 - Digital Design Lecture 26 Faults and Error Correction. Recap

Chapter 6. Synchronous Sequential Circuits

Present Next state Output state w = 0 w = 1 z A A B 0 B A C 0 C A C 1

Sequential Logic Optimization. Optimization in Context. Algorithmic Approach to State Minimization. Finite State Machine Optimization

Recap: edge detection. Source: D. Lowe, L. Fei-Fei

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BENG (HONS) ELECTRICAL & ELECTRONICS ENGINEERING EXAMINATION SEMESTER /2017

SIFT keypoint detection. D. Lowe, Distinctive image features from scale-invariant keypoints, IJCV 60 (2), pp , 2004.

ECE 448 Lecture 6. Finite State Machines. State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL Code. George Mason University

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences

Review Problem 1. should be on. door state, false if light should be on when a door is open. v Describe when the dome/interior light of the car

Synchronous Sequential Circuit Design. Dr. Ehab A. H. AL-Hialy Page 1

Lecture 12. Local Feature Detection. Matching with Invariant Features. Why extract features? Why extract features? Why extract features?

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

CSE 473/573 Computer Vision and Image Processing (CVIP)

FSM model for sequential circuits

For smaller NRE cost For faster time to market For smaller high-volume manufacturing cost For higher performance

Let s now begin to formalize our analysis of sequential machines Powerful methods for designing machines for System control Pattern recognition Etc.


Image Analysis. Feature extraction: corners and blobs

State and Finite State Machines

EECS 270 Midterm Exam 2 Fall 2009

EEE2135 Digital Logic Design

Laboratory Exercise #11 A Simple Digital Combination Lock

Sequential logic and design

Lecture 7: Finding Features (part 2/2)

3. Complete the following table of equivalent values. Use binary numbers with a sign bit and 7 bits for the value

COE 202: Digital Logic Design Sequential Circuits Part 3. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

Lecture 7: Finding Features (part 2/2)

Spiral 2-1. Datapath Components: Counters Adders Design Example: Crosswalk Controller

14.1. Unit 14. State Machine Design

EGR224 F 18 Assignment #4

CprE 281: Digital Logic

Lecture 8: Interest Point Detection. Saad J Bedros

State Graphs FSMs. Page 1

Sequential Synchronous Circuit Analysis

Total time is: 1 setup, 2 AND, 3 XOR, 1 delay = (1*1) + (2*2) + (3*3) + (1*1) = 15ns

Extract useful building blocks: blobs. the same image like for the corners

MACHINE COMPUTING. the limitations

CS 3710: Visual Recognition Describing Images with Features. Adriana Kovashka Department of Computer Science January 8, 2015

Digital Logic Design - Chapter 5

The Design Procedure. Output Equation Determination - Derive output equations from the state table

Lecture 8: Sequential Networks and Finite State Machines

EECS150 - Digital Design Lecture 22 - Arithmetic Blocks, Part 1

ECE380 Digital Logic. Synchronous sequential circuits

Digital Control of Electric Drives

Digital Design. Sequential Logic

Transcription:

EECS150 - Digital Design Lecture 15 SIFT2 + FSM Oct. 15, 2013 Prof. Ronald Fearing Electrical Engineering and Computer Sciences University of California, Berkeley (slides courtesy of Prof. John Wawrzynek) http://www-inst.eecs.berkeley.edu/~cs150 Fall 2013 EECS150 - Lec15-sift2 Page 1 Recap and Outline Ready/Valid Handshaking async FIFO SIFT Algorithm, part 1 Outline for Today SIFT Algorithm, conclusion FSM implementation FSM Moore vs Mealy FSM State Assignment 2 1

Feature Tracking Project USB WebCam SRAM Host PC VGA Interface Frame Buffer DVI Interface Feature Detector P.L.B. serial interface micro Blaze CPU F.S.L. Xilinx FPGA DDRAM (program+ data memory) EECS150 - Lec12-video 3 review from lec14 The SIFT (Scale Invariant Feature Transform) Detector and Descriptor developed by David Lowe University of British Columbia US patent Lowe, David G. (2004). Distinctive image features from scaleinvariant key points. International Journal of Computer Vision 60(2): 91-110. courses.cs.washington.edu/courses/cse576/11sp/.../sift_white2011.ppt http://demo.ipol.im/demo/82/wait?key=ece94e2aee6f0d1 CCD5265DB4E69D224&show=antmy_detect&action=cust_sift _matching 4 2

review from lec14 Idea of SIFT Image content is transformed into local feature coordinates that are invariant to translation, rotation, scale, and other imaging parameters SIFT Features 5 review from lec14 Lowe s Pyramid Scheme s+2 filters s+1 =2 (s+1)/s 0.. i =2 3/s 0 2 =2 2/s 0 1 =2 1/s 0 0 s+3 images including original Lowe, Fig.1 The parameter s determines the number of images per octave. s+1 difference images 6 3

review from lec14 Gaussian Smoothing Calculation WB size of window? FIR coeff separable assumption WB Example: ``A Parallel Hardware Architecture for Scale and Rotation Invariant Feature Detection, Bonato, et al., IEEE TRANS. ON CIRCUITS AND SYSTEMS FOR VIDEO TECHNOLOGY, VOL. 18, NO. 12, DECEMBER 2008 7 review from lec14 Gaussian Smoothing Example: ``A Parallel Hardware Architecture for Scale and Rotation Invariant Feature Detection, Bonato, et al., IEEE Trans. on Circuits and Systems for Video Tech., vol. 18, no. 12, Dec. 2008. 8 4

Resample Blur Subtract 11/13/2013 2. Key point localization Detect maxima and minima of difference-of- Gaussian in scale space s+2 difference images. top and bottom ignored. s planes searched. Each point is compared to its 8 neighbors in the current image and 9 neighbors each in the scales above and below total comparisons? For each max or min found, output is the location and the scale. Lowe, Fig.2 9 Keypoint Detection FIFO Micro- Blaze Fig. 8. : ``A Parallel Hardware Architecture for Scale and Rotation Invariant Feature Detection, Bonato, et al., IEEE Trans. on Circuits and Systems for Video Tech., vol. 18, no. 12, Dec. 2008. 10 5

Overall Procedure at a High Level 1. Scale-space extrema detection Search over multiple scales and image locations. 2. Keypoint localization Fit a model to determine location and scale. Select keypoints based on a measure of stability. 3. Orientation assignment Compute best orientation(s) for each keypoint region. HW SW 4. Keypoint description Use local image gradients at selected scale and rotation to describe each keypoint region. 11 Scale-space extrema detection: experimental results over 32 images that were synthetically transformed and noise added. % detected average # detected % correctly matched average # matched Stability Sampling in scale for efficiency How many scales should be used per octave? S=? More scales evaluated, more keypoints found S < 3, stable keypoints increased too S > 3, stable keypoints decreased S = 3, maximum stable keypoints found Expense Lowe, Fig.3 12 6

Keypoint localization Once a keypoint candidate is found, perform a detailed fit to nearby data to determine location, scale, and ratio of principal curvatures In initial work keypoints were found at location and scale of a central sample point. In newer work, they fit a 3D quadratic function to improve interpolation accuracy. The Hessian matrix was used to eliminate edge responses. 13 M Corners as distinctive interest points 1 0 T X X 0 2 The eigenvalues of M reveal the amount of intensity change in the two principal orthogonal gradient directions in the window. edge : 1 >> 2 2 >> 1 corner : 1 and 2 are large, 1 ~ 2 ; flat region 1 and 2 are small; One way to score the cornerness: see Lowe 04 paper for details slide credit: CS 143, Brown Univ James Hays, 2011 7

3. Orientation assignment Create histogram of local gradient directions at selected scale Assign canonical orientation at peak of smoothed histogram Each key specifies stable 2D coordinates (x, y, scale,orientation) If 2 major orientations, use both. 15 Keypoint localization with orientation 233x189 832 initial keypoints 729 keypoints after gradient threshold 536 keypoints after ratio threshold Lowe, Fig.5 16 8

4. Keypoint Descriptors At this point, each keypoint has location scale orientation Next is to compute a descriptor for the local image region about each keypoint that is highly distinctive as invariant as possible to variations such as changes in viewpoint and illumination Normalization Rotate the window to standard orientation Scale the window size based on the scale at which the point was found. 17 Lowe s Keypoint Descriptor (shown with 2 X 2 descriptors over 8 X 8) gradient magnitude and orientation at each point weighted by a Gaussian orientation histograms: sum of gradient magnitude at each direction In experiments, 4x4 arrays of 8 bin histogram is used, a total of 128 features for one keypoint WB 18 9

Biological Motivation Mimic complex cells in primary visual cortex Hubel & Wiesel found that cells are sensitive to orientation of edges, but insensitive to their position This justifies spatial pooling of edge responses [ Eye, Brain and Vision Hubel and Wiesel 1988 ] 19 Lowe s Keypoint Descriptor use the normalized region about the keypoint compute gradient magnitude and orientation at each point in the region weight them by a Gaussian window overlaid on the circle create an orientation histogram over the 4 X 4 subregions of the window 4 X 4 descriptors over 16 X 16 sample array were used in practice. 4 X 4 times 8 directions gives a vector of 128 values. 20 10

Automatic mosaicing http://www.cs.ubc.ca/~mbrown/autostitch/autostitch.html Uses for SIFT Feature points are used also for: Image alignment (homography, fundamental matrix) 3D reconstruction (e.g. Photo Tourism) Motion tracking Object recognition Indexing and database retrieval Robot navigation many others [ Photo Tourism: Snavely et al. SIGGRAPH 2006 ] 22 11

FSM Implementation Flip-flops form state register number of states 2 number of flip-flops CL (combinational logic) calculates next state and output Remember: The FSM follows exactly one edge per cycle. 23 FSM Formal Design Process Review of Design Steps: 1. Specify circuit function (English) 1.1 choose Moore or Mealy 2. Draw state transition diagram 3. Write down symbolic state transition table (case stmt) 4. Assign states Verilog 5. Derive logic equations [output decoder, next state decoder] 6. Derive circuit diagram Register to hold state Combinational Logic for Next State and Outputs 24 12

State Encoding In general: # of possible FSM state = 2 # of Flip-flops Example: state1 = 01, state2 = 11, state3 = 10, state4 = 00 However, often more than log 2 (# of states) FFs are used, to simplify logic at the cost of more FFs. Extreme example is one-hot state encoding. 25 State Encoding One-hot encoding of states. One FF per state. Why one-hot encoding? Simple design procedure. Circuit matches state transition diagram (example next page). Often can lead to simpler and faster next state and output logic. Why not do this? Can be costly in terms of Flip-flops for FSMs with large number of states. FPGA costs? Hint NSD WB FPGAs are Flip-flop rich, therefore one-hot state machine encoding is often a good approach. 26 13

One-hot encoded combination lock 27 General FSM form: FSM Implementation Notes All examples so far generate output based only on the present state: Commonly named Moore Machine (If output functions include both present state and input then called a Mealy Machine) 28 14

Finite State Machines Example: Edge Detector Bit are received one at a time (one per cycle), such as: 000111010 time CLK Design a circuit that asserts IN its output for one cycle when the input bit stream changes from 0 to 1. FSM OUT Try two different solutions. 29 State Transition Diagram Solution A ZERO CHANGE ONE IN PS NS OUT 0 00 00 0 1 00 01 0 0 01 00 1 1 01 11 1 0 11 00 0 1 11 11 0 30 15

Solution B Output depends not only on PS but also on input, IN Let ZERO=0, ONE=1 IN PS NS OUT 0 0 0 0 0 1 0 0 1 0 1 1 1 1 1 0 NS = IN, OUT = IN PS Notation: Input condition/output What s the intuition about this solution? 31 Edge detector timing diagrams Solution A: output follows the clock Solution B: output changes with input rising edge and is asynchronous wrt the clock. 32 16

FSM Comparison Solution A Moore Machine output function only of PS maybe more states (why?) synchronous outputs no glitches one cycle delay full cycle of stable output Solution B Mealy Machine output function of both PS & input maybe fewer states asynchronous outputs if input glitches, so does output output immediately available output may not be stable long enough to be useful (below): If output of Mealy FSM goes through combinational logic before being registered, the CL might delay the signal and it could be missed by the clock edge. 33 FSM Recap Moore Machine Mealy Machine Both machine types allow one-hot implementations. 34 17

Final Notes on Moore versus Mealy 1. A given state machine could have both Moore and Mealy style outputs. Nothing wrong with this, but you need to be aware of the timing differences between the two types. 2. The output timing behavior of the Moore machine can be achieved in a Mealy machine by registering the Mealy output values: 35 35 General FSM Design Process with Verilog Implementation Design Steps: 1. Specify circuit function (English) 2. Draw state transition diagram 3. Write down symbolic state transition table 4. Assign encodings (bit patterns) to symbolic states 5. Code as Verilog behavioral description Use parameters to represent encoded states. Use separate always blocks for register assignment and CL logic block. Use case for CL block. Within each case section assign all outputs and next state value based on inputs. Note: For Moore style machine make outputs dependent only on state not dependent on inputs. 36 18

Mealy Machine FSMs in Verilog Moore Machine always @(posedge clk) if (rst) ps <= ZERO; else ps <= ns; always @(ps in) case (ps) ZERO: if (in) begin out = 1 b1; ns = ONE; end else begin out = 1 b0; ns = ZERO; end ONE: if (in) begin out = 1 b0; ns = ONE; end else begin out = 1 b0; ns = ZERO; end default: begin out = 1 bx; ns = default; end always @(posedge clk) if (rst) ps <= ZERO; else ps <= ns; always @(ps in) case (ps) ZERO: begin out = 1 b0; if (in) ns = CHANGE; else ns = ZERO; end CHANGE: begin out = 1 b1; if (in) ns = ONE; else ns = ZERO; end ONE: begin out = 1 b0; if (in) ns = ONE; else ns = ZERO; default: begin out = 1 bx; ns = default; end 37 Conclusions SIFT details State assignment Moore Machine Mealy Machine 38 19

Eliminating the Edge Response see Lowe 04 paper for details if interested Reject flats: < 0.03 Reject edges: Let be the eigenvalue with larger magnitude and the smaller. Let r = /. So = r r < 10 (r+1) 2 /r is at a min when the 2 eigenvalues are equal. 39 Parity Checker Example A string of bits has even parity if the number of 1 s in the string is even. Design a circuit that accepts a bit-serial stream of bits and outputs a 0 if the parity thus far is even and outputs a 1 if odd: Next we take this example through the formal design process. But first, can you guess a circuit that performs this function? 40 20

Formal Design Process State Transition Diagram circuit is in one of two states. transition on each cycle with each new input, over exactly one arc (edge). Output depends on which state the circuit is in. 41 Formal Design Process State Transition Table: present state next OUT IN state EVEN 0 0 EVEN EVEN 0 1 ODD ODD 1 0 ODD ODD 1 1 EVEN Invent a code to represent states: Let 0 = EVEN state, 1 = ODD state present state (ps) OUT IN next state (ns) 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 0 Derive logic equations from table (how?): OUT = PS NS = PS xor IN 42 21

Formal Design Process Logic equations from table: OUT = PS NS = PS xor IN Circuit Diagram: XOR gate for NS calculation DFF to hold present state no logic needed for output in this example. ps ns 43 22