You are on page 1of 60

A Crash Course on

Artificial Intelligence

here!
Carry On

Not taller
Can Follow You than human
at different speeds

Not heavier
than human

Stairs and floors

Can follow a human


one step behind

Honda Development Center. Asimo project initial sketch


Two leg walking

(The Lecture Notes)


J. Berengueres
©

A Crash Course on Artificial Intelligence

Editor
Jose Berengueres

Edition
First Edition. August 24th, 2014.

Text Copyright
© Jose Berengueres 2014. All Rights Reserved.

i
Video, Audio & Artwork Copyright
Artwork appearing in this work is subject to their
corresponding original Copyright or Creative
Commons License. Except where otherwise noted
a Creative Commons Attribution 3.0 License
applies.

Limit of Liability
The editor makes no representations or warranties
concerning the accuracy or exhaustivity of the
contents and theories hereby presented and
particularly disclaim any implied warranties
regarding merchantability or fitness for a
particular use including but not limited to
educational, industrial and academic application.
Neither the editor or the authors are liable for any

Ai
loss or profit or any commercial damages
including but not limited to incidental,
consequential or other damages.

Support
This work was supported by:
UAE University
ii
1 | Introduction to AI (in this chapter)
What makes something intelligent?
Bielefeld University, Germany.
1. Saliency - the ability to focus on the
Psychology of Human Robot interaction
important facts
2. Speed - Lack of speed has never been
associated with intelligence. Sun Tzu
3. Pattern recognition - the ability to recognize
situations and objects allows you to use past
experience to react and predict or adapt to
current and future situations... in summary, AI
is like having a cheat sheet to take advantage
of past events.

AI Formula: AI = 1 + 2 + 3
AI as an emerging property
AI as an emerging property of simple components, a
EC3 commodity. Examples,
1. Ant colony algorithm
2. Viola Jones face recognition
s
A I i 3. Norvig’s SpellChecker
i in
t h e here
y, are
o da o u to
T . y n t
.. wa To reinforce the ideas
all u p
sm
e y o
l Ca
s l
e cau sma 1.Andrew Ng on Brain inspiration
b he ap.
g e t C 2.Maja Rudinac on saliency on developmental
n big
cha a
o
int psychology

Bielefeld CITEC JUL 2014


1 | Introduction to AI - Are Ants Smart?

The ants + the


pheromone evaporation
turn random guesses into a
superb optimization algorithm
necessary for survival of the
fittest colony
http://www.youtube.com/watch?v=SMc6UR5blS0 ------

ACO or Ant Colony


Optimization was discovered
by Marco Dorigo in the 90’s
Wow! What is
------
your IQ?
(but they never managed to sell it
------
commercially, too much
tweaking required)

4
1 | Introduction to AI - Viola Jones

http://vimeo.com/12774628

Wait! Where did


I see this strategy http://www.youtube.com/watch?v=AY4ajbu_G3k
before!
------

ut
abo
s
r k s i le
t wo simp
tha tin
g
ck
is
AI g a tr i
gre he rge
Ag s”. T la
e
a ture re gat s
“fe a gg at ure
The more features the better as long they are better than 0.0001% of o fe
w t of
ho er
100% random. (Theorem, see Berengueres & Efimov on Etihad case) mb
nu
5
1 | Introduction to AI - Spell This!

How to Write a Spelling Corrector


(Abridged from http://norvig.com/spell-correct.html by Peter
Norvig)
“In the past week, two friends (Dean and Bill) independently
told me they were amazed at how Google does spelling I don’t know so
correction so well and quickly. Type in a search like [speling] lets minimize the
and Google comes back in 0.1 seconds or so with Did you errors
mean: spelling. (Yahoo and Microsoft are similar.) What
surprised me is that I thought Dean and Bill, being highly
accomplished engineers and mathematicians, would have
good intuitions about statistical language processing
CANDIDATE FREQUENCY P. ERROR
problems such as spelling correction. But they didn't, and
come to think of it, there's no reason they should: it was my
HELLO 23423 LOW
expectations that were faulty, not their knowledge.
HELO Not in Dict HIGH
I figured they and many others could benefit from an
explanation. The full details of an industrial-strength spell PELO 4 HIGH
corrector are quite complex (you con read a little about it here
or here). What I wanted to do here is to develop, in less than a
page of code, a toy spelling corrector that achieves 80 or HELO
90% accuracy at a processing speed of at least 10 ------
words per second.”
PELO

HELLO
Who is
------
right?

6
1 | Introduction to AI - Spell This!

