SlideShare a Scribd company logo
Dictionary Learning for Games
Manny Ko
Principal Engineer, Activision R&D
Graphics Research and Development
Outline
● K-SVD and dictionary learning
● Linear Blend Skinning
● Brief survey on automatic skinning and compression
● Dictionary learning for LBS
● Two-layer sparse compression of Le & Deng.
● This talk is about compressing skinned animations.
Frames, Sparsity and Global Illumination:
New Math for Games
GDC 2012
Robin Green – Microsoft Corp
Manny Ko – PDI/Dreamworks
Orthogonal Matching Pursuit
and K-SVD for Sparse Encoding
Manny Ko
Senior Software Engineer, Imaginations Technologies
Robin Green
SSDE, Microsoft Xbox ATG
Representing Signals
● We represent signals as linear combinations of things we already know –
the ‘basis’
× đ›Œ1 +
× đ›Œ2 +
× đ›Œ3 + ⋯
=
× đ›Œ0 +
Orthonormal Bases (ONBs)
● The simplest way to represent signals is using a set of orthonormal bases
𝑏𝑖 𝑡 𝑏𝑗(𝑡)
+∞
−∞
𝑑𝑡 =
0 𝑖 ≠ 𝑗
1 𝑖 = 𝑗
Example ONBs
● Fourier Basis
𝑏 𝑘 𝑡 = 𝑒 𝑖2𝑝𝑘𝑡
● Wavelets
𝑏 𝑚,𝑛 𝑡 = 𝑎−𝑚 2 đ‘„ 𝑎−𝑚 𝑡 − 𝑏𝑚
● Gabor Functions
𝑏 𝑘,𝑛 𝑡 = 𝜔 𝑡 − 𝑏𝑛 𝑒 𝑖2𝑝𝑘𝑡
● Contourlet
𝑏𝑗,𝑘,𝐧 𝑡 = Î»đ‘—,𝑘 𝑡 − 2 𝑗−1 𝐒 𝑘n
Benefits of ONB
● Analytic formulations
● Well understood mathematical properties
● Fast and simple algorithms for projection
Problems with ONB
● One-size-fits all – not data adaptive
● Global support cannot adapt to data locally
● Fourier support is infinite, SH support spans the sphere
● Try using Fourier to represent a step-function
● Not sparse – very few zero coefficients
● Not additive - relies on destructive cancellation.
Gibb’s Ringing – Fourier and SH
What is Overcomplete Dictionary?
● Overcomplete means the dictionary has more atoms
(columns) than the minimum required for the
dimension of the signal
● In 3D, an ONB only needs 3 basis
● A 3D dictionary can have dozens or hundreds
The Sparse Signal Model
𝐃
A fixed dictionary
đ›Œ
=
đ‘„
𝑁 𝑁
đŸ
resulting
signal
Sparse
vector of
coefficients
Why so many atoms?
● More atoms give our algorithm a better chance to
find a small subset that matches a given signal
● Let’s look at some patches from Barbara
Patches from Barbara
Dictionary Learning in Games - GDC 2014
Domain Specific Compression
● Just 550 bytes per image
1. Original
2. JPEG
3. JPEG2000
4. PCA
5. KSVD per block
Project onto Dictionaries
● Overcomplete and non-orthogonal
● interactions among atoms cannot be ignored
● How do we project?
● Sparse Coding problem
Matching Pursuit
1. Set the residual 𝑟 = đ‘„
2. Find an unselected atom
that best matches the
residual đƒđ›Œ − 𝑟
3. Re-calculate the residual
from matched atoms
𝑟 = đ‘„ − đƒđ›Œ
4. Repeat until 𝑟 ≀ 𝜖
Greedy Methods
𝐃
đ›Œ
=
đ‘„
Orthogonal Matching Pursuit (OMP)
● Add an Orthogonal Projection to the residual calculation
1. set đŒ ∶= ∅ , 𝑟 ≔ đ‘„, đ›Ÿ ≔ 0
2. while (𝑠𝑡𝑜𝑝𝑝𝑖𝑛𝑔 𝑡𝑒𝑠𝑡 𝑓𝑎𝑙𝑠𝑒) do
3. 𝑘 ≔ argmax
𝑘
𝑑 𝑘
𝑇
𝑟
4. đŒ ≔ đŒ, 𝑘
5. đ›ŸđŒ ≔ đƒđŒ
+ đ‘„
6. 𝑟 ≔ đ‘„ − đƒđŒ đ›ŸđŒ
7. end while
What is Dictionary Learning?
● select a few atoms for each signal – e.g. OMP
● Adjust the atoms to better fit those signals
● Repeat
K-SVD
● Is one of the well known dictionary learning
methods
● Check out our GDC2013 talk
● our GDC13 slides "OMP and K-SVD for Sparse Coding“
● See Jim’s talk just before this session
● Miral’s Online Learning is the other.
Overcomplete Dictionary Recap
● Importance of overcomplete dictionaries
● OMP for efficient projection onto dictionaries
● K-SVD for learning a better dictionary using samples
from the real data
Part 2: Skinning
● blank
Linear Blend Skinning
● 𝑣𝑖 = đ‘€đ‘–đ‘—(𝑅𝑗
|đ”|
𝑗=1 𝑝𝑗 + 𝑇𝑗)
● 𝑝𝑖 is the position for the 𝑖th vertex of the rest pose
● đ‘€đ‘–đ‘— ≄ 0 𝑎𝑛𝑑 𝑠𝑱𝑚𝑠 𝑡𝑜 𝑜𝑛𝑒(affinity). The non-negative
constraint makes the blend additive. The affinity
constraint prevents over-fitting and artifacts.
● 𝑅𝑗 usually is orthogonal to avoid shearing or scaling
● |đ”| is the number of weights (usually <= 6)
Blending Weights
Blending Weights
Blend Skinning on GPU
GPU
cores
LBS on GPUs
● đ‘€đ‘–đ‘— typically very sparse – 4-6 weights or less per-
vertex
● Ideally a group of vertices all have the same weights
to avoid thread divergence or splitting drawcalls
● These are fairly serious constraints
a) Some vertices might need more weights – e.g. very
smooth meshes or complex topology (hand)
WeightsReduction
Poisson-based Weight Reduction of Animated Meshes [Landreneau and Schaefer 2010]
 Discrete optimization:
