Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape...

42
Lecture 1 Lecture 1 3 3 Shape from Shading

Transcript of Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape...

Page 1: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

Lecture 1Lecture 133

Shape from Shading

Page 2: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

2

Shape from ShadingShape from Shading

Looking at finding normal, not distanceNormal: Describe the shape

Assuming point light source is far awayp,q are unknowns

22

222 1 kkbqkapqpI

Ellipse

Page 3: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

3

SFS: Data ConstraintSFS: Data Constraint

Given an intensity value I, (p,q) are constrained to be an ellipse

q

p

22

222 1 kkbqkapqpI

Page 4: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

4

Self OccludingSelf Occluding

If know self occluding, we can estimate normal.

Normal for self occluding edges are perpendicular to the edge in 2D

Page 5: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

5

SFSSFS

In human : tends to assume that light is above

Page 6: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

6

SFS: SFS: Classical Work

Horn and Schunk Use (p,q)

Problem: Self Occluding p,q undefinedAt occluding edge

dz/dx p ∞, q∞

To rectified this,sphere coordinates (,) are used

Page 7: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

7

Photometric StereoPhotometric Stereo

2/3 lights

-Given L1, Observe I1-Given L2, Observe I2-Given L3, Observe I3

Have 3 lights at different directions with distance ∞-Turn on L1, take pictures-Turn on L2, take pictures-Turn on L3, take pictures

Page 8: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

8

Photometric StereoPhotometric Stereo

I(x,y) = kdId(N.L)= N.L

= Albedo = whiteness

Page 9: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

9

