SlideShare a Scribd company logo
1 of 46
IMAGE GENERATION AND
COMPRESSION USING
GENETIC ALGORITHM
Kiyoung Moon
GENETIC ALGORITHM : GA
• Image generation using genetic algorithm aka GA
WHAT IS GENETIC ALGORITHM?
• In computer science and operations research, a genetic algorithm (GA) is a
metaheuristic inspired by the process of natural selection that belongs to the larger
class of evolutionary algorithms (EA). Genetic algorithms are commonly used to
generate high-quality solutions to optimization and search problems by relying on
bio-inspired operators such as mutation, crossover and selection –Wikipedia-
EXAMPLE OF GENETIC ALGORITHMS
• Swing, Pathfinding, Image generation, compression and so on.
DEMO : SWING
• It’s difficult to create an algorithm to get the most efficient ride on the swing.
• What people can do,
• Bending, Standing up and so on.
• What’s the most efficient behavior?
• To reach the highest position!
• Do not use external forces(no hack!)
• https://www.youtube.com/watch?v=Yr_nRnqeDp0
HOW GENETIC ALGORITHM WORKS
Apply Selection
Crossover/Mutation
Evaluate Fitness of
Each Individual
Create
Initial
Population
End
MAKE DNA
• 0 Bending
• 1 Stand up
• 2 Bounce
• 0102102010210201201021020
• 010
• Bending, Stand up, Bending
• 210
• Bounce, Stand up, Bending
• … continue
USE GA!
• 10201021020120 -> Person1
• 01020120101021 -> Person2
• 10201202010120 -> Person3
• 10201020201010 -> Person4
• …
• 10102020001021 -> PersonN
Who is the best person?
GET THE SCORE
MATING, BREEDING
• In the same way as real nature
• What if pretty woman, handsome man are married and get the baby,
• You can have pretty or handsome baby(well… not 100%)
• What if smartest woman, man are married and get the baby,
• Maybe he/she will be smart…(well… not 100%)
• What if most skilled people who is good at swing are married and get the baby,
• There are many different mating algorithms.
• 50% DNA from father and 50% DNA from mother…
• There are many different algorithms for this particular jobs.
OK, NOW WE HAVE SECOND GENERATIONS.
• Randomly crossed among N groups to make N children.
• This is the first generation.
• After that, make them to swing!
• Based on theirs's score, crossover, mutation, breeding and prepare the next
generations.
• If we continue this steps N times, we can say that the generation is changed N times.
IN REAL LIFE?
• There is a mutation.
GIVE MUTATION TO DNA
• Change order
• 010102
• 010102
• 020101
• Change value
• 010102
• 010102
• 012102
DO NOT HAVE THE ILLUSION OF BEING ABLE
TO BECOME AN X MAN.
• In reality… mutation is not good.
RARELY…
EVEN THOUGH YOU ARE SAME AGE,
GENERATION IS NOT SAME.
LET’S THINK FOR A SECOND
• What does it take to have a child?
• Spouse
• To meet spouse,
• Pretty
• Handsome
• Lots of money
• Good heart
• Smart
• Cooking skill
• Random…
• And so on
THINK MORE
• Would early mankind have an eye?
• Would early mankind have a nose?
• If you are good at fighting, is there better chance to get marry?
• Do people need legs in the future? Do we really need legs?
WHAT WE CAN DO WITH GENETIC
ALGORITHM?
• Image generation
• Pathfinding
• Creative Gameplay
• Compression
• etc.
COMPRESSION?
• Image is consist of pixels.
NUMBER OF PIXELS REQUIRED TO
REPRESENT AN IMAGE
• Width * Height * Byte per pixel
• For example
• 512 x 512 x 4 = 1048576 bytes needs.
DIFFERENT WAY TO REPRESENT AN IMAGE
• To draw circle,
• x, y, radius, color needs.
• 4 elements.
• To draw rectangle,
• x, y, width, height, color needs
• 5 elements.
• Assume one property consume 4 bytes,
• To draw one circle, we need 16 bytes
• 4 x 4 = 16 bytes
• To draw one rectangle, we need 20 bytes
• 4 x 5 = 20 bytes
• There are 2 rectangles so we need 40 bytes.
• Total bytes needs : 56 bytes
• It is 1800 times better!
WELL… 1800 TIMES BETTER IS LIE
JUST DRAW, EVALUATE SCORES
• Just draw
• How? Randomly!
HOW TO DRAW?
• Randomly choose x, y coordinates.
• Randomly choose color.
• Randomly choose radius.
• Randomly choose move.
• Randomly choose add more shapes.
• Randomly choose remove shapes.
• Draw
EVALUATE SCORE(FITNESS)
• Let original image is o and DNA’s image is p.
𝐹𝑖𝑡𝑛𝑒𝑠𝑠 =
𝑦
ℎ
𝑥
𝑤
𝑝 𝑥,𝑦 − 𝑜 𝑥,𝑦
• Low 𝐹𝑖𝑡𝑛𝑒𝑠𝑠 means good.
• Higher fitness means, difference between two images are high.
• Of course there are many different ways to compare two images.
• For instance, we can use histogram of the images.
OK, PEOPLE. NOW DRAW IMAGES.
CHOOSE BEST IMAGE
• What’s the best image?
• Lowest fitness image
• Difference between two image are low which means two images are similar!
• Crossover, Mutation
• My program does not use crossover, only used mutation.
COMPARE TWO IMAGES.
• If new image’s (using different DNA) fitness is lower than previous DNA image, it
means new image is more similar than previous image.
• If so update current DNA
Repeat this process infinitely…
I PAINTED IT RANDOMLY… RESULT?
IT WORKS
• After 19577 generations
• Right image is consist of 163
rectangles.
• After 2877684 generations,
• Used 723 rectangles.
• 723 * 4 * 4 = 11568 bytes
ADVANTAGES
• We can represent an image with lower space
• Fun
DISADVANTAGE
• To get a similar image, it took lot of time.
• There is no guarantee that the exact same image will come out.
• If we do it infinitely?
THINK ABOUT : CAN WE APPLY IT TO
GAMEPLAY MECHANISM?
Producer : Wow… this is cool. What we can make with this technology?
Programmer : Hmm… that is you should let me know…
THANK YOU
Question?