– Impossible to find optimum solution
– Very high cost for non-optimum solution
‱ Fracture
‱ Significant increase of computing cost: nK non-zero  n(K+1) non-zero
K-Largest - fracturing
K-Largest - normals
Vertex Normal in Shader
Magic 4
● why 4 weights is too few to generate smooth
weights
● 4 vertices specifies an affine transform exactly.
● simplices in 3D contains 4 vertices for barycentric
coordinates.
Two-LayerSparseCompressionof
Dense-WeightBlendSkinning
BinhLe and ZhigangDeng
SIGGRAPH2013
Two-Layer Sparse Compression, Le & Deng 2013
● Use dictionary learning to compute a two-level
compression using bones
● Work with the weights of the bind-pose directly
Why Dictionary for LBS?
● Why dictionary learning?
● limitations of Orthonormal-basis e.g. eigen/PCA
● Not adaptive
● Not purely additive – i.e. negative weights (relies on cancellation)
● No intuitive meaning – bones extracted cannot be used to tweak the
model
Dense-WeightCompression
Input: Dense matrix
Bone Transformations
Blending
Vertices
Vertices
Bones
Dictionary Learning in Games - GDC 2014
SparseMatrixFactorization– dictionarylearning
SparseMatrixFactorization
c=max{card(wi)}+1
SparseMatrixFactorization
c=max{card(wi)}+1
n is very large
card(A)=2n→min
Algorithm– Blockcoordinatedescent
Alternative update D and A
(Block coordinate descent)
Update D Update A
UpdateCoefficientsA
Linear least square with 2 unknowns
Use mesh smoothness
assumption to quickly
find the non-zero
candidates (virtual bones)
αi
Movies
Analysis of Two-Layer Scheme
● Use 100’s of virtual bones means we are not limited to a
sparse approximation to the original animation.
● virtual bones act as a ‘common subexpression’
● e.g. think compute shader that writes to LDS.
● Still enforce sparsity on VBs to control runtime cost and
LDS usage – but k can be 100’s.
● Per-vertex weights are
● very sparse (2 per vertex) and the same for all vertices
● good for GPU.
Learning Virtual Bones
● Virtual bones are learned from the dense vertex weights
by block-coordinate-descent (BCD):
Sparse coding: search for a few good atoms among the
input columns. Use that to project all the rest of the inputs.
● Atom update: given the sparse weights from above we
seek to adjust the atoms to make them fit the inputs that
needs them better – a series of small LS problems.
● Similar to EM/Lloyd-Max
Sparse Coding
Sparse coding:
● insert the vertex with the largest L2 norm
● add a few more vertex which has the smallest dot-
product with the 1st atom
● solve the basis-pursuit with OMP (see K-SVD) or LARS.
● solve 2x2 least-square prob. for đ‘€đ‘–đ‘— to blend masters
bones
Weight Map – matrix A
● Weights and indices for each vertex to blend virtual
bones
● solving a small 2x2 linear system to minimize MSE:
● arg 𝑚𝑖𝑛 đ‘„ đ·đ‘„ − đ‘€đ‘– ^2
● runtime per-vertex cost is just 2 dotp
● no bone hierarchy to worry about
● no warp divergence even for high valence vertices
Atom Updates
Atom update:
foreach vertex
● update each atom to minimize error for the set of vertices that
reference it (this is like K-SVD)
● Miral’s Online Dictionary Learning [Miral09]
Atom Updates
● Precompute A and B
● 𝐮 = đ›Œđ‘–
𝑡
𝑖=1 đ›Œ 𝑇
● B = đ‘„đ‘– đ›Œ 𝑇𝑡
𝑖=1
● For all atoms
● 𝑱𝑗
1
𝐮 𝑗,𝑗
𝑏𝑗 − đ·đ‘Žđ‘— + 𝑑𝑗 − eq(5)
● 𝑑𝑗
1
max 𝑱 𝑗 2,1
𝑱𝑗. − eq 6
● 𝑱𝑗is thresholded to make sure # of non −
zero is below the # of master bones
Live Demo
● youtube
CompressionwithExamplePoses
Without using example pose
– Minimize weights difference
With using example poses
– Minimize reconstruction error
UsingExemplarposes
Virtual Bones Distribution
Recap
● The two-level scheme can work with dense (hand painted)
weights or example poses (blend shape?)
● Only the vertex positions are needed
● a fixed memory footprint and uniform per-vertex cost - GPU
friendly
● Combines the quality of dense skinning and the efficiencies of
sparse-LBS. Animators can use blend-shapes or FFD more.
Recap 2
● Besides it uses dictionary learning and modern
sparsity methods – how cool is that? 
● Last year we show how good dictionary learning is
for compressing 2d images and 3d volumes
● Now we see what it can do for animation.
● Thank you!
Recap 3
● Non-negative LS and Active-set Method (ASM)
● Block-coordinate descent
● Sparsity constraints
● L1 relaxation and L0-norm constraints
● Direct solving
● These are all very useful tools.
Acknowledgements
● Binh Huy Le & Zhigang Deng kindly provided the demo and their Siggraph
materials.
● Robin Green for being my collaborator for many years.
● Igor Carron inspired me to learn sparsity methods and matrix factorization
and for his spirit of broad exploration and sharing.
● Julien Mairal for the online learning math
● Peter-Pike who inspired me to apply modern math to graphics and games.
● Carlos Gonzalez Ochoa for sharing his insight in animation.
Activision R&D is Hiring
● Our group is hiring 
References
● Alexa 2000. “As-rigid-as-possible shape interpolation”, SIGGRAPH 2000.
● Halser 2010. “Learning skeletons for shape and pose”, I3D 2010.
● Kavan, Sloan and O'Sullivan 2010. “Fast and Efficient Skinning of Animated Meshes” Comput. Graph.
Forum.
● Ko, and Green 2013 “Orthogonal Matching Pursuit and K-SVD for Sparse Encoding” GDC, Math for
Games 2013 gdc2013-ompandksvd
● Landreneau & Schaefer “Poisson-Based Weight Reduction of Animated Meshes”, CGF 28(2), 2012.
● Le & Deng 2012. “Smooth skinning decomposition with rigid bones”, ACM TOG, Vol. 31, No. 6.
● Le & Deng 2013. “Two-Layer Sparse Compression of Dense-Weight Blend Skinning”, Siggraph 2013
Paper page
● Mairal 2009. “Online dictionary learning for sparse coding” Int. Conf. on Machine Learning.
Appendix
● Kabsch/Procrutes method – use SVD to compute the
MSE minimum rotation of one point-set to another.
● Kabsch_algorithm