(Abridged from http://norvig.com/spell-correct.html by Peter Norvig)

So here, in 21 lines of Python 2.5 code, is the complete spelling corrector:

Import re, collections

def words(text): return re.findall('[a-z]+', text.lower())

def train(features):
    model = collections.defaultdict(lambda: 1)
    for f in features:
        model[f] += 1
    return model

NWORDS = train(words(file('big.txt').read())) Oh My
alphabet = 'abcdefghijklmnopqrstuvwxyz' Pythons!
def edits1(word):
   splits     = [(word[:i], word[i:]) for i in range(len(word) + 1)]
   deletes    = [a + b[1:] for a, b in splits if b]
   transposes = [a + b[1] + b[0] + b[2:] for a, b in splits if len(b)>1]
   replaces   = [a + c + b[1:] for a, b in splits for c in alphabet if b]
   inserts    = [a + c + b     for a, b in splits for c in alphabet]
   return set(deletes + transposes + replaces + inserts)

def known_edits2(word):
    return set(e2 for e1 in edits1(word) for e2 in edits1(e1) if e2 in NWORDS)

def known(words): return set(w for w in words if w in NWORDS)

def correct(word):
    candidates = known([word]) or known(edits1(word)) or known_edits2(word) or [word]
    return max(candidates, key=NWORDS.get)
The code defines the function correct, which takes a word as input and returns a likely correction of that word. For example:

>>>

import re, collections


>>> correct('speling') Genius!
'spelling'
>>> correct('korrecter')
'corrector'

7
1 | Introduction to AI - Spell This!

That book is a
good reference, but is a
pedagogic of a fail as big
as dusty dictionaries get.

8
1 | Introduction to AI - The Case of Machine Translation

Machine Translation Google


(Abridged from http://www.foreignaffairs.com/articles/139104/ “Then Google barged in. Instead of using a relatively small
kenneth-neil-cukier-and-viktor-mayer-schoenberger/the-rise- number of high-quality translations, the search giant
of-big-data by Kenneth Neil Cukier and Viktor Mayer- harnessed more data, but from the less orderly Internet --
Schoenberger FROM FP MAY/JUNE 2013 ISSUE ) “data in the wild,” so to speak. Google inhaled translations
from corporate websites, documents in every language from
the European Union, even translations from its giant book-
“Consider language translation. It might seem obvious that
scanning project. Instead of millions of pages of texts, Google
computers would translate well, since they can store much
analyzed billions. The result is that its translations are quite
information and retrieve it quickly.
good -- better than IBM’s were--and cover 65
languages. Large amounts of messy data trumped
Linguistics models small amounts of cleaner data.”
But if one were to simply substitute words from
a French-English dictionary, the translation Reflection
would be atrocious. Language is complex. A
In later chapters we will see how Big
breakthrough came in the 1990s, when IBM
Data is connected to this ideas. This Hi, I am
delved into statistical machine translation. It fed
case ilustrates the debate of wether Keneth
Canadian parliamentary transcripts in both
modeling the world vs. taking the sensory ----
French and English into a computer and programmed it to
input as model is better. By now it shoudl be
infer which word in one language is the best alternative for
clear what works. In
another. This process changed the task of translation into a
the case of humans
giant problem of probability and math. But after this initial
another factor plays
improvement, progress stalled.”
i n t o p l a y. . . t h e
emotion predictor.

9
1 | Introduction to AI - Monte Carlo Tree Search

Game positions: 1038



The Games Computer strength: BEST
Computers Play PROFESSIONAL
In two-player games without
chance or hidden
information, AIs have
achieved remarkable
success. However, 19-by-19
CHECKERS SHOGI (JAPANESE
Go remains a challenge. Game positions: 1020
 CHESS)
Abridged from: http:// Computer strength: PERFECT Game positions: 1070

spectrum.ieee.org/robotics/artificial-intelligence/ais-
Computer strength: STRONG
have-mastered-chess-will-go-be-next CHESS PROFESSIONAL
Game positions: 1045

Computer strength:
SUPERHUMAN

OTHELLO
Game positions: 1028

Computer strength:
TIC-TAC-TOE SUPERHUMAN 19-BY-19 GO
Game positions: 104
 Game positions: 10172

Computer strength: PERFECT Computer strength: STRONG
AMATEUR

XIANGQI (CHINESE
OWARE CHESS)
Game positions: 1048

Game positions: 1011

Computer strength: BEST
Computer strength: PERFECT
9-BY-9 GO PROFESSIONAL

10
1 | Introduction to AI - Monte Carlo Tree Search

This reminds me
of Searle’s Chinese Box

to p lay g o
e d tr ying
We sto
p p
a n d s tarte d
t e r s’s rules
w ith m
a s
w it h back
M o n te Carlo
using r u n in g ... a
t io n an d p
propa ga
e a p p roach”
b r u te forc )
m eh o w a llio n fun d
so w vs. M
e d
also ED Sha
(See

Medallion Fund
That’s what I call
made millions using
intelligence free AI
the same strategy to bet
on Wall Street
-----
MMTG

11
1 | Introduction to AI - Monte Carlo Tree Search

“In these four simulations of a simple Monte Carlo tree search,


the program, playing as black, evaluates the winning potential
of possible moves. Starting from a position to be evaluated
(the leaf node), the program plays a random sequence of legal
moves, playing for both black and white. It plays to the end of
the game and then determines if the result is a win (1) or a loss
(0). Then it discards all the information about that move
sequence except for the result, which it uses to update the
winning ratio for the leaf node and the nodes that came before
it, back to the root of the game tree.
Algorithm
1. Tree descent: From the existing board position (the
root node of the search tree), select a candidate move (a leaf
node) for evaluation. At the very beginning of the search, the
leaf node is directly connected to the root. Later on, as the
search deepens, the program follows a long path of branches
to reach the leaf node to be evaluated.
2. Simulation: From the selected leaf node, choose a
random sequence of alternating moves until the end of the
game is reached.
3. Evaluation and back propagation: Determine
whether the simulation ends in a win or loss. Use that result to
update the statistics for each node on the path from the leaf
back to the root. Discard the simulation sequence from
memory—only the result matters.

12
1 | Introduction to AI - Monte Carlo Tree Search

4. Tree expansion: Grow the game tree by adding an


extra leaf node to it.

To learn more about MCTS --> http://mcts.ai/index.htm

To learn more about how to play go:


http://www.youtube.com/watch?v=nuWuXj2V6Rk Beginner
http://www.youtube.com/watch?v=3O-lwNzN0G0 Advanced

13
1 | Introduction to AI - Practice Time

ACO Exercise

http://www.youtube.com/watch?v=SMc6UR5blS0

Now that you


realized that making a
powerful spell checker is not such
a big deal... can you program an
ACO to do something useful? and
display it visually in real time?
----
Time : 5h

14
1 | Introduction to AI - Philosophical concepts

(Abridged from the book by Henry Brighton and Howard 5. Alien-AI = AI that works and is not similar to human AI
Selina, Introducing AI) 6. Trans humanism and Immortality

re se a rchers
e su r vey AI they
In on t disc ip lin e
d w ha
ske
were a clo se st to
e
feel th
PBS Documentary http://www.youtube.com/watch?v=53K1dMyslJg
n
m o st commo
e
o phy was th
(Philo s )
answer 7. AI and Psychology. (see chapter 3.1)
8. Cognitive psychology = Studying psychology by means of
a computational theory of mind. To explain the human
cognitive function in terms of information processing terms.
9. Intelligence = the computational part of achieving goals in
AI Goals
the world.
1. Understand the man as a machine
10. Is Elsie intelligent? (are students roaming around a
2. Understand anything (not only humans ) that performs campus and going to the cafeteria when they are hungry
actions. We refer to this as agents. Therefore agents can intelligent? :) )
be human or non-human or a combination
11. Chomsky: the capacity of language seems to be due that
3. Strong AI = to build a Doraemon we have an part in the brain dedicated to it (like the organ
4. Weak AI = to understand things by building robot of the heart). Otherwise how can we explain that every kid
prototypes learns to speak just by listening to its parents speaking?