Photometric StereoPhotometric Stereo

)( izziyyixxi lllI

z

y

x

zyx

zyx

zyx

III

III

III

I

I

I

333

222

111

3

2

1

4 unknowns : albedo and normal

known known unknown

Page 10: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

10

Photometric StereoPhotometric Stereo

I = L.N

3

2

11

I

I

I

L

z

y

x

)(,, 2222222222zyxzyxzyx NNNNNNNNN

2 1

Page 11: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

11

Photometric StereoPhotometric Stereo

4

3

2

291694

294

293

292

N

Page 12: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

12

Remaining TopicRemaining Topic

•Genetic Algorithm•Neural Network•Motion Processing

•Structure•Tracking (Fovea – Center Of Vision)

•Camera Calibration•Object Recognition Models

Page 13: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

13

Genetic AlgorithmGenetic Algorithm

Optimization Technique Based on “Survival of Fittest”

1. Population Size – FixedEach solution is an individual

2. Fitness of Individual – Fitness of “Chromosome” (small part) “Goodness”

3. Crossover – Combining Parts of 2 or more individualsNew child is put into population. May die.

4. Mutation – “Random change done to Part of an Individual”

Page 14: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

14

Genetic AlgorithmGenetic Algorithm

Charls Darwin – “Survival of Fitness”proposed how species develop

Moth - Industrial Revolution

Yellow Black99% 1%70% 30%20% 80%

Page 15: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

15

Genetic AlgorithmGenetic Algorithm

Algorithm:1. Create a random solution of 20 individuals

Sort by fitness { (1,__), (2, __), (3, __), …. }

2. R = Random(0,1)

if (R<0.9) /* Cross Over */

Use 2 or more solutions to create new one

else

Create a new random Individual

Insert new individual in to population if it is fitter than the worst one

Repeat Until the top 20 does not change

Page 16: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

16

Problem Statement: InputProblem Statement: Input

• The Order Book consists of Many Instances of a Set of Patterns

• Each Piece of garment can be placed at 0 degrees or 180 degrees

Page 17: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

17

Problem Statement: OutputProblem Statement: Output

W

L• Place all the pieces in the order book to use minimum fabric

length on a fixed width roll• Method: Genetic Algorithm

Page 18: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

18

About Genetic AlgorithmsAbout Genetic Algorithms

An optimization method that mimics the evolution of life using concepts of survival of the fittest within a fixed population.

Parts of Genetic Algorithm: Individual – a solution with known fitness Population – set of individuals forming the genetic pool Fitness Function – a measure of the goodness of an individual Creating a New Individual through Reproduction:

1. Self Replication 2. Crossover 3. Mutation

Output, result reported as the most fit individual in population.

Page 19: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

19

Related Work: Related Work: Pargas and Jain 1993 [8] Pargas and Jain 1993 [8]

R. P. Pargas and R. Jain. A Parallel Stochastic Optimization Algorithm for Solving 2D Bin Packing

Problems. IEEE Int. Conf. on A.I. for Applications. 1993.

A stochastic approach to bin packing 2-D figures Similar to genetic algorithms and simulated annealing Has 80% efficiency on regular shapes Tested on objects that can be packed to 100% efficiency For garments, efficiency cannot be 100% We compare to human expert for benchmark

Page 20: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

20

G. Roussel and S. Maouche, “Improvements About Automatic Lay-Planning For Irregular Shapes on Plain

Fabric” IEEE Proc. Systems Man and Cybernetics, System Engineering, 1993.

Shape layout problem for garment pieces Use a heuristic tree search algorithm called -admissible

algorithm Reasonable results Too much time spent back-tracking Tends to have a local minimum problem

Related Work: Related Work: Roussel and Mouche 1993 Roussel and Mouche 1993 [9][9]

Page 21: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

21

Related Work: Related Work: Ismail and Hon [11] Ismail and Hon [11]

H.S. Ismail and K.B. Hon. The Nesting of two-dimensional Shapes Using Genetic Algorithms.

Proceedings of The Institution of Mechanical Engineers Part B, Journal of Engineering Manufacture. 1995.

Minimize Raw Mat for cutting 2-D pieces Uses Genetic Algorithms and Heuristics

Simple shapes used Raw Material width not fixed, unrealistic

Page 22: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

22

Related Work: Related Work: Bounsaythip Bounsaythip et alet al [10] [10]

C. Bounsaythip, S. Maouche and M. Neus. Evolutionary Search Techniques Application in Automated Lay-Planning Optimization Problem. IEEE Int. Conf. on

Intelligent Systems for the 21st Century, 1995.

Minimize unoccupied space by Evolutionary Algorithm Shape representation by Comb Code Efficiency Measure: Length of Raw Mat (Fabric). Used pant garment pieces, regular shapes Good Results due to regular shapes used.

Page 23: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

23

Related Work: Related Work: Bounsaythip and Maouche [12] Bounsaythip and Maouche [12]

C. Bounsaythip and S. Maouche. Irregular Shape Nesting And Placing With Evolutionary Approach”. IEEE Int.

Conf. On Systems Man and Cybernetics. 1997.

Use the comb code representation for each garment piece Shape placement represented as hierarchical tree Allow orientations of 0, 90, 180, and 270 degrees Crossover: combine parts of tree, removing redundancy Results presented on relatively simple shapes, making it

difficult to assess the efficiency achieved

Page 24: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

24

Placing Items from Order BookPlacing Items from Order Book

• The Order Book consists of Many Instances of a Set of Patterns

• Each Piece of garment can be placed at 0 degrees or 180 degrees

• Each garment piece is polygonal

• Smooth contours (splines) approximated by convex hull first

1 2 3

4 5 6 7

8 9 10

11 12 13 14

Page 25: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

25

Placement Method: Check for Placement Method: Check for OverlapsOverlaps

Upon placing a new polygon, must check that:

1. NO vertex is INSIDE other polygons2. NO other polygon’s vertex is INSIDE

Convex Polygons Assumed

Page 26: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

26

Our Genetic AlgorithmOur Genetic Algorithm

1. Set and Randomly Initialize the Population of size P = 15

2. Divide Individual into chromosome strips. Compute strip efficiency.

3. Crossover, Mutation, and Selection:

Repeat

If random (0, 1) < crossover probability

Create a New Individual by Crossover:

Repeat

Sample for a chromosome from the solution biased by efficiency

Recompute chromosome efficiency based on Order Book balance

Until No Efficient Chromosome Available

Fill Remaining Solution Randomly by Order Book balance

Else

Create New Individual by Mutation: Fill Randomly from Order Book

Insert the solution into the new population

Check for Survival of Fittest P = 15

Until(Population has converged)or(No improvement in Best Solution)

Page 27: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

27

Step 1: Step 1: Initial Random Population Initial Random Population

S1 = [(5, 1), (3, 0), (4, 1), (1, 1), (2, 0), 15]

S2 = [(1, 0), (3, 0), (2, 1), (3, 0), (4, 0), 17]

S3 = [(5, 1), (3, 0), (7, 1), (1, 1), (2, 0), 20]

S4 = [(1, 0), (5, 0), (4, 0), (3, 1), (2, 0), 21]

S5 = [(1, 0), (3, 0), (5, 0), (2, 1), (4, 0), 23]

S6 = [(4, 0), (5, 0), (1, 1), (2, 0), (3, 0), 25]

S7 = [(3, 1), (4, 0), (5, 1), (2, 0), (1, 0), 27]

S8 = [(5, 1), (4, 0), (3, 1), (2, 1), (1, 0), 29]

S9 = [(3, 0), (2, 0), (1, 0), (5, 1), (4, 1), 32]

S10 = [(4, 1), (3, 0), (1, 1), (2, 1), (5, 1), 34]

An Individual Solution: S = [(F1, O1), (F2, O2),…,(Fn, On), L)]