More Related Content

PDF
Point Cloud Segmentation for 3D Reconstruction
Pirouz Nourian
 
PPTX
Gdc2012 frames, sparsity and global illumination
Manchor Ko
 
DOCX
Poster on Graph Terminologies
Deepak Tathe
 
PDF
Introduction to Problem Solving Techniques- Python
PriyankaC44
 
PPTX
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath Yogi
Tekendra Nath Yogi
 
PDF
pythonでă‚Șフィă‚čćż«é©ćŒ–èšˆç”»
Kazufumi Ohkawa
 
PDF
Aca2 01 new
Sumit Mittu
 
PDF
Implementation of FPGA Based Image Processing Algorithm using Xilinx System G...
IRJET Journal
 
Point Cloud Segmentation for 3D Reconstruction
Pirouz Nourian
 
Gdc2012 frames, sparsity and global illumination
Manchor Ko
 
Poster on Graph Terminologies
Deepak Tathe
 
Introduction to Problem Solving Techniques- Python
PriyankaC44
 
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath Yogi
Tekendra Nath Yogi
 
pythonでă‚Șフィă‚čćż«é©ćŒ–èšˆç”»
Kazufumi Ohkawa
 
Aca2 01 new
Sumit Mittu
 
Implementation of FPGA Based Image Processing Algorithm using Xilinx System G...
IRJET Journal
 