More Related Content

Similar to Image generation compression using genetic algorithm

Topic 3 (Stats summary)
Topic 3 (Stats summary)Topic 3 (Stats summary)
Topic 3 (Stats summary)Ryan Herzog
 
Creativity to Innovation
Creativity to Innovation Creativity to Innovation
Creativity to Innovation Mike Cardus
 
03-Data-Analysis-Final.pdf
03-Data-Analysis-Final.pdf03-Data-Analysis-Final.pdf
03-Data-Analysis-Final.pdfSugumarSarDurai
 
Data Science 101
Data Science 101Data Science 101
Data Science 101ideatoipo
 
Introductionfuzzy...................................
Introductionfuzzy...................................Introductionfuzzy...................................
Introductionfuzzy...................................RevathiSoundiran1
 
Innovation startups passion and life ver 3 (final)
Innovation startups passion and life ver 3 (final)Innovation startups passion and life ver 3 (final)
Innovation startups passion and life ver 3 (final)Upstarts.tv
 
Artificail Intelligent lec-1
Artificail Intelligent lec-1Artificail Intelligent lec-1
Artificail Intelligent lec-1tjunicornfx
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic AlgorithmSHIMI S L
 
Agile india 1 day workshop quality in use user experience v5 for sharing
Agile india 1 day workshop quality in use user experience v5 for sharingAgile india 1 day workshop quality in use user experience v5 for sharing
Agile india 1 day workshop quality in use user experience v5 for sharingIsabel Evans
 
