CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof....

62
CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows, Srinivasan, & Chahl 2003; Conradt 2009)

Transcript of CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof....

Page 1: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

CSCI 252: Neural Networks Prof. Levy

“Architecture” #4: Neuromorphic Vision Chips

(Koch & Mathur 1996;Barrows, Srinivasan, & Chahl 2003;

Conradt 2009)

Page 2: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Topics

● Basic Circuit Concepts– Ohm’s Law– Digital vs. Analog– Common Circuit Components

● Image Processing– Convolution– Optical flow

Page 3: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Part I: Basic Circuit Concepts

Page 4: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Understanding Signals: Ohm's Law

• Electricity is like water going through a hose:

• Pressure : Voltage

• Constriction: Resistance

• Flow: Current

• I = V / R : Current = Voltage / Resistance

• Voltage: Volts; Current: Amp(ere)s;

Resistance: Ohms (Ω)

Page 5: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Ohm's Law Example

Question: A 120 Volt lamp is powering a lightbulb that has a resistance of 240 Ohms. How much current is passing through the lightbulb?

Answer: I = V / R = 120 V / 240 Ω = 0.5 A

Page 6: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Ohm's Law• Very high voltage, very low current

(10000 V * .0001 A = 1 Wat)

• Low voltage, low current

(3.7V * 1A = 3.7 Wats)

• High voltage, high current

(1000V * 1000A =

1000000 Wats!!!)

Page 7: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Analog vs. Digital

Analog

Continuous

Measuring

Ruler

Real numbers

Smooth

“Natural”

Digital

Discrete

Counting

Abacus

Integers

Step-like

Arbitrary

House Mountain House Mountain

0,2,4,3,3,3,4,1,0

Page 8: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Analog vs. Digital Circuits

● Electricity is inherently analog: we measure voltage, current, resistance; we don’t “count” it.

● Electronic components can be assembled to make circuits.

● When engineers say “digital circuit”, they mean “electronic circuit that approximates discrete voltages”

● Both digital and analog circuits involve three major components

● Let’s look at each in turn ….

Page 9: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Resistor: Reduce current or voltage

• Recall Ohm’s Law: I = V / R

• So more resistance means less current

• We can also use two resistors to build a voltage divider:

V out=V in

R2

R1+R2

Page 10: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Capacitor: Slow down fluctuations

• Like a fast-charging/draining batery

• Can be used to “damp down” rapid changes in voltage (noise reduction):

Page 11: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Transistor: Use one signal tocontrol another

• Analog usage: amplifier

• Digital usage: on/off switch for Boolean logic gates

• The basis of all modern digital computers

• Integrated circuit shrinks billions of these down to a tiny die (chip) you can conceal under your finger

Page 12: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Analog vs. Digital Example: SOM Update

# Adjust weights of winner neighbors

for p in self._neighbors(winner, d):

self.u[p] += alpha*(e-self.u[p])

Page 13: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Part II: Image Convolution

Page 14: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,
Page 15: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

http://wernerstudio.typepad.com/.a/6a00d83549adb153ef01053629c0cf970c-500wi

Page 16: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Convolution:

Convolution is a mathematical way of combining two signals to form a third signal. It is the single most important technique in Digital Signal Processing.*

* http://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch6.pdf

Page 17: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Convolution: “The Dot Product on Steroids”

Let's look dot product in terms of vectors (arrays):

∑i=1

n

x i w i

x1

x2

x3

xn

...

w1

w2

w3

wn

...* * * *

+

Page 18: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Convolution: “The Dot Product on Steroids”

To get convolution, we “slide” w across x:

x1

x2

x3

xn

...

w1

w2

w3

wn

...* * * *

+y

1

x1

x2

x3

xn

...

w2

w3

w4

wn+1

...* * * *

+y

2

x1

x2

x3

xn

...

w3

w4

w5

wn+2

...* * * *

+y

3

Do you see a problem?

Page 19: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Convolution: “The Dot Product on Steroids”

Usual definition of convolution assumes infinite vectors:

yn= ∑k=−∞

xn−k w k

x3

x2

x1

...

w-1

w0

w1

...* * *

+y

2

...

...x2

x1

x0

...

w-1

w0

w1

...* * *

+y

1

...

... x4

x3

x2

...

w-1

w0

w1

...* * *

+y

3

...

...

Of course, this is unrealistic, so ...

Page 20: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Convolution: “The Dot Product on Steroids”