What's hot (15)

PPTX
C蚀èȘž ć­Šçż’æ•™æ
Jun MITANI
 
PPTX
Deep learning summary
ankit_ppt
 
PPT
Verilog tutorial
Maryala Srinivas
 
PPTX
Bresenham's line drawing algorithm
Mani Kanth
 
PPT
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
ODP
axi protocol
Azad Mishra
 
PPTX
ASIC Design Flow
RiseTime Semiconductors
 
PDF
Abc c program
Dayakar Siddula
 
PPTX
.NET and C# Introduction
Siraj Memon
 
PPTX
compiler and their types
patchamounika7
 
PDF
Mendix vs. OutSystems - Version Control
Leon Verster
 
PPTX
Unix philosophy and principles
maryamalmarrii
 
PPTX
Segment Anything
fake can
 
PDF
바닄부터 시작하는 Vue 테슀튞와 ëŠŹíŒ©í† ë§
if kakao
 
C蚀èȘž ć­Šçż’æ•™æ
Jun MITANI
 
Deep learning summary
ankit_ppt
 
Verilog tutorial
Maryala Srinivas
 
Bresenham's line drawing algorithm
Mani Kanth
 
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
axi protocol
Azad Mishra
 
ASIC Design Flow
RiseTime Semiconductors
 
Abc c program
Dayakar Siddula
 
.NET and C# Introduction
Siraj Memon
 
compiler and their types
patchamounika7
 
Mendix vs. OutSystems - Version Control
Leon Verster
 
Unix philosophy and principles
maryamalmarrii
 
Segment Anything
fake can
 
바닄부터 시작하는 Vue 테슀튞와 ëŠŹíŒ©í† ë§
if kakao
 
Ad

Viewers also liked (19)

PDF
omp-and-k-svd - Gdc2013
Manchor Ko
 
PDF
Learning Sparse Representation
Gabriel Peyré
 
PDF
Parallel Random Generator - GDC 2015
Manchor Ko
 
DOCX
IEEE 2014 MATLAB IMAGE PROCESSING PROJECTS Scale adaptive dictionary learning
IEEEBEBTECHSTUDENTPROJECTS
 
PDF
Dictionary Learning for Massive Matrix Factorization
Arthur Mensch
 
PDF
Random number generator
Syed Atif Naseem
 
PDF
CVPR2010: Sparse Coding and Dictionary Learning for Image Analysis: Part 1: S...
zukun
 
PPTX
Blind Source Separation using Dictionary Learning
Davide Nardone
 
PDF
English Hindi Dictionary
Ami Robin
 
PDF
A Friendly Guide To Sparse Coding
Shao-Chuan Wang
 
PPTX
Random Number Generation
Raj Bhatt
 
PPTX
Introduction to Compressive Sensing (Compressed Sensing)
Hamid Adldoost
 
PDF
Dictionary Learning for Massive Matrix Factorization
recsysfr
 
DOCX
Problems and Prospects of Human Right Instruments
Theola Bonsi
 
PDF
Brain reading, compressive sensing, fMRI and statistical learning in Python
Gael Varoquaux
 
PPT
Programming a clil unit
Cristiana Vasiluta Costea
 