Genetic Algorithm: A Crisp And Concise Introduction [Shakeeb A.]
Genetic Algorithm: A Crisp And Concise Introduction [Shakeeb A.]Genetic Algorithm: A Crisp And Concise Introduction [Shakeeb A.]
Genetic Algorithm: A Crisp And Concise Introduction [Shakeeb A.]Shakeeb Ahmad Mohammad Mukhtar
 
Introduction to Genetic Algorithms 2014
Introduction to Genetic Algorithms 2014Introduction to Genetic Algorithms 2014
Introduction to Genetic Algorithms 2014Aleksander Stensby
 
On Hiring (in a Devops World)
On Hiring (in a Devops World)On Hiring (in a Devops World)
On Hiring (in a Devops World)Dave Zwieback
 
Perspectives on the Future of Forensic Genetics
Perspectives on the Future of Forensic GeneticsPerspectives on the Future of Forensic Genetics
Perspectives on the Future of Forensic GeneticsThermo Fisher Scientific
 
Co-designing using Inclusive Design Practices
Co-designing using Inclusive Design PracticesCo-designing using Inclusive Design Practices
Co-designing using Inclusive Design PracticesOpen Education Consortium
 

Similar to Image generation compression using genetic algorithm (20)

Topic 3 (Stats summary)
Topic 3 (Stats summary)Topic 3 (Stats summary)
Topic 3 (Stats summary)
 
Creativity to Innovation
Creativity to Innovation Creativity to Innovation
Creativity to Innovation
 
The art of AI Art
The art of AI ArtThe art of AI Art
The art of AI Art
 
03-Data-Analysis-Final.pdf
03-Data-Analysis-Final.pdf03-Data-Analysis-Final.pdf
03-Data-Analysis-Final.pdf
 
Data Science 101
Data Science 101Data Science 101
Data Science 101
 
Introductionfuzzy...................................
Introductionfuzzy...................................Introductionfuzzy...................................
Introductionfuzzy...................................
 
Innovation startups passion and life ver 3 (final)
Innovation startups passion and life ver 3 (final)Innovation startups passion and life ver 3 (final)
Innovation startups passion and life ver 3 (final)
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
0101.genetic algorithm
0101.genetic algorithm0101.genetic algorithm
0101.genetic algorithm
 
Artificail Intelligent lec-1
Artificail Intelligent lec-1Artificail Intelligent lec-1
Artificail Intelligent lec-1
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
Agile india 1 day workshop quality in use user experience v5 for sharing
Agile india 1 day workshop quality in use user experience v5 for sharingAgile india 1 day workshop quality in use user experience v5 for sharing
Agile india 1 day workshop quality in use user experience v5 for sharing
 
Banff preso
Banff presoBanff preso
Banff preso
 
Genetic Algorithm: A Crisp And Concise Introduction [Shakeeb A.]
Genetic Algorithm: A Crisp And Concise Introduction [Shakeeb A.]Genetic Algorithm: A Crisp And Concise Introduction [Shakeeb A.]
Genetic Algorithm: A Crisp And Concise Introduction [Shakeeb A.]
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligence
 
Introduction to Genetic Algorithms 2014
Introduction to Genetic Algorithms 2014Introduction to Genetic Algorithms 2014
Introduction to Genetic Algorithms 2014
 
On Hiring (in a Devops World)
On Hiring (in a Devops World)On Hiring (in a Devops World)
On Hiring (in a Devops World)
 
Perspectives on the Future of Forensic Genetics
Perspectives on the Future of Forensic GeneticsPerspectives on the Future of Forensic Genetics
Perspectives on the Future of Forensic Genetics
 
Co-designing using Inclusive Design Practices
Co-designing using Inclusive Design PracticesCo-designing using Inclusive Design Practices
Co-designing using Inclusive Design Practices
 