15
1 | Introduction to AI - Philosophical concepts

that is not plausible. Therefore, the organ of language must 16.The Loebner prize is $100,000 for the first place
exist int he brain. 17. Searle’s Chinese room. I can go inside a room with all the
12. Turing Machine. Model for all machines via states and Chinese books in the world and someone can slide Chinese
inputs. messages through the slide. An I might learn what to reply
even though I do not know any Chinese symbols. And pass
the touring test. Would that be regarded as intelligence?
Searle’s Chinese room passes the PSS hypotheses
e pr iva tion regarding manipulation of symbols.
yd
Sensor IQ. 18.But Searle himself + the books = understand Chinese?
ses th e
decrea which means: Can the whole be more that sum of its parts?
19. Complexity Theory. Self-organization occurs when high-
d
ho is deprive level properties emerge from interaction of simple
y w
A bab few components. ACO is an example.
s in a
o uc h die 20. The Brain process Experiment and the mental only realm.
of t
days Replace each neuron by an artificial one. What would
happen?
21. Penrose conjectures that consciousness requires of
quantum effects, that are not present in silicon based chips.
13. Functionalist separation of mind from brain (Software from ie. non computable processes. Microtubes.
hardware)
22. Understanding, Consciousness and Thought. Intentionality
14. Physical Symbol Systems Hypothesis 1976 = Cognition and aboutness. Example: Mental states have aboutness on
requires the manipulation of symbolic representations beliefs and desires and that requires a conscious mind.
15. Touring test. Can machines think is a ill-defined question. Conciouss is ALWAYS about something,
So touring replaced it by... Can u fool a human in to 23. Perception - cognition - action
believing you are as smart as a human? Noam Chomsky 24. Cognitive Modelling. Modelling is not understanding.
says: Thats like asking if submarines can swim.

16
1 | Introduction to AI - Philosophical concepts