where S - completed order book Fi - garment piece number

Oi - orientation at 0 or 180 degrees L - Length of Fabric used

5 3

4

1 2

7

Page 28: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

28

Step 2: Determine StripsStep 2: Determine Strips

W

Lstr1 Lstr2

L

Lstr3 Each Strip is determined bylargest piece along column.

Efficiency of each strip is Computed, used for crossover

Page 29: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

29

Crossover: Crossover: Sampling Within Population Sampling Within Population

11minmax

max

LLLL

BLB P = LB

LB

Page 30: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

30

Crossover: Crossover: Sampling for Efficient Sampling for Efficient StripsStrips

11minmax

min

EEEE

BEB P = EB

EB

• After sampling from population for 4 best solutions, Crossover takes place using efficient strips first

Page 31: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

31

Crossover: Crossover: Efficiency Decreases over Efficiency Decreases over Time Time

• Efficiency decreases as Order Book fills up• Once Efficiency too low, fill remaining items randomly

high lowered

Page 32: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

32

Mutation:Mutation: New Random Individual New Random Individual

• When Efficiency low, fill randomly is partly like mutation

• Mutation by generating a new random solution

• This new individual usually does not survive

• Our results are compared with layout by human expert

Page 33: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

33

Experimental Result 1: Experimental Result 1: RectanglesRectangles

6 Sets in Order Book

G.A.: 1:15 Hrs.

Page 34: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

34

Rectangles by Human ExpertRectangles by Human Expert

Manually: 0:25 Hrs.

Page 35: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

35

Experimental Result 2: Experimental Result 2: Shirt Pieces Shirt Pieces

10 Sets in Order Book

Page 36: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

36

Shirt Pcs. (10 orders) by G.A.Shirt Pcs. (10 orders) by G.A.

G.A.: 51:08 Hrs.

Page 37: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

37

Shirt Pcs. (10 orders) by HumanShirt Pcs. (10 orders) by Human

Manually: 1:25 Hrs.

Page 38: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

38

Experimental Result 3: Experimental Result 3: Multi-Edged Shapes by G.A. Multi-Edged Shapes by G.A.

3 Sets in Order Book

Page 39: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

39

Multi-Edged G.A. vs. HumanMulti-Edged G.A. vs. HumanG.A.: 0:57 Hrs.

Page 40: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

40

52

54

56

58

60

62

0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75

Iterations

E %1

2

3

5

4

Finding Crossover NumberFinding Crossover Number

Page 41: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

41

Finding Good Population SizeFinding Good Population Size

50

52

54

56

58

60

62

0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75

E %

Iterations

10

15

20

25 30

Page 42: Lecture 13 Shape from Shading 2 Looking at finding normal, not distance Normal: Describe the shape Assuming point light source is far away p,q are unknowns.

42

Discussion and ConclusionDiscussion and Conclusion

Main Problem: successive crossover reduces efficiency of good strips.

Efficiency 3-5% lower than human expert, while taking more time. Efficiency depends on the complexity of the piece, making it hard to

compare results among researchers.

high lowered