Innovation - find the gap!
Innovation - find the gap!Innovation - find the gap!
Innovation - find the gap!
 

More from Kiyoung Moon

유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기
유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기
유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기Kiyoung Moon
 
Debugging with visual studio. 비주얼 스튜디오를 활용한 디버깅
Debugging with visual studio. 비주얼 스튜디오를 활용한 디버깅Debugging with visual studio. 비주얼 스튜디오를 활용한 디버깅
Debugging with visual studio. 비주얼 스튜디오를 활용한 디버깅Kiyoung Moon
 
게임프로그래머에게 배우는 C#1권(버전1)
게임프로그래머에게 배우는 C#1권(버전1)게임프로그래머에게 배우는 C#1권(버전1)
게임프로그래머에게 배우는 C#1권(버전1)Kiyoung Moon
 
Cross-Platform Game Engine
Cross-Platform Game EngineCross-Platform Game Engine
Cross-Platform Game EngineKiyoung Moon
 
코히런트 Gt(coherent gt) 통합 및 간단한 사용법
코히런트 Gt(coherent gt) 통합 및 간단한 사용법코히런트 Gt(coherent gt) 통합 및 간단한 사용법
코히런트 Gt(coherent gt) 통합 및 간단한 사용법Kiyoung Moon
 
스케일폼(Scaleform) ue4에 통합 및 간단한 사용법
스케일폼(Scaleform) ue4에 통합 및 간단한 사용법스케일폼(Scaleform) ue4에 통합 및 간단한 사용법
스케일폼(Scaleform) ue4에 통합 및 간단한 사용법Kiyoung Moon
 
버그 트래킹 시스템 Mantis의 사용 그리고 예제
버그 트래킹 시스템 Mantis의 사용 그리고 예제버그 트래킹 시스템 Mantis의 사용 그리고 예제
버그 트래킹 시스템 Mantis의 사용 그리고 예제Kiyoung Moon
 
유니티 고급 과정 -4-
유니티 고급 과정 -4-유니티 고급 과정 -4-
유니티 고급 과정 -4-Kiyoung Moon
 
유니티 고급 과정 -3-
유니티 고급 과정 -3-유니티 고급 과정 -3-
유니티 고급 과정 -3-Kiyoung Moon
 
유니티 고급 과정 -2-
유니티 고급 과정 -2-유니티 고급 과정 -2-
유니티 고급 과정 -2-Kiyoung Moon
 
유니티 고급 과정 -1-
유니티 고급 과정 -1-유니티 고급 과정 -1-
유니티 고급 과정 -1-Kiyoung Moon
 
유니티로 해보는 게임 프로토타이핑
유니티로 해보는 게임 프로토타이핑유니티로 해보는 게임 프로토타이핑
유니티로 해보는 게임 프로토타이핑Kiyoung Moon
 

More from Kiyoung Moon (12)

유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기
유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기
유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기
 
Debugging with visual studio. 비주얼 스튜디오를 활용한 디버깅
Debugging with visual studio. 비주얼 스튜디오를 활용한 디버깅Debugging with visual studio. 비주얼 스튜디오를 활용한 디버깅
Debugging with visual studio. 비주얼 스튜디오를 활용한 디버깅
 
게임프로그래머에게 배우는 C#1권(버전1)
게임프로그래머에게 배우는 C#1권(버전1)게임프로그래머에게 배우는 C#1권(버전1)
게임프로그래머에게 배우는 C#1권(버전1)
 
Cross-Platform Game Engine
Cross-Platform Game EngineCross-Platform Game Engine
Cross-Platform Game Engine
 
코히런트 Gt(coherent gt) 통합 및 간단한 사용법
코히런트 Gt(coherent gt) 통합 및 간단한 사용법코히런트 Gt(coherent gt) 통합 및 간단한 사용법
코히런트 Gt(coherent gt) 통합 및 간단한 사용법
 