25. Module based conginition could explain optical ilussions 33. Dreyfus says that AI is misguided if it thinks disembodied
26. Game playing AI represent the game internaly with trees intelligence is possible.
34. IF Dreyfus is correct then agents must be used as
engaged in everyday world not as disengaged.
ho le ave
tr a de rs w 35.Frist principle of embodiment:
Most t o start
Sach s 1. The constraints of having a body are important for the AI
m an
Gold p e n dent function. Elsie recharging station.
n in de
ir o w
the r p e rfor m 2. “The world is the best model ;) ” - Rodney Brooks
d un d e
fu n
he dge g solo
3. Bottom-to -top construction
y in
when fl 4. Brooks on conventional robotics
1. Based on sense plan do
5. Brooks new AI
1. Based on behaviors - Genghis - Behavior by design
36. Evolution without biology
27. Machines does not have common sesne? Is ti because
37. Only when interaction between humans and their
lack of background info?
environment are more well understood w ill AI begin to
28.Sense model plan act solve the right problem
29. Conectionists. ANN
30. Symbol grounding and menaing
31. New AI Rodney Brooks. A machine does not think. What
hinks is the machine + his environment as a system
32. Frogs do not have planing modules. It's directed by the
eye perception. Reflex.

17
1 | Introduction to AI - Philosophical concepts

Ants + pheromone + food to


search for = Intelligence. Now I
get it. Before I was looking at the
ant + pheromone only. It is the
whole system we have to
consider.

------

I seen 37
before!

18
2 | Robotics

Maja Rudinac. ENxJ. Gymnastics &


Robotics. CEO of Lerovis. TUDelft

Baby inspired Artificial


Intelligence (Saliency)

“I studied how
babies make sense of the Recorded at Building 34 TU Delft on
August 21st, 2014
world to build a low cost
robot”
------
Maja Rudinac
Key Point

“Intelligence is the capacity to


focus on the important things, to
filter - babies are good at this since
the fourth month”

h t Plan
p ter Flig
Cha
T
...Blip Ford-
Blip
s ro bots
u
---- Famo
sy
Dev. P

Photo courtesy of Elsevier http://issuu.com/beleggersbelangen/docs/previewjuist11/12


Robotics- ⤏
22| |Robotics Home
Home Robotics
Robotics 20

The arm motors


are on the body, to
allow for low weight, low
backlash movement.

Coupling
2DoF
---- Intuitive Control
----
2 | Robotics - Home Robotics 21

This is the Ford-T


nd
of Robotics ew f
o u
dr s
e An m an
, lik n hu
j a n i
Ma a tio
pir
ins

21
2 | Robotics - Review of state-of-the-art

One goal of AI is
to build robots that
are better than humans
----

http://www.youtube.com/watch?v=S5AnWzjHtWA

Honda Asimo evolution and Michio Kaku on AI


http://www.youtube.com/watch?v=97iZY9DySws

22
2 | Robotics - Review of state-of-the-art

A robot at Bielefeld University @ CITEC


Who am I?
----

Lack of empathy, no UX
knowledge and excess of
resources. This expensive
product epitomizes silo
thinking in todays
universities around the
world. How did this happen?

Uncanny valley helps the human


race to prevent the spread of
infectious diseases (such as Ebola) by
heavy un-liking the sick members of
the tribe. It’s hard wired in every one
of us. See also #zoombie
23
2 | Robotics - Review of state-of-the-art

This is an
example of over
engineering Pre-Ford-T
robot thinking
----

Lack of speed was


never associated with
intelligence
-----
Sun Tsu
The art of War
24
2 | Robotics - Review of state-of-the-art This is a pre
Ford-T Robot lab
----
CITEC

25
2 | Robotics - Review of state-of-the-art

Just to be clear

They are trying to build this They should be trying to build this:

26
2 | Robotics - Review of state-of-the-art

This is Flobie. A robot used at CITEC to test Human Robot


Interaction

Sociologists like
Selma Savanovic and
F. Eyssel use me to do
gender studies

27
2 | Robotics - Adaptative Robots

Adaptative Robots

http://www.youtube.com/watch?v=13JGGbB2ctM

28
3 | UX - The heart of AI

UX, User Experience; Designing for


emotion

Hello
In Japan where engineers grew up
with Doraemon (a robot), Arale- I am flobi!
chan (a robot), Gatchaman, ^.^’
Pathlabor (robots), Ghost in the
S h e l l ( a r o b o t ) , M a z i n g e r- Z
(robots) ... Robots are not seen as
antagonistic characters. In the
west, we grew up with Terminator
and only recently we got Wall-e

Photo courtesy of Elsevier http://issuu.com/beleggersbelangen/docs/previewjuist11/12


3 | UX - The heart of AI - Behaviourism 30

ple under
Peo
u c h the
ate so m
e s tim
n c e of
influ e
e n t u po n
onm
envir
be h a vior
their

ct ion Check
e
u s s
ev io
sp ell ch.1 of Seven
pr a
In ade d it Women that changed
m d i
u ut
yo .. b ppy? the UX industry
e r. a
e ck s e r h
c h u for a compelling case
t he
ke
ma
3 | UX - The heart of AI - Why Happy is Better

How design that makes you happy is easier to use simply Which video is more serious about safety...
because the fact that a happy brain has a higher IQ. http://www.youtube.com/watch?v=DtyfiPIHsIg&feature=kp
or

Don’t belive it? I don’t blame you. Lets do a little experiment:

or this one... http://www.youtube.com/watch?v=fSGaRVOLPfg