PPT
Dictionary activities for esl learners
Dr. Vandana Pathak
 
PPTX
Practicum iii elena ramirez_garcia_16-04-2016
ELe Na
 
PDF
DISPLAY LUMAscape
LUMA Partners
 
omp-and-k-svd - Gdc2013
Manchor Ko
 
Learning Sparse Representation
Gabriel Peyré
 
Parallel Random Generator - GDC 2015
Manchor Ko
 
IEEE 2014 MATLAB IMAGE PROCESSING PROJECTS Scale adaptive dictionary learning
IEEEBEBTECHSTUDENTPROJECTS
 
Dictionary Learning for Massive Matrix Factorization
Arthur Mensch
 
Random number generator
Syed Atif Naseem
 
CVPR2010: Sparse Coding and Dictionary Learning for Image Analysis: Part 1: S...
zukun
 
Blind Source Separation using Dictionary Learning
Davide Nardone
 
English Hindi Dictionary
Ami Robin
 
A Friendly Guide To Sparse Coding
Shao-Chuan Wang
 
Random Number Generation
Raj Bhatt
 
Introduction to Compressive Sensing (Compressed Sensing)
Hamid Adldoost
 
Dictionary Learning for Massive Matrix Factorization
recsysfr
 
Problems and Prospects of Human Right Instruments
Theola Bonsi
 
Brain reading, compressive sensing, fMRI and statistical learning in Python
Gael Varoquaux
 
Programming a clil unit
Cristiana Vasiluta Costea
 
Dictionary activities for esl learners
Dr. Vandana Pathak
 
Practicum iii elena ramirez_garcia_16-04-2016
ELe Na
 
DISPLAY LUMAscape
LUMA Partners
 
Ad

Similar to Dictionary Learning in Games - GDC 2014 (20)

PDF
Dictionary based Image Compression via Sparse Representation
IJECEIAES
 
PPT
ECCV2010: feature learning for image classification, part 2
zukun
 
PDF
IVR - Chapter 7 - Patch models and dictionary learning
Charles Deledalle
 
PDF
A1804010105
IOSR Journals
 
PDF
Lecture32
zukun
 
PPTX
Semi supervised learning
Ahmed Taha
 
PDF
Chromatic Sparse Learning
Databricks
 
PDF
Performance Analysis on Fingerprint Image Compression Using K-SVD-SR and SPIHT
IRJET Journal
 
PPTX
No Slide Title
butest
 
PPTX
No Slide Title
butest
 
PDF
Making BIG DATA smaller
Tony Tran
 
PDF
Lecture 02 internet video search
zukun
 
PDF
Introduction to Autoencoders
Yan Xu
 
PDF
Super resolution image reconstruction via dual dictionary learning in sparse...
IJECEIAES
 
PDF
Discrete Models in Computer Vision
Yap Wooi Hen
 
PDF
ICCV2009: MAP Inference in Discrete Models: Part 2
zukun
 
PDF
large_scale_search.pdf
Emerald72
 
PDF
5 efficient-matching.ppt
mustafa sarac
 
PPT
ECCV2010: feature learning for image classification, part 3
zukun
 
PDF
Talk icml
Bo Li
 
Dictionary based Image Compression via Sparse Representation
IJECEIAES
 
ECCV2010: feature learning for image classification, part 2
zukun
 
IVR - Chapter 7 - Patch models and dictionary learning
Charles Deledalle
 
A1804010105
IOSR Journals
 
Lecture32
zukun
 
Semi supervised learning
Ahmed Taha
 
Chromatic Sparse Learning
Databricks
 
Performance Analysis on Fingerprint Image Compression Using K-SVD-SR and SPIHT
IRJET Journal
 
No Slide Title
butest
 
No Slide Title
butest
 
Making BIG DATA smaller
Tony Tran
 
Lecture 02 internet video search
zukun
 
Introduction to Autoencoders
Yan Xu
 
Super resolution image reconstruction via dual dictionary learning in sparse...
IJECEIAES
 
Discrete Models in Computer Vision
Yap Wooi Hen
 
ICCV2009: MAP Inference in Discrete Models: Part 2
zukun
 
large_scale_search.pdf
Emerald72
 
5 efficient-matching.ppt
mustafa sarac
 
ECCV2010: feature learning for image classification, part 3
zukun
 
Talk icml
Bo Li
 

Recently uploaded (20)

PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPTX
Comunidade Salesforce SĂŁo Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira JĂșnior
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PDF
Architecture of the Future (09152021)
EdwardMeyman
 
PPTX
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
PDF
Orbitly Pitch DeckA Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PDF
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Comunidade Salesforce SĂŁo Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira JĂșnior
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
This slide provides an overview Technology
mineshkharadi333
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Architecture of the Future (09152021)
EdwardMeyman
 
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
Orbitly Pitch DeckA Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 

Dictionary Learning in Games - GDC 2014

  • 1. Dictionary Learning for Games Manny Ko Principal Engineer, Activision R&D Graphics Research and Development
  • 2. Outline ● K-SVD and dictionary learning ● Linear Blend Skinning ● Brief survey on automatic skinning and compression ● Dictionary learning for LBS ● Two-layer sparse compression of Le & Deng. ● This talk is about compressing skinned animations.
  • 3. Frames, Sparsity and Global Illumination: New Math for Games GDC 2012 Robin Green – Microsoft Corp Manny Ko – PDI/Dreamworks
  • 4. Orthogonal Matching Pursuit and K-SVD for Sparse Encoding Manny Ko Senior Software Engineer, Imaginations Technologies Robin Green SSDE, Microsoft Xbox ATG
  • 5. Representing Signals ● We represent signals as linear combinations of things we already know – the ‘basis’ × đ›Œ1 + × đ›Œ2 + × đ›Œ3 + ⋯ = × đ›Œ0 +
  • 6. Orthonormal Bases (ONBs) ● The simplest way to represent signals is using a set of orthonormal bases 𝑏𝑖 𝑡 𝑏𝑗(𝑡) +∞ −∞ 𝑑𝑡 = 0 𝑖 ≠ 𝑗 1 𝑖 = 𝑗
  • 7. Example ONBs ● Fourier Basis 𝑏 𝑘 𝑡 = 𝑒 𝑖2𝑝𝑘𝑡 ● Wavelets 𝑏 𝑚,𝑛 𝑡 = 𝑎−𝑚 2 đ‘„ 𝑎−𝑚 𝑡 − 𝑏𝑚 ● Gabor Functions 𝑏 𝑘,𝑛 𝑡 = 𝜔 𝑡 − 𝑏𝑛 𝑒 𝑖2𝑝𝑘𝑡 ● Contourlet 𝑏𝑗,𝑘,𝐧 𝑡 = Î»đ‘—,𝑘 𝑡 − 2 𝑗−1 𝐒 𝑘n
  • 8. Benefits of ONB ● Analytic formulations ● Well understood mathematical properties ● Fast and simple algorithms for projection
  • 9. Problems with ONB ● One-size-fits all – not data adaptive ● Global support cannot adapt to data locally ● Fourier support is infinite, SH support spans the sphere ● Try using Fourier to represent a step-function ● Not sparse – very few zero coefficients ● Not additive - relies on destructive cancellation.
  • 10. Gibb’s Ringing – Fourier and SH
  • 11. What is Overcomplete Dictionary? ● Overcomplete means the dictionary has more atoms (columns) than the minimum required for the dimension of the signal ● In 3D, an ONB only needs 3 basis ● A 3D dictionary can have dozens or hundreds
  • 12. The Sparse Signal Model 𝐃 A fixed dictionary đ›Œ = đ‘„ 𝑁 𝑁 đŸ resulting signal Sparse vector of coefficients
  • 13. Why so many atoms? ● More atoms give our algorithm a better chance to find a small subset that matches a given signal ● Let’s look at some patches from Barbara
  • 16. Domain Specific Compression ● Just 550 bytes per image 1. Original 2. JPEG 3. JPEG2000 4. PCA 5. KSVD per block
  • 17. Project onto Dictionaries ● Overcomplete and non-orthogonal ● interactions among atoms cannot be ignored ● How do we project? ● Sparse Coding problem
  • 18. Matching Pursuit 1. Set the residual 𝑟 = đ‘„ 2. Find an unselected atom that best matches the residual đƒđ›Œ − 𝑟 3. Re-calculate the residual from matched atoms 𝑟 = đ‘„ − đƒđ›Œ 4. Repeat until 𝑟 ≀ 𝜖 Greedy Methods 𝐃 đ›Œ = đ‘„
  • 19. Orthogonal Matching Pursuit (OMP) ● Add an Orthogonal Projection to the residual calculation 1. set đŒ ∶= ∅ , 𝑟 ≔ đ‘„, đ›Ÿ ≔ 0 2. while (𝑠𝑡𝑜𝑝𝑝𝑖𝑛𝑔 𝑡𝑒𝑠𝑡 𝑓𝑎𝑙𝑠𝑒) do 3. 𝑘 ≔ argmax 𝑘 𝑑 𝑘 𝑇 𝑟 4. đŒ ≔ đŒ, 𝑘 5. đ›ŸđŒ ≔ đƒđŒ + đ‘„ 6. 𝑟 ≔ đ‘„ − đƒđŒ đ›ŸđŒ 7. end while
  • 20. What is Dictionary Learning? ● select a few atoms for each signal – e.g. OMP ● Adjust the atoms to better fit those signals ● Repeat
  • 21. K-SVD ● Is one of the well known dictionary learning methods ● Check out our GDC2013 talk ● our GDC13 slides "OMP and K-SVD for Sparse Coding“ ● See Jim’s talk just before this session ● Miral’s Online Learning is the other.
  • 22. Overcomplete Dictionary Recap ● Importance of overcomplete dictionaries ● OMP for efficient projection onto dictionaries ● K-SVD for learning a better dictionary using samples from the real data
  • 24. Linear Blend Skinning ● 𝑣𝑖 = đ‘€đ‘–đ‘—(𝑅𝑗 |đ”| 𝑗=1 𝑝𝑗 + 𝑇𝑗) ● 𝑝𝑖 is the position for the 𝑖th vertex of the rest pose ● đ‘€đ‘–đ‘— ≄ 0 𝑎𝑛𝑑 𝑠𝑱𝑚𝑠 𝑡𝑜 𝑜𝑛𝑒(affinity). The non-negative constraint makes the blend additive. The affinity constraint prevents over-fitting and artifacts. ● 𝑅𝑗 usually is orthogonal to avoid shearing or scaling ● |đ”| is the number of weights (usually <= 6)
  • 27. Blend Skinning on GPU GPU cores
  • 28. LBS on GPUs ● đ‘€đ‘–đ‘— typically very sparse – 4-6 weights or less per- vertex ● Ideally a group of vertices all have the same weights to avoid thread divergence or splitting drawcalls ● These are fairly serious constraints a) Some vertices might need more weights – e.g. very smooth meshes or complex topology (hand)
  • 29. WeightsReduction Poisson-based Weight Reduction of Animated Meshes [Landreneau and Schaefer 2010]  Discrete optimization: – Impossible to find optimum solution – Very high cost for non-optimum solution ‱ Fracture ‱ Significant increase of computing cost: nK non-zero  n(K+1) non-zero
  • 33. Magic 4 ● why 4 weights is too few to generate smooth weights ● 4 vertices specifies an affine transform exactly. ● simplices in 3D contains 4 vertices for barycentric coordinates.
  • 35. Two-Layer Sparse Compression, Le & Deng 2013 ● Use dictionary learning to compute a two-level compression using bones ● Work with the weights of the bind-pose directly
  • 36. Why Dictionary for LBS? ● Why dictionary learning? ● limitations of Orthonormal-basis e.g. eigen/PCA ● Not adaptive ● Not purely additive – i.e. negative weights (relies on cancellation) ● No intuitive meaning – bones extracted cannot be used to tweak the model
  • 37. Dense-WeightCompression Input: Dense matrix Bone Transformations Blending Vertices Vertices Bones
  • 42. Algorithm– Blockcoordinatedescent Alternative update D and A (Block coordinate descent) Update D Update A
  • 43. UpdateCoefficientsA Linear least square with 2 unknowns Use mesh smoothness assumption to quickly find the non-zero candidates (virtual bones) αi
  • 45. Analysis of Two-Layer Scheme ● Use 100’s of virtual bones means we are not limited to a sparse approximation to the original animation. ● virtual bones act as a ‘common subexpression’ ● e.g. think compute shader that writes to LDS. ● Still enforce sparsity on VBs to control runtime cost and LDS usage – but k can be 100’s. ● Per-vertex weights are ● very sparse (2 per vertex) and the same for all vertices ● good for GPU.
  • 46. Learning Virtual Bones ● Virtual bones are learned from the dense vertex weights by block-coordinate-descent (BCD): Sparse coding: search for a few good atoms among the input columns. Use that to project all the rest of the inputs. ● Atom update: given the sparse weights from above we seek to adjust the atoms to make them fit the inputs that needs them better – a series of small LS problems. ● Similar to EM/Lloyd-Max
  • 47. Sparse Coding Sparse coding: ● insert the vertex with the largest L2 norm ● add a few more vertex which has the smallest dot- product with the 1st atom ● solve the basis-pursuit with OMP (see K-SVD) or LARS. ● solve 2x2 least-square prob. for đ‘€đ‘–đ‘— to blend masters bones
  • 48. Weight Map – matrix A ● Weights and indices for each vertex to blend virtual bones ● solving a small 2x2 linear system to minimize MSE: ● arg 𝑚𝑖𝑛 đ‘„ đ·đ‘„ − đ‘€đ‘– ^2 ● runtime per-vertex cost is just 2 dotp ● no bone hierarchy to worry about ● no warp divergence even for high valence vertices
  • 49. Atom Updates Atom update: foreach vertex ● update each atom to minimize error for the set of vertices that reference it (this is like K-SVD) ● Miral’s Online Dictionary Learning [Miral09]
  • 50. Atom Updates ● Precompute A and B ● 𝐮 = đ›Œđ‘– 𝑡 𝑖=1 đ›Œ 𝑇 ● B = đ‘„đ‘– đ›Œ 𝑇𝑡 𝑖=1 ● For all atoms ● 𝑱𝑗 1 𝐮 𝑗,𝑗 𝑏𝑗 − đ·đ‘Žđ‘— + 𝑑𝑗 − eq(5) ● 𝑑𝑗 1 max 𝑱 𝑗 2,1 𝑱𝑗. − eq 6 ● 𝑱𝑗is thresholded to make sure # of non − zero is below the # of master bones
  • 52. CompressionwithExamplePoses Without using example pose – Minimize weights difference With using example poses – Minimize reconstruction error
  • 55. Recap ● The two-level scheme can work with dense (hand painted) weights or example poses (blend shape?) ● Only the vertex positions are needed ● a fixed memory footprint and uniform per-vertex cost - GPU friendly ● Combines the quality of dense skinning and the efficiencies of sparse-LBS. Animators can use blend-shapes or FFD more.
  • 56. Recap 2 ● Besides it uses dictionary learning and modern sparsity methods – how cool is that?  ● Last year we show how good dictionary learning is for compressing 2d images and 3d volumes ● Now we see what it can do for animation. ● Thank you!
  • 57. Recap 3 ● Non-negative LS and Active-set Method (ASM) ● Block-coordinate descent ● Sparsity constraints ● L1 relaxation and L0-norm constraints ● Direct solving ● These are all very useful tools.
  • 58. Acknowledgements ● Binh Huy Le & Zhigang Deng kindly provided the demo and their Siggraph materials. ● Robin Green for being my collaborator for many years. ● Igor Carron inspired me to learn sparsity methods and matrix factorization and for his spirit of broad exploration and sharing. ● Julien Mairal for the online learning math ● Peter-Pike who inspired me to apply modern math to graphics and games. ● Carlos Gonzalez Ochoa for sharing his insight in animation.
  • 59. Activision R&D is Hiring ● Our group is hiring 
  • 60. References ● Alexa 2000. “As-rigid-as-possible shape interpolation”, SIGGRAPH 2000. ● Halser 2010. “Learning skeletons for shape and pose”, I3D 2010. ● Kavan, Sloan and O'Sullivan 2010. “Fast and Efficient Skinning of Animated Meshes” Comput. Graph. Forum. ● Ko, and Green 2013 “Orthogonal Matching Pursuit and K-SVD for Sparse Encoding” GDC, Math for Games 2013 gdc2013-ompandksvd ● Landreneau & Schaefer “Poisson-Based Weight Reduction of Animated Meshes”, CGF 28(2), 2012. ● Le & Deng 2012. “Smooth skinning decomposition with rigid bones”, ACM TOG, Vol. 31, No. 6. ● Le & Deng 2013. “Two-Layer Sparse Compression of Dense-Weight Blend Skinning”, Siggraph 2013 Paper page ● Mairal 2009. “Online dictionary learning for sparse coding” Int. Conf. on Machine Learning.
  • 61. Appendix ● Kabsch/Procrutes method – use SVD to compute the MSE minimum rotation of one point-set to another. ● Kabsch_algorithm