스케일폼(Scaleform) ue4에 통합 및 간단한 사용법
스케일폼(Scaleform) ue4에 통합 및 간단한 사용법스케일폼(Scaleform) ue4에 통합 및 간단한 사용법
스케일폼(Scaleform) ue4에 통합 및 간단한 사용법
 
버그 트래킹 시스템 Mantis의 사용 그리고 예제
버그 트래킹 시스템 Mantis의 사용 그리고 예제버그 트래킹 시스템 Mantis의 사용 그리고 예제
버그 트래킹 시스템 Mantis의 사용 그리고 예제
 
유니티 고급 과정 -4-
유니티 고급 과정 -4-유니티 고급 과정 -4-
유니티 고급 과정 -4-
 
유니티 고급 과정 -3-
유니티 고급 과정 -3-유니티 고급 과정 -3-
유니티 고급 과정 -3-
 
유니티 고급 과정 -2-
유니티 고급 과정 -2-유니티 고급 과정 -2-
유니티 고급 과정 -2-
 
유니티 고급 과정 -1-
유니티 고급 과정 -1-유니티 고급 과정 -1-
유니티 고급 과정 -1-
 
유니티로 해보는 게임 프로토타이핑
유니티로 해보는 게임 프로토타이핑유니티로 해보는 게임 프로토타이핑
유니티로 해보는 게임 프로토타이핑
 