is
e x e rcise
the
p o int of .
The a w inner
find
not to h Airlin
e
y, E a c
ionall d
Ad d i t
u ltu res an
t c
More Happy, s d if feren I
ser ve i cs . Maybe
m
more IQ? i o econo ted
s o c
i t to Uni
re
l d compa
31 shou es.
Airlin
3 | UX - The heart of AI - Not every one is the same - Isabel Myers

Isabel Myers-Briggs
Knowing psychology should be a prerequisite before doing OK, I know that you are thinking. What is my personality type?
any AI at all. Anyhow, one of the best books to go up to speed http://www.humanmetrics.com/cgi-win/jtypes2.asp
on how humans “work”, is 50 Psychology Classics, a book I You are welcome.
recommend 100% because is compact. The audio book is
great. If you want to leverage human knowledge of the self my
second rec. is a book by Hellen Fisher that classifies people You want to do
into Builders, Explorers, Directors and Negotiators. There “ai” with a captial
is a lot confusion about the personality types. The most letter? you’d better start
famous is the Myers Brigs that classifies people into 16 types.
discerning personality
I trained myself to classify people I meet in types. I am good
at it. ^.^; It helps me to work with them better and to types yourself...
understand them better. (seek to understand, then to be
understood - 7HoHEP). However, because it is popular, there
is a lot of confusion on he Myers-Briggs system.

Because
if your AI can’t
distinguish between an
ISFJ vs. ENFP he will be
perceived as inept at
http://www.youtube.com/watch?v=aQ2QbS-EgrM social interactions...

32
3 | UX - The heart of AI - Not every one is the same - Isabel Myers

33
3 | UX - The heart of AI - Not every one is the same - Isabel Myers

via www.furthered.com

34
4 | Computer Vision

OpenCV was developed by Intel Russia


research center at Nizhny Novgorod

( in this chapter... )
Program a PC so it learn how to see

What does it mean to “see” something?


1. Projective geometry
2. The Eye Design
What does it mean to 3. Saliency Sense in babies
See?
te d 4. Morphological Operations
------
ven
In
er e
h
Nizhny Novgorod street via: http://personal.cfw.com/~renders/nizhnymall_photos.html
36
37
4 | Computer Vision - Projective Geometry

Caring about projective Geom in


Projective Geometry
Computer Vsion is the same mistake as
“model of the world” vs. “ground model”
- you should not care about the world
because you already have one model of
it: Your retina is your world and your
model! Do not complicate it by adding an
additional layer or model of a model that
u have to update continuously. You don’t
even know if the world is real. See Godl.
------

Many Books on Computer vision start by this topic. Which is


quite irrelevant. Let me explain, Picasso did not benefit from
learning the chemistry of Yellow paint manufacturing. You Reality?
neither. You don’t need 3D geometry knowledge, you just Your Reality!
need great 2D geometry knowledge.

a plane
n
Reti
38
4 | Computer Vision - The Design of the Eye

Pin-hole Design

Pin-hole lens design is one of the few cheap ways to take


photos. That is why manmade cameras use the same
principle. For a fascinating story on how the pinhole eye is
used by biological systems I recommend Climbing mount
improbable.

39
4 | Computer Vision - Developmental Psychology

Previously on chapter 2... babies.


When Maja hit the wall of unpractical computer vision, she Smooth visual tracking is present at birth
turned to developmental psychologists for strategies to
cope with large amounts of image pixels. This is what she
How baby cognition “works”
found (so you don’t have to):
Development of actions of babies is goal directed by two
motives. Actions are either,
Developmental Psychology Basics
1. To discover novelty
(Abridged from Maja Rudinac PhD thesis, TUDelft)
2. To discover regularity
Babies at the 4th month can already tell if a character is bad
3. To discover the potential of their own body
or good because we can see who they hug longer.
Infants look longer at new faces or new objects
Independent of where are born, all babies know boundaries Development of Perception is driven by two processes:
of objects. 1.Detection of structure or pattern in the sensors data
Can predict collisions 2. Discarding of irrelevant info and keeping relevant info
Basic additive and subtractive cognition
Can identify members of own group versus non-own group Cognitive robot shopping list
Spontaneous motor movement is not goal
So if we want to make a minimum viable
directed at the onset. The baby explores
product (MVP) that can understand the world at
the degrees of freedom
least like a baby this are the functions that
Goal directed arm-grasp appears at the 4th
according to Maja we will need:
month
the ability to engage and disengage Sensors
attention on targets appears from day 1 in Object tracking

40
4 | Computer Vision - Developmental Psychology

Discrimination
Attraction to peoples faces
Face recognition
Use the hand to move objects to scan them form various
angles

Shades and 3D
Turns out that shades have a disproportionate influence in
helping us figure out 3D info from 2D retina pixels. When
researchers at Univ. of Texas used fake shades in a virtual
reality world, participants got head aches (because the
faking of the shades was not precise enough to fool the
brain. The brain got confused by the inperceptible
mismatches... that’s why smart people get head aches in
3D cinemas)