We treat w as a finite convolution kernel, and switch to non-negative indices: e.g.,:

yn=∑k=0

2

xn−k w k

x3

x2

x1

...

w0

w1

w2

* * *

+y

3

...x2

x1

x0

...

w0

w1

w2

* * *

+y

2

... x4

x3

x2

...

w0

w1

w2

* * *

+y

4

...

Do you notice another (small) problem?

Page 21: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

Page 22: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

Page 23: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

Page 24: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

Page 25: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

Page 26: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y c c

Page 27: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y c c c

Page 28: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y c c c c

Page 29: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y c c c c c

Page 30: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Convolution: What's It Goodfer?

• Many useful operations can be expressed as a convolution

• E.g., smoothing, a.ka. moving average, a.k.a. low-pass filtering ….

Page 31: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

.33 .33.33

1 1 1 1 10 0 0 0 0

Page 32: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

.33 .33.33

1 1 1 1 10 0 0 0 0

.66

Page 33: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

.33 .33.33

1 1 1 1 10 0 0 0 0

.66 .33

Page 34: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

.33 .33.33

1 1 1 1 10 0 0 0 0

.66 .33 .66

Page 35: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

.33 .33.33

1 1 1 1 10 0 0 0 0

.66 .33 .66 .33

Page 36: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

.33 .33.33

1 1 1 1 10 0 0 0 0

.66 .33 .66 .33 .66

Page 37: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

.33 .33.33

1 1 1 1 10 0 0 0 0

.66 .33 .66 .33 .66 .33

Page 38: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

.33 .33.33

1 1 1 1 10 0 0 0 0

.66 .33 .66 .33 .66 .33 .66

Page 39: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

.33 .33.33

1 1 1 1 10 0 0 0 0

.66 .33 .66 .33 .66 .33 .66 .33

Page 40: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,
Page 41: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Convolution: What's It Goodfer?

• Many useful operations can be expressed as a convolution

• E.g., edge detection, a.k.a. high-pass filtering

Page 42: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

-1 -12

1 1 1 1 10 0 0 0 0

Page 43: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

-1 -12

1 1 1 1 10 0 0 0 0

-2

Page 44: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

-1 -12

1 1 1 1 10 0 0 0 0

-2 2

Page 45: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

-1 -12

1 1 1 1 10 0 0 0 0

-2 2 -2

Page 46: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

-1 -12

1 1 1 1 10 0 0 0 0

-2 2 -2 2

Page 47: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

-1 -12

1 1 1 1 10 0 0 0 0

-2 2 -2 2 -2

Page 48: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

-1 -12

1 1 1 1 10 0 0 0 0

-2 2 -2 2 -2 2

Page 49: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

-1 -12

1 1 1 1 10 0 0 0 0

-2 2 -2 2 -2 2 -2

Page 50: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

w

x

y

-1 -12

1 1 1 1 10 0 0 0 0

-2 2 -2 2 -2 2 -2 2

Page 51: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,
Page 52: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Two-Dimensional Convolution

w

x

Page 53: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Two-Dimensional Convolution

x y

Page 54: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Two-Dimensional Convolution

x y

Page 55: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Two-Dimensional Convolution

x y

Page 56: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Two-Dimensional Convolution

x y

Page 57: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Common Kernels for Image Manipulation

https://en.wikipedia.org/wiki/Kernel_(image_processing)

Page 58: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Common Kernels for Image Manipulation

https://en.wikipedia.org/wiki/Kernel_(image_processing)

Page 59: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Homebrew Convolution with NumPy

Page 60: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Optical Flow

• A basic question: how do we (and other sighted creatures) move around without bumping into things?

• Ecological insight (J.J. Gibson): It can’t involve a complicated computational algorithm in the brain* As much as possible, an animal must be have its senses / nervous system tightly coupled with its environment.

* But, because of the lack of analog optical-flow circuits, nearly everyone still does it with an algorithm / package (OpenCV)!

Page 61: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

Hardware Progress

PX4Flow2012$150Inaccurate / difficult to use

PWM39012018$36Accurate / easy to use

Page 62: CSCI 252: Neural Networks Prof. Levy “Architecture” #4 ... · CSCI 252: Neural Networks Prof. Levy “Architecture” #4: Neuromorphic Vision Chips (Koch & Mathur 1996; Barrows,

The Cutting Edge

https://studywolf.wordpress.com/tag/spiking-camera/