1 / 21

Image Processing & Computer Vision

Image Processing & Computer Vision. State space gradient descent & Gibbs sampler . Optimization (Finding best solution- หาวิธีที่ดีที่สุด). Hough Transform หาตำแหน่งของรูปทรงต่าง ๆ เช่น เส้นตรง, วงกลม, รูปทรงอื่น ๆ โดยการ voting (ให้คะแนน) State space gradient descent

kirby
Download Presentation

Image Processing & Computer Vision

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Image Processing &Computer Vision State space gradient descent & Gibbs sampler

  2. Optimization (Finding best solution-หาวิธีที่ดีที่สุด) • Hough Transform • หาตำแหน่งของรูปทรงต่าง ๆ เช่น เส้นตรง, วงกลม, รูปทรงอื่น ๆ โดยการ voting (ให้คะแนน) • State space gradient descent • การแทนค่าที่เป็นไปได้ในแต่ละ state เพื่อทำการหา Stable Energy เพื่อเป็นการตัดสินว่าเป็นค่าที่ดีที่สุด • Gibbs sampler • การแทนค่าที่เป็นไปได้ในแต่ละ state เพื่อทำการหา Energy และ Probability Distribution Function (PDF) เพื่อเป็นการตัดสินว่าเป็นค่าที่ดีที่สุด

  3. Computer vision problem • Computing optical flow motion การคำนวณการเคลื่อนที่ของวัตถุโดยการหาค่าเวกเตอร์ u และ v • Stereo disparity depth ค่าความลึกขององค์ประกอบหรือวัตถุต่าง ๆ ภายในภาพ โดยใช้ภาพจำลองของตาซ้ายและตาขวา • Shape from Texture  การหารูปร่างของวัตถุโดยดูจากลวดลาย • Shape from Contour  การหารูปร่างของวัตถุโดยดูจากเส้นแสดงขอบเขตของวัตถุ

  4. State space gradient descent E = xy[(Fxy – Ixy)2 + (Fx+1,y – Fxy)2 + (Fx,y+1 – Fxy)2] Algorithm Initial F0(x,y) = Random 0….255 For each pixel x,y For each possible state S if F(x,y) = 0, E0 = ………… if F(x,y) = 1, E1 = ………… .............. if F(x,y) = 255, E255 = ……….. Select state with minimum E Let’s F(x,y) = S Repeat until no change in E Noise 50% Restore

  5. State space gradient descent E = xy [(Fxy – Ixy)2 + (Fx+1,y – Fxy)2 + (Fx,y+1 – Fxy)2] Data Constraint Smoothness Constraint F(x,y) คือ ค่าที่เป็นไปได้ ที่จะต้องมีการ update ในแต่ละรอบในรอบแรกจะทำการ Random ค่าขึ้นมาก่อน ซึ่งค่าที่จะ Random มีค่าตั้งแต่ 0 - 255 E คือ Energy คือพลังงานที่ใช้ไปในแต่ละรอบ Ixy คือ Image Intensity ของภาพจริง  คือ weight ของเพื่อนบ้าน (Neighbor)

  6. Energy (Global Energy) การเปลี่ยนค่าที่ตำแหน่ง x,y มีผลกระทบต่อค่า Energy ของ (x,y) (x-1,y)และ (x,y-1) Clique คือ การเปลี่ยนค่าที่ทำให้เพื่อนบ้านที่มองดูตัว x,y อยู่ มีผลกระทบด้วย ดังนั้นการเปลี่ยนค่าในตำแหน่ง x,y ใด ๆ นั้นจะต้องมีการคำนวณค่า Energy ใหม่ด้วยสูตรด้านล่างนี้

  7. Energy (Global Energy) กรณีที่ดูเพื่อนบ้าน 3 ตัวคือ (x+1,y) (x+1,y+1) (x,y+1) E = xy [(Fxy – Ixy)2 + (Fx+1,y – Fxy)2 + (Fx+1,y+1 – Fxy)2 + (Fx,y+1 – Fxy)2]

  8. State space gradient descent State space gradient descent เป็นการหาค่าที่ดีที่สุดแบบ Greedy ซึ่งก็คือการหาค่าโดยที่เมื่อเจอค่าที่คิดว่าดีที่สุดเมื่อไหร่ก็จะนำเอาค่านั้นมาเป็นคำตอบ ซึ่งบาง ครั้งค่าที่ได้อาจจะเป็น Energy ที่ local minimum ซึ่งไม่ใช่ค่า ที่เป็น Global minimum ที่แท้จริงก็ได้

  9. Gradient descent Algorithm • Initial F0(x,y) = Random 0…255 • For each Pixel(x,y For each state S = 0…255 if F(x,y) = 0, E0 = ……. if F(x,y) = 1, E1 = ……. ………. if F(x,y) = 255, E255 = ……. Choose state with minimum E F(x,y) = S • Repeat step 2 until E is stable (not decrease)

  10. Example (state space gradient) 1 2 3 4 1 2 3 4 0 0 0 0 1 1 2 2 3 3 4 4 I(x,y) F(x,y) E = xy [(Fxy – Ixy)2 + (Fx+1,y – Fxy)2 + (Fx,y+1 – Fxy)2] Data Constraint Smoothness Constraint

  11. Gibbs Sampler • เนื่องจาก state space gradient descent เป็นวิธีแบบ Greedy ซึ่งอาจจะทำให้ผลลัพธ์ที่ออกมาไม่ดีเท่าที่ควร • Gibbs Sampler คือ Algorithm อีกแบบหนึ่งซึ่งนำเข้าช่วยทำให้วิธีการ state space gradient descent มีผลลัพธ์ที่ดีขึ้นโดยหลักการที่ใช้ก็คือ จะใช้ค่า Probability Distribution Function ร่วมด้วยในการตัดสินใจหาผลลัพธ์ที่ดีที่สุด

  12. Gibbs Sampler 1. Start temperature T is high 2. Initial F0(x,y) = Random 0…255 3. For each Pixel(x,y) For each state S = 0…255 if F(x,y) = 0; E0 = …..; P0 = …..;Prob0=…. if F(x,y) = 1; E1 = …..; P1 = …..;Prob1=…. ……………………. if F(x,y) = 255; E255 = …..; P255 = …..;Prob255= For each Probi = Pi / sum(Pi) 4. Sample for state S from pdf Probi F(x,y) = S 5. Reduce T = T * 0.9 6. Repeat step 3-4 until E is stable

  13. Gibbs Sampler • จากค่า E ทำอย่างไรจะได้ค่า Pi ออกมา • จะทำการหาค่า Probability Distribution Function (PDF) ได้อย่างไร • เพราะอะไรจึงต้องทำการลดค่า T(reduce T) และ T มีไว้สำหรับทำอะไร

  14. Gibbs Sampler • สูตรในการหาค่า Pi • Pi = exp(-Ei/T) Z = sum(Pi) Probi = Pi Z เมื่อ E = Energy exp = exponential มีค่าเท่ากับ 2.718 Z = ผลรวมทั้งหมดของ Pi

  15. Gibbs Sampler • ความหมายของค่า T (Temperature) (เดินแบบสุ่ม) • Probi = exp(-Ei/T) • Z (เข้าใกล้ 0 และเมื่อ Tมีค่า น้อยมากๆ นั่นหมายถึงเข้าสู่ Gradient Descent)

  16. Gibbs Sampler • การหาค่า Probability Distribution Function (PDF) pdf ให้ Random ค่า probality ตั้งแต่ 0…1 แล้วดูว่าค่าที่ Random มานั้น ตกอยู่ในช่วงของ pdf ใดให้ทำการเลือก state นั้นมา ดังตัวอย่าง สมมติให้ค่าที่ Random = 0.43 ดังนั้นจะได้ F(x,y) ตกอยู่ใน state ที่ 3 คือ F(x,y) = 3

  17. Gibbs Sampler ตัวอย่าง 3state0,1,2 P1=exp(-3/T) P2=exp(-4/T) P0=exp(-2/T) 0.1

  18. Example (gibbs sampler) 1 2 3 4 1 2 3 4 0 0 0 0 1 1 2 2 3 3 4 4 I(x,y) F(x,y) E = xy [(Fxy – Ixy)2 + (Fx+1,y – Fxy)2 + (Fx,y+1 – Fxy)2] Data Constraint Smoothness Constraint

  19. Noise removal using Gibbs Sampler randomnoise 50% ของภาพ ภาพที่ได้จากการทำ Gibbs sampler ภาพจะกลับคืน มาได้ดีระดับหนึ่ง ซึ่งทำให้เห็นราย ละเอียดต่าง ๆ ได้มากขึ้น ภาพจริงที่ไม่มี noise

  20. Noise removal using Gibbs Sampler E = xy [(Fxy – Ixy)2 + (Fx+1,y – Fxy)2 + (Fx,y+1 – Fxy)2] Data Constraint Smoothness Constraint เราจะให้ค่า  มีค่าสูงถ้าภายในภาพมี noise เยอะ ซึ่งก็จะทำให้ weight ของเพื่อนบ้าน(neighbor) มีความสำคัญ (เช่น 10,20) ค่า  จะมีค่าต่ำถ้าภายในภาพมี noise น้อย ซึ่งก็จะทำให้ weight ของเพื่อนบ้านไม่มีความสำคัญหรือมีน้อย ทำให้ E มีค่าแปรผันตาม data จริง(เช่น 0.001,0.0001) หรือถ้าจะให้ weight ของทั้ง data และ neighbor มีค่าเท่ากัน จะ set ให้ค่า  มีค่าเท่ากับ 1

  21. Noise removal with missing data E = xy [(Fxy – Ixy)2Axy+ (Fx+1,y – Fxy)2 + (Fx,y+1 – Fxy)2] Axy เป็น 0 ถ้า no data เป็น 1 ถ้า has data

More Related