41
4 | Computer Vision - Number Recognition

Workshop #1 Let’s identify written numbers from 0 to 9. You


can get some inspiration in this video:

What the robot sees.


Workshop Time
Teams of 4. You have 15 minutes to come up with some
algorithm, trick or rule to classify the numbers.

12345
http://www.youtube.com/watch?v=D_cZBdfw-hQ
In Feb 2011 (just before the tsunami), we programmed
HRP-IV to play a game. We used the histogram method to
separate Caucasian skin from a background and then we
counted the number of valleys and mountains between
the hull vertexes. A more primitive approach is to average

67890
the area, but then it is not as robust.
Code review:
https://github.com/orioli/MAID-ROBOT

https://github.com/orioli/MAID-ROBOT/blob/master/uEyeCameraHIRO/camShiftDemo/camShiftDemo.cpp

42
4 | Computer Vision - Number Recognition

Feature Reduction as a Necessity

Features
The students will try to find saliency features. Good
saliency features are robust to noise, partial occlusions
Feature Redux
and confusion. Here is a typical list:
Consider the letter ‘E’, its representation a s a vector is e =
# of horizontal segments
{0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0 ,
# of pixels belonging to horizontal segments
0,0,1,1,1,1,1,1,1,0,0 0,0,1,0,0,0,0,0,0 ... } that is a a vector
length of segments of dimension 11 x 13 = +100. There is no way for the
# contains closed loops retinal nerve to have enough bandwidth to send all that
# start and end points information for processing to the brain neurons. What
happens in reality is that, already at retina level, features
relative orientation of end points
are extracted, information is compressed.
Extracting features from pixels is called feature extraction.
If we find five features that allow us to distinguish between
Salient features are the ones that are most useful in
al 10 different number shapes, then the problem becomes
classifying pixels (Information Entropy).
a dimension 5 problem, much more manageable.

43
4 | Computer Vision - Number Recognition

Cluster of Zeroes
in a 2D space

Because the problem can be complex. Students can start clusters. This helps them understand the need of more
by trying to distinguish just two numbers. Manually features when clusters overlap
extracting two features: vertical and horizontal features
(feature reduction). Then, we can map the numbers in

44
4 | Computer Vision - Number Recognition

Training Reflection
Some teams came up with valley mountain features.
Others with number of lines, or crossings. Let’s make a
competition to see which is the winning team! (this is also
a great excuse to learn openCV)

Cognition leads to Play?


Once we have a program with the ability to recognize
numbers... what kind of games can we play? What kind of
applications can u imagine? Make a useful app.

ision
te r v
m pu
So if we start with webcam photos of figures at ll co d ay
s t o
A
p p w o rk
600x400 pixels how would you design the program? a lly
nta
At this stage most students fail to recognize the need ame t his
un
d
e as Now we just need to learn
for training with lots of examples. In fact the hard part f am
s
is training (understanding what features work to the m ple how to:
exa 1. Do tracking
differentiate 0 from 1 and a 1 from a 2...)
2. Clustering methods

3. How extract features with

opencv without reinventing

the wheel (next)


45
4 | Computer Vision - Morphological Ops

Morphological Ops

Closing
Morphs ops is different from linear filters in that they are not 1. Dilate (enlarge black pixel by adding black pixel next to pre
linear. Imagine you have the letter E but that the corner pixel existing black pixels using some kind of rule)
has been erased because of some noise. Your brain (Gestalt
Theory) Can reconstruct, in fact it is designed to reconstruct
intersections of lines. A computer is not. It doe snto knwo
anything about Gestalt. So how can we reconstruct this
missing corner? Otherwise the computer might think this is an
F underlined.
You can reconstruct this by use of so called http://www.youtube.com/watch?v=xO3ED27rMHs F!
E!
morhp op called “closing”

2. Erode (the reverse process)


http://www.youtube.com/watch?v=fmyE7DiaIYQ

46
4 | Computer Vision - Morphological Ops

Opening
Same but in reverse order

Case uses
Closing is used to connect missing lines.
Opening is used to remove noise, that does not belong
to the largest object in the scene.

For more:
http://homepages.inf.ed.ac.uk/rbf/HIPR2/morops.htm
http://bigwww.epfl.ch/demo/jmorpho/

47
4 | Computer Vision - Feature Extraction

Feature Extraction

Most
of Kaggle’s comp.
winners are decided by
how lucky they are at
finding useful features
----
j.

http://www.youtube.com/watch?v=n1ViNeWhC24

Manual Feature Extraction is not


the way forward

How to do automatic feature


extraction?

48
4 | Computer Vision - Vision for Navigation

Using vision to navigate

One day my wife was


sick so I had to vacuum the
house. Then I realized that bag
based vacuum cleaners do not suck,
So I decided to make one that sucks
more. I took longer than expected
though.
------
Sir J. Dyson

http://www.youtube.com/watch?v=8c2SFXQ5zHM Sir James


explains
http://www.youtube.com/watch?v=oguKCHP7jNQ Navigation
http://www.youtube.com/watch?v=xlaqYDZwoWo#t=43
Suction