Recently uploaded

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Recently uploaded (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

Image generation compression using genetic algorithm

  • 1. IMAGE GENERATION AND COMPRESSION USING GENETIC ALGORITHM Kiyoung Moon
  • 2. GENETIC ALGORITHM : GA • Image generation using genetic algorithm aka GA
  • 3. WHAT IS GENETIC ALGORITHM? • In computer science and operations research, a genetic algorithm (GA) is a metaheuristic inspired by the process of natural selection that belongs to the larger class of evolutionary algorithms (EA). Genetic algorithms are commonly used to generate high-quality solutions to optimization and search problems by relying on bio-inspired operators such as mutation, crossover and selection –Wikipedia-
  • 4. EXAMPLE OF GENETIC ALGORITHMS • Swing, Pathfinding, Image generation, compression and so on.
  • 5. DEMO : SWING • It’s difficult to create an algorithm to get the most efficient ride on the swing. • What people can do, • Bending, Standing up and so on. • What’s the most efficient behavior? • To reach the highest position! • Do not use external forces(no hack!)
  • 7. HOW GENETIC ALGORITHM WORKS Apply Selection Crossover/Mutation Evaluate Fitness of Each Individual Create Initial Population End
  • 8. MAKE DNA • 0 Bending • 1 Stand up • 2 Bounce • 0102102010210201201021020 • 010 • Bending, Stand up, Bending • 210 • Bounce, Stand up, Bending • … continue
  • 9. USE GA! • 10201021020120 -> Person1 • 01020120101021 -> Person2 • 10201202010120 -> Person3 • 10201020201010 -> Person4 • … • 10102020001021 -> PersonN Who is the best person?
  • 11.
  • 12.
  • 13. MATING, BREEDING • In the same way as real nature • What if pretty woman, handsome man are married and get the baby, • You can have pretty or handsome baby(well… not 100%) • What if smartest woman, man are married and get the baby, • Maybe he/she will be smart…(well… not 100%) • What if most skilled people who is good at swing are married and get the baby, • There are many different mating algorithms. • 50% DNA from father and 50% DNA from mother… • There are many different algorithms for this particular jobs.
  • 14. OK, NOW WE HAVE SECOND GENERATIONS. • Randomly crossed among N groups to make N children. • This is the first generation. • After that, make them to swing! • Based on theirs's score, crossover, mutation, breeding and prepare the next generations. • If we continue this steps N times, we can say that the generation is changed N times.
  • 15. IN REAL LIFE? • There is a mutation.
  • 16. GIVE MUTATION TO DNA • Change order • 010102 • 010102 • 020101 • Change value • 010102 • 010102 • 012102
  • 17. DO NOT HAVE THE ILLUSION OF BEING ABLE TO BECOME AN X MAN. • In reality… mutation is not good.
  • 19. EVEN THOUGH YOU ARE SAME AGE, GENERATION IS NOT SAME.
  • 20. LET’S THINK FOR A SECOND • What does it take to have a child? • Spouse • To meet spouse, • Pretty • Handsome • Lots of money • Good heart • Smart • Cooking skill • Random… • And so on
  • 21. THINK MORE • Would early mankind have an eye? • Would early mankind have a nose? • If you are good at fighting, is there better chance to get marry? • Do people need legs in the future? Do we really need legs?
  • 22. WHAT WE CAN DO WITH GENETIC ALGORITHM? • Image generation • Pathfinding • Creative Gameplay • Compression • etc.
  • 23. COMPRESSION? • Image is consist of pixels.
  • 24. NUMBER OF PIXELS REQUIRED TO REPRESENT AN IMAGE • Width * Height * Byte per pixel • For example • 512 x 512 x 4 = 1048576 bytes needs.
  • 25.
  • 26. DIFFERENT WAY TO REPRESENT AN IMAGE • To draw circle, • x, y, radius, color needs. • 4 elements. • To draw rectangle, • x, y, width, height, color needs • 5 elements.
  • 27. • Assume one property consume 4 bytes, • To draw one circle, we need 16 bytes • 4 x 4 = 16 bytes • To draw one rectangle, we need 20 bytes • 4 x 5 = 20 bytes • There are 2 rectangles so we need 40 bytes. • Total bytes needs : 56 bytes • It is 1800 times better!
  • 28. WELL… 1800 TIMES BETTER IS LIE
  • 29.
  • 30. JUST DRAW, EVALUATE SCORES • Just draw • How? Randomly!
  • 31. HOW TO DRAW? • Randomly choose x, y coordinates. • Randomly choose color. • Randomly choose radius. • Randomly choose move. • Randomly choose add more shapes. • Randomly choose remove shapes. • Draw
  • 32. EVALUATE SCORE(FITNESS) • Let original image is o and DNA’s image is p. 𝐹𝑖𝑡𝑛𝑒𝑠𝑠 = 𝑦 ℎ 𝑥 𝑤 𝑝 𝑥,𝑦 − 𝑜 𝑥,𝑦 • Low 𝐹𝑖𝑡𝑛𝑒𝑠𝑠 means good. • Higher fitness means, difference between two images are high. • Of course there are many different ways to compare two images. • For instance, we can use histogram of the images.
  • 33. OK, PEOPLE. NOW DRAW IMAGES.
  • 34.
  • 35. CHOOSE BEST IMAGE • What’s the best image? • Lowest fitness image • Difference between two image are low which means two images are similar! • Crossover, Mutation • My program does not use crossover, only used mutation.
  • 36. COMPARE TWO IMAGES. • If new image’s (using different DNA) fitness is lower than previous DNA image, it means new image is more similar than previous image. • If so update current DNA
  • 37. Repeat this process infinitely…
  • 38.
  • 39. I PAINTED IT RANDOMLY… RESULT?
  • 41. • After 19577 generations • Right image is consist of 163 rectangles.
  • 42. • After 2877684 generations, • Used 723 rectangles. • 723 * 4 * 4 = 11568 bytes
  • 43. ADVANTAGES • We can represent an image with lower space • Fun
  • 44. DISADVANTAGE • To get a similar image, it took lot of time. • There is no guarantee that the exact same image will come out. • If we do it infinitely?
  • 45. THINK ABOUT : CAN WE APPLY IT TO GAMEPLAY MECHANISM? Producer : Wow… this is cool. What we can make with this technology? Programmer : Hmm… that is you should let me know…