NT: Hoover tried to steal his idea. They lost in court with
punitive damages.

49
4 | Computer Vision - Tracking

Ways of tracking MSER


Hessian Afine

Maja’s method

Features extracted
Use of HSV histogram (robust to ilumination changes)
Texture by Gray level co-occurrence matrix
Edge orientation histogram (6 bins)
Mean, skewness and sd for each color chanel
http://www.youtube.com/watch?v=InqV34BcheM Discard all but 25 top features. Tested on Columbia Object
Image Library. Beats previous methods.

1. By Color histogram (HSV is less


We are looking for an
dependent on illumination)
algo that is invariant to
2. By Blob (OpenCV Library)
partial oclusions
3. By Face Detection
------
4. By Saliency --> robust to occlusions Maja R.

Traditional methods of typical Keypoint Extraction for


recognition of objects independent of view
Harris Afine

50
4 | Computer Vision - Tracking

51
5 | Advanced Topics

Big Data. Exploded circa 2007.

I made Big Data

billions by using AI to “A new fashionable name for Data Mining”


especulate in Stocks. We are the
Google of trading Deep Learning
----- Deep Learning is a new area of Machine
James Simons Learning research, which has been introduced
Medallion Fund with the objective of moving Machine Learning
23 Billion (2011) closer to one of its original goals: Artificial
Intelligence.
If you Cloudera!
want to learn Big ------
J. Hammerbacher Renaissance Technologies is an American
Data join the fight club
hedge fund management company that operates
at kaggle.com
three funds.[3] It operates in East Setauket, Long
------ Island, New York, near Stony Brook University
with administrative functions handled in
Manhattan.

(Check Wienner vs. Wall Street 1947)


5 | Advanced Topics - A Real Case

Bere
ng
http:/ ueres an
/www d
.journ Efimov Jo
alofb u
igdata rnal of Big
.com Data
/con
tent/ 2014, 1:3
1/1/3
CAS
E ST
U DY
Airlin
real-t e new cu
ime r st
Jose esou omer tier
Beren
rce a
llocat level fore
guere 1*
s an
d Dm Open
* Corr
e
UAE spondenc
1
itry E
fimov ion o castin 2
Acce
ss
U
Dhab niversity e: jose@u
fam g f
iles p or
i, , 175 a
Full li UAE 51 A eu.ac.ae

This case will help you understand a typical big data project
st l Ain,
availa of autho Abu
Abst
rogra
ble a r
t the informati ract
end
of th on is
e artic
This le
is a m
at the three levels: had a case
stu
techn large mile dy on an
iques s a
would . As a loyalty pro irline’s m
n ile
miles become example, gram but s program
a to pre was n
in CR earned d privileg ot tak resource
Corporate or How to deal with conflicts of interest inside a u ed d ic t w
M o
extra interact ring the p frequen hether in ing advan ptimizat
polat ions t the c t io
was ion w betw ast mont flyer or omin age of re n. The air
39% it e e h s n o t, a li g month cent da lin
when when h whet n the was n ta min e
organization o he airli u sed ear (s), a
achie GBM and ne mont r a new u ne and th . This info extrapola new pas ing
v h s e r t se
false ed. This other ble of data er would passeng mation w ion of the nger
p co n w a e a
one w ositives. rrespond ding tech as used t ttain a p r. The co s then u
The a o rivile s
part o ere used.
e
ccura d to a p iques we make a
n ged rrelation ed
Business logic or How to pose the right questions that f A c re r pr mil of
of lim privileged n applicati y reache diction a e used, a ediction. es status
ited re m il o n tha d 97% c c uracy c orrela In co
can a sourc e s -tier w t rank if thr of 8 tion n t rast
ss
thus ign now es such as as propo s users ac ee month 7% with of 70% w ,
incre s
asing those reso available ed. The a cording to s of data less than as
make sense from a money point of view and add value Keyw
o
Frequ rds: Airlin
ent fl
the p
e
u
ed va e
u
n
p
erceiv rces to th pgrades o plication p their prob stead o %
lue o passenge a given fl rforms rea ility to be
e ab
in
f
3

yer; F ; Custom f th e pro rs w ig ht. l tim c om


FP; M e
iles p r equity; C gram ith the hig Moreove e allocati e

Mathematical or How to actually do the calculations


rogra at no h r, on
m; Ch ustomer p extra est revenu the airline
urn; D ro cost. e pote
Back
grou ata m fitability; L ntial
nd in ing if e tim
Prev e valu
iously e; Loy
line , sev alty p
indu eral rogra
s t r work m;
mizin y. In s hav
g ov 2003 e add
recen e rboo , a mo r essed
tly, in k ing p del t the is
$250 2013 ractic hat p sue
redic
,000 , Ala
ska A claimed
e ts no of optimiz
(if you can do well the above three, you can be a successful [2]. H prize t -show ing o
owev comp irline o inc rat perat
etitio s in rease
that
focus
er, th
ere a n wit coop
e reven io with t ions
of th
re ve h the r ation ues b he p e air
on s on en ry lit aim with y 0.4 urpo -
se of
data scientist that everybody loves*)
egme hanc tle w o f opt G .E an % t
Roug n t ing c in g their o rks o im d Ka o 3 .2% [ opti-
h Se ustom value n mil iz in g cos ggle 1
t I ]. M
ment Appr er s b . On es pr t s by nc., la o re
ing u oach y ex e exa ogram mod unch
A fe sers they tract mple s or ifying ed a
w ot acco repo ing d is [3] frequ flight
her w r d ing t r t class e c ision fr om T e nt flie p
* http://hbr.org/product/big-data-the-management-revolution/an/R1210C- (Cus o ret -rule lans
tome
r Eq
orks
such urn fl ification s fro aiwa
n, bu r pro
gram
Usin uity) a s [5 ight accu m q t the s
g SA . ] , fo a n d ra c ie u e s t ionn y fo
S so They lengt s of cused
55% attem cused on 95%. aires
PDF-ENG respe ftwar h of .
s tays [ U
© 201 ctive
ly. N
e th
ey re pt to
pred
pred
ictin using 4] focuse sing
a
Comm4 Berengu one port ict t g the a k-m d on
e of th false he to futur eans seg-
repro ons Attrib res and E em h p ositiv p 20 e a lgorit
ducti fi
on in ution Lice mov; lice e an % v a lu e of h
any m nse nse ave a d fals most passe m.
edium (http://c e Springe pplie valua nger
, prov re r.
ided ativecomm This is an
d th e ne ble c
the o
rigina ons.org/lic Open Acc
is kn
owle
gativ
e rat ustom s
l work en ess dge e of ers.
is pro ses/by/2.0 article dis to in 13 %
perly tr
credit ), which p ibuted un creas and
ed. ermit
s unre der the te
e the
stricte rm value
d use s of the C
, re
-
distrib
ution ative
, and

http://www.journalofbigdata.com/content/pdf/2196-1115-1-3.pdf

53
5 | Advanced Topics - Reverse Engineering the Neuro Cortex

Jeff Hawkins (the inventor of Palm Pilot) explains how he


reverse engineers the brain. Did you know that Jeff he started
all these companies just to have enough money to study the
brain?

memory-prediction framework I
invented
this, to have money for
this

------
J.Hawkins

http://www.youtube.com/watch?v=IOkiFOIbTkE

54
5 | Advanced Topics - Deep Learning

Deep Learning is a new area of Machine Learning research,


which has been introduced with the objective of moving
Machine Learning closer to one of its original goals: Artificial
Intelligence. See these course notes for a brief introduction to
Machine Learning for AI and an introduction toDeep Learning
algorithms. www.deeplearning.net/tutorial/

Deep Learning explained


(Abridged from the original from Pete Warden | @petewarden) Renaissance
http://radar.oreilly.com/2014/07/what-is-deep-learning-and-why-should-you-care.html

Inside an ANN It has always been difficult to train an ANN. But in 2012, a
The functions that are run inside an ANN are controlled by the breakthrough, a paper sparks a renaissance in ANN. Alex
memory of the neural network, arrays of numbers known as Krizhevsky, Ilya Sutskever, and Geoff Hinton bring together a
weights that define how the inputs are combined and whole bunch of different ways of accelerating the
recombined to produce the results. Dealing with real-world
learning process, including convolutional networks, clever
problems like cat-detection requires very complex functions,
use of GPUs, and some novel mathematical tricks like ReLU
which mean these arrays are very large, containing around
and dropout, and showed that in a few weeks they could
60 million (60MBytes) numbers in the case of one of train a very complex network to a level that outperformed
the recent computer vision networks. The biggest obstacle to conventional approaches to computer vision.
using neural networks has been figuring out how to set all
these massive arrays to values that will do a good job
transforming the input signals into output predictions.

55
5 | Advanced Topics - Deep Learning

GPU photo by Pete Warden slides (Jetpack) http://www.iro.umontreal.ca/~pift6266/H10/intro_diapos.pdf


Deep NN failed unitl 2006....

Listen to the Webcast at Strata 2013


Automatic speech recognition[edit]
http://www.oreilly.com/pub/e/3121
The results shown in the table below are for automatic speech
recognition on the popular TIMIT data set. This is a common
data set used for initial evaluations of deep learning
architectures. The entire set contains 630 speakers from eight
major dialects of American English, with each speaker reading
10 different sentences.[48] Its small size allows many different
configurations to be tried effectively with it. The error rates
presented are phone error rates (PER).
56
5 | Advanced Topics - Deep Learning

http://en.wikipedia.org/wiki/Deep_learning#Fundamental_concepts

57
Acknowledgments

i ng
e a rn
ep L
De
#
here! Can ask for help in case of
problem
Carry On

a bit slower
please
Not taller
Can Follow You than human
at different speeds

Not heavier
than human

Stairs and floors

Can follow a human


one step behind

Honda Development Center. Asimo project initial sketch


Two leg walking

You might also like