SlideShare ist ein Scribd-Unternehmen logo
1 von 58
Downloaden Sie, um offline zu lesen
GEOMETRY PROCESSINGで学ぶ
      SPARSE MATRIX	
             2012/3/18 Tokyo.SciPy #3
            齊藤 淳 Jun Saito @dukecyto
本日の概要	
      Laplacian Mesh Processingを通じて
sparse matrix一般、scipy.sparseの理解を深める	



           !! = ! − !L !
Computer Graphics Animation	




        (c) copyright 2008, Blender Foundation / www.bigbuckbunny.org
Computer Graphics Animation	



Modeling    Animation    Rendering
•  作る	
     •  動かす	
     •  絵にする
SIGGRAPH 2011 Papers Categories	
       Modeling                  Animation                 Rendering               Images

•  Understanding           •  Capturing &            •  Stochastic          •  Drawing, Painting
   Shapes                     Modeling Humans           Rendering &            and Stylization
•  Mapping &               •  Facial Animation          Visibility          •  Tone Editing
   Warping Shapes          •  Call Animal Control!   •  Volumes & Photons   •  By-Example Image
•  Capturing               •  Contact and            •  Real-Time              Synthesis
   Geometry and               Constraints               Rendering           •  Image Processing
   Appearance              •  Example-Based             Hardware            •  Video Resizing &
•  Geometry                   Simulation             •  Sampling & Noise       Stabilization
   Processing              •  Fluid Simulation                              •  Stereo & Disparity
•  Discrete Differential   •  Fast Simulation                               •  Interactive Image
   Geometry                                                                    Editing
•  Geometry                                                                 •  Colorful
   Acquisition
•  Surfaces
•  Procedural &
   Interactive Modeling
•  Fun With Shapes
SIGGRAPH 2011 Papers Categories	
       Modeling                  Animation                 Rendering               Images

•  Understanding           •  Capturing &            •  Stochastic          •  Drawing, Painting
   Shapes                     Modeling Humans           Rendering &            and Stylization
•  Mapping &               •  Facial Animation          Visibility          •  Tone Editing
   Warping Shapes          •  Call Animal Control!   •  Volumes & Photons   •  By-Example Image
•  Capturing               •  Contact and            •  Real-Time              Synthesis
   Geometry and               Constraints               Rendering           •  Image Processing
   Appearance              •  Example-Based             Hardware            •  Video Resizing &
•  Geometry                   Simulation             •  Sampling & Noise       Stabilization
   Processing              •  Fluid Simulation                              •  Stereo & Disparity
•  Discrete Differential   •  Fast Simulation                               •  Interactive Image
   Geometry                                                                    Editing
•  Geometry                                                                 •  Colorful
   Acquisition
•  Surfaces
•  Procedural &
   Interactive Modeling
•  Fun With Shapes
Geometry Processingとは	
Geometry processing, or mesh processing, is a fast-growing
area of research that uses concepts from applied mathematics,
computer science and engineering to design efficient
algorithms for the
¨  acquisition

¨  reconstruction

¨  analysis

¨  manipulation

¨  simulation

¨  transmission

of complex 3D models.
                         http://en.wikipedia.org/wiki/Geometry_processing
Triangle Meshによる形状の表現
Differential Coordinates	
¨    形状の局所的な特徴
      ¤  方向は法線、大きさは平均曲率の近似




                                                                γ	


                 1                                   1
          δi =         ∑          ( vi − v )               ∫γ ( vi − v ) ds
                 di   v∈N ( i )                   len(γ ) v∈

      Discrete Laplace-Beltrami operator	
     Continuous Laplace-Beltrami operator	

                                                                      [Sorkine 2005]
Discrete Laplace Operator	
                            “Majority of
   Applications             contemporary geometry
                            processing tools rely on
   Mesh Parameterization    discrete Laplace
    Fairing / Smoothing     operators”
         Denoising                       [Alexa 2011]
   Manipulation / Editing
       Compression
      Shape Analysis
    Physical Simulation
Laplacian Mesh Processing
Graph Laplacian
(a.k.a. Uniform Laplacian, Topological Laplacian)	




                          http://en.wikipedia.org/wiki/Laplacian_matrix
Cotan-Weighted Laplacian	
緑: Graph Laplacian
赤: Cotan-Weighted Laplacian 	




                 1               1
       !!!   =                     cot !!" + cot !!" (!! − !! )
               4!(!! )           2
                         !∈! !
                                                         [Sorkine 2005]
Stanford 3D Scan Repository	



                  ¨    Stanford Bunny
                        ¤  頂点数:   35,947
                        ¤  35,947 x 35,947 =
                            1.2 G
Stanford 3D Scan Repository	



                  ¨    Dragon
                        ¤  頂点数:   566,098
                        ¤  566,098 x 566,098 =
                            298G
疎行列 Sparse Matrix	
               成分のほとんどがゼロである
               ことを活用した形式で行列を
               記憶・演算

               “Sparse matrices are widely
               used in scientific computation,
               especially in large-scale
               optimization, structural and circuit
               analysis, computational fluid
               dynamics, and, generally, the
               numerical solution of partial
               differential equations.”
               Sparse Matrices in MATLAB: Design and
               Implementation
疎行列 Sparse Matrix	
               成分のほとんどがゼロである
               ことを活用した形式で行列を
               記憶・演算


               Laplacian Matrixは
               ¨  sparse

               ¨  symmetric

               ¨  positive semi-definite
Python Sparse Matrix Packages	

SciPy Sparse

PySparse

CVXOPT
Python Sparse Matrix Packages	

SciPy Sparse

PySparse

CVXOPT
From OpenOpt doc...	



“Unfortunately, sparse matrices still
remains one of most weak features in
Python usage for scientific purposes”
From OpenOpt doc...	
“Unlike MATLAB, Octave, and a number of other
software, there is not standard Python library for
sparse matrices: someone uses scipy.sparse, someone
PySparse, someone (as CVXOPT) uses its own library
and/or BLAS, someone just uses 3 columns (for the
number indexes and value). SciPy developers refused
to author of scipy.sparse to include it into NumPy, I
think it's a big mistake, probably now it would been a
unified standard. Still I hope in future numpy versions
difference in API for handling sparse and dense
arrays will be removed. “
基本的な流れ	

構築に適した形                   演算に適した形式
式で行列を作る	
                 に変換し演算を行う	




 A = lil_matrix((N,N))!     A   =   A.tocsr()!
 A[i,j] = a!                A   =   A.dot(D)!
 !                          f   =   factorized(A)!
                            x   =   f.solve(b)!
Graph Laplacian
(a.k.a. Uniform Laplacian, Topological Laplacian)	




                         http://en.wikipedia.org/wiki/Laplacian_matrix
Graph Laplacian in scipy.sparse	
from scipy import sparse!
!
N = len(points)!
L = sparse.lil_matrix((N, N))!
for vids in faces:!
    L[vids, vids] = 1!
D = sparse.spdiags(L.sum(axis=0), 0, N, N)!
L = L.tocsc()-D!
Graph Laplacian in scipy.sparse	
from scipy import sparse!
!
N = len(points)!
L = sparse.lil_matrix((N, N))!
for vids in faces:!
    L[vids, vids] = 1!
D = sparse.spdiags(L.sum(axis=0), 0, N, N)!
L = L.tocsc()-D!
points and faces from Maya	
!
import numpy as np!
import pymel.core as pm!
!
mesh = pm.PyNode(‘bunny’)!
points = np.array(mesh.getPoints())!
faces = np.array(mesh.getVertices()!
    !    ! [1]).reshape(mesh.numFaces(),3)!
Graph Laplacian in scipy.sparse	
from scipy import sparse!
!
N = len(points)!
L = sparse.lil_matrix((N, N))!
for vids in faces:!
    L[vids, vids] = 1!
D = sparse.spdiags(L.sum(axis=0), 0, N, N)!
L = L.tocsc()-D!
Sparse Matrix Storage Formats	

構築に適した形式                 演算に適した形式
¨  LIst of Lists        ¨  Compressed Sparse
    (LIL)                    Row (CSR)
                         ¨  Compressed Sparse
¨  COOrdinate lists

    (COO)                    Column (CSC)
                         ¨  Block Sparse Row
¨  Dictionary Of Keys
                             (BSR)
    (DOK)
                         ¨  DIAgonal (DIA)
sparse.lil_matrix
LIst of Lists (LIL) 形式	
¨    データ構造              ¨    利点
      ¤  行毎に非ゼロ要素の            ¤  柔軟なslice
          ソートされた列インデッ          ¤  他のmatrix形式への変
          クスを保持するarray            換が速い
      ¤  対応する非ゼロ要素の
                         ¨    欠点
          値も同様に保持
                               ¤  LIL+ LIL が遅い (CSR/
¨    用途                           CSC推奨)
      ¤  行列の構築用               ¤  column slicingが遅い
      ¤  巨大な行列を構築する               (CSC推奨)
       際にはCOOも検討する             ¤  行列ベクトル積が遅い
       と良い                         (CSR/CSC推奨)
sparse.csr_matrix
Compressed Sparse Rows (CSR)形式	
¨    CSC: 行と列が逆                         ¨    利点
¨    データ構造                                    ¤  高速な演算       CSR + CSR,
                                                   CSR * CSR,等.
                                               ¤  Row slicingが速い
                                               ¤  行列ベクトル積が速い

                                         ¨    欠点
                                               ¤  Column
                                                        slicingが遅い
A = [1 2 3 1 2 2 1] 非ゼロ要素リスト!
                                                   (CSC推奨)
(IA    = [1 1 1 2 3 3 4] i行)!
IA' = [1 4 5 7] !                              ¤  他のmatrix形式への変
JA = [1 2 3 4 1 4 4] j列!                           換が遅い
                                                 (そうでもない?後述ベンチマーク参照)
A, IA’, JAを保持	


                         http://ja.wikipedia.org/wiki/%E7%96%8E%E8%A1%8C%E5%88%97
sparse.dia_matrix
DIAgonal (DIA)形式	
¨  帯行列に適した形式
¨  オフセットを指定可能



>>> data = array([[1,2,3,4]]).repeat(3,axis=0)!
>>> offsets = array([0,-1,2])!
>>> dia_matrix( (data,offsets),
shape=(4,4)).todense()!
matrix([[1, 0, 3, 0],!
        [1, 2, 0, 4],!
        [0, 2, 3, 0],!
        [0, 0, 3, 4]])!
Sparse Matrix Format Benchmark:
Construction	




  Benchmark by modified bench_sparse.py in SciPy distribution
Sparse Matrix Format Benchmark:
Conversion	




  Benchmark by modified bench_sparse.py in SciPy distribution
Sparse Matrix Format Benchmark:
Matrix Vector Product	




  Benchmark by modified bench_sparse.py in SciPy distribution
Graph Laplacian in scipy.sparse	
from scipy import sparse!
!
N = len(points)!
L = sparse.lil_matrix((N, N))!
for vids in faces:!
    L[vids, vids] = 1!
D = sparse.spdiags(L.sum(axis=0), 0, N, N)!
L = L.tocsc()-D!
Fancy indexingの仕様の違い	

sparse.lil_matrix	
                        numpy.array	


>>> L = sparse.lil_matrix((N,N))!          >>> Ldense = np.zeros((N,N))!
>>> ix = [1,3,4]!                          >>> ix = [1,3,4]!
>>> L[ix,ix] = 1!                          >>> Ldense[ix,ix] = 1!
>>> L.todense()!                           >>> Ldense!
matrix([[ 0.,   0.,   0.,   0.,   0.],!    array([[ 0.,   0.,   0.,   0.,   0.],!
        [ 0.,   1.,   0.,   1.,   1.],!           [ 0.,   1.,   0.,   0.,   0.],!
        [ 0.,   0.,   0.,   0.,   0.],!           [ 0.,   0.,   0.,   0.,   0.],!
        [ 0.,   1.,   0.,   1.,   1.],!           [ 0.,   0.,   0.,   1.,   0.],!
        [ 0.,   1.,   0.,   1.,   1.]])!          [ 0.,   0.,   0.,   0.,   1.]])!
補足: numpy.ix_()	
>>> Ldense = np.zeros((N,N))!
>>> ix = [1,3,4]!
>>> Ldense[np.ix_(ix,ix)] = 1!
>>> Ldense!
array([[ 0., 0., 0., 0., 0.],!
       [ 0., 1., 0., 1., 1.],!
       [ 0., 0., 0., 0., 0.],!
       [ 0., 1., 0., 1., 1.],!
       [ 0., 1., 0., 1., 1.]])!
Graph Laplacian in scipy.sparse	
from scipy import sparse!
!
N = len(points)!
L = sparse.lil_matrix((N, N))!
for vids in faces:!
    L[vids, vids] = 1!
D = sparse.spdiags(L.sum(axis=0), 0, N, N)!
L = L.tocsc()-D!
細かい演算の仕様	
!
#   LがCSC,CSRだとNotImplementedError!
L   -= D!
!
#   OK!
L   = L-D!
Laplacian Mesh Fairing	




             !
           ! = ! − !L !
A Signal Processing Approach To Fair Surface Design
[Taubin 95]
Mesh Fairing in scipy.sparse	
from scipy.sparse import linalg as spla!
!
A = sparse.identity(L.shape[0]) - _lambda * L!
solve = spla.factorized(A.tocsc())!
x = solve(points[:,0])!
y = solve(points[:,1])!
z = solve(points[:,2])!
new_points = np.array([x, y, z]).T!
!
# Set result back to Maya mesh!
mesh.setPoints(new_points)!
Mesh Fairing in scipy.sparse	
from scipy.sparse import linalg as spla!
!
A = sparse.identity(L.shape[0]) - _lambda * L!
solve = spla.factorized(A.tocsc())!
x = solve(points[:,0])!
y = solve(points[:,1])!
z = solve(points[:,2])!
new_points = np.array([x, y, z]).T!
!
# Set result back to Maya mesh!
mesh.setPoints(new_points)!
Solving sparse linear system	
¨    sparse.linalg.factorized(A)
      ¤  AのLU分解結果を保持したlinear             system solver関数を
          返す
      ¤  AはCSC形式で渡す必要がある
          SparseEfficiencyWarning: splu requires CSC matrix
          format
Mesh Fairing in scipy.sparse	
from scipy.sparse import linalg as spla!
!
A = sparse.identity(L.shape[0]) - _lambda * L!
solve = spla.factorized(A.tocsc())!
x = solve(points[:,0])!
y = solve(points[:,1])!
z = solve(points[:,2])!
new_points = np.array([x, y, z]).T!
!
# Set result back to Maya mesh!
mesh.setPoints(new_points)!
Solving sparse linear system	
# Error! 右辺はベクトルのみ!
new_points = solve(points)!
!
# 仕方がないので一列ずつ!
x = solve(points[:,0])!
y = solve(points[:,1])!
z = solve(points[:,2])!
new_points = np.array([x, y, z]).T!
Cotan-Weighted Laplacian	
緑: Graph Laplacian
赤: Cotan-Weighted Laplacian 	




                 1               1
       !!!   =                     cot !!" + cot !!" (!! − !! )
               4!(!! )           2
                         !∈! !
                                                         [Sorkine 2005]
Cotan Laplacian in scipy.sparse (1/2)	
def laplacian_cotan(points, faces):!
     EDGE_LOOP = [(0,1,2),(0,2,1),(1,2,0)]!
     N = len(points)!
     point_area = np.zeros(N)!
     L = sparse.lil_matrix((N, N))!
     for vids in faces:!
         point_area[vids] += area_triangle(points[vids]) /
3.0!
         for i in EDGE_LOOP:!
             v0 = vids[i[0]]!
             v1 = vids[i[1]]!
             v2 = vids[i[2]]!
             e1 = points[v1] - points[v2]!
             e2 = points[v0] - points[v2]!
Cotan Laplacian in scipy.sparse (2/2)	
            cosa = np.dot(e1, e2) / math.sqrt(np.dot(e1,
e1) * np.dot(e2, e2))!
            sina = math.sqrt(1 - cosa * cosa)!
            cota = cosa / sina!
            w = 0.5 * cota!
            L[v0, v0] -= w!
            L[v0, v1] += w!
            L[v1, v1] -= w!
            L[v1, v0] += w!
    D = sparse.spdiags(0.25/point_area, 0, N, N)!
    return D.dot(L.tocsc())!
Cotan Laplacian in scipy.sparse (2/2)	
            cosa = np.dot(e1, e2) / math.sqrt(np.dot(e1,
e1) * np.dot(e2, e2))!
            sina = math.sqrt(1 - cosa * cosa)!
            cota = cosa / sina!
            w = 0.5 * cota!
            L[v0, v0] -= w!
            L[v0, v1] += w!
            L[v1, v1] -= w!
            L[v1, v0] += w!
    D = sparse.spdiags(0.25/point_area, 0, N, N)!
    return D.dot(L.tocsc())!
行列積について	
# Denseに変換されてしまう!
np.dot(D, L)!
!
# Sparseのまま行列積!
D.dot(L)!
Laplacian Matrix構築
Cythonによる高速化	
¨    Python: 2.6秒

¨    Cython: 1.8秒

¨    Cython + Dense: 0.8秒!
      ¤ あまり大きくないMeshならばDenseで
       Laplacianを作った方が速い
ファイル入出力	
¨    numpy.savetxt()             >>> io.savemat('sparsetest.mat',
                                                  {'lil': L.tolil(),
      ¤    Sparse Matrixでは使えない                   'csr': L.tocsr()},
                                                  oned_as='row')


¨    scipy.io.savemat() /        >>> M = io.loadmat(‘sparsetest.mat')

      loadmat()                   >>> M['lil']
      ¤    MATLAB .mat形式で保存      <5x5 sparse matrix of type '<type
                                  'numpy.float64'>'
      ¤    Sparse Matrixは強制的に
            CSCで保存される                          with 9 stored elements in Compressed
                                  Sparse Column format>

                                  >>> M['csr']
                                  <5x5 sparse matrix of type '<type
                                  'numpy.float64'>'
                                               with 9 stored elements in Compressed
                                  Sparse Column format>
MATLAB vs. SciPy – Sparse Matrices	

MATLAB	
             SciPy Sparse	

¨  sparse()で行列を作る   ¨  内部形式(denseも含
    だけ!                  め)を意識して使う
¨  後の演算はdenseと全     ¨  形式によって同じ演

    く同じ                  算、関数が使えない
¨  内部形式はCSC	
           ケースがある
まとめ	
¨    Sparse matrix一般
      ¤  よく使われるデータ構造を理解した
¨    scipy.sparse
      ¤  使い方の基本がわかった
      ¤  いいところ
        n  やりたいことはできる。実用可能。
        n  Mesh
             Processingが省メモリで計算可能。〜1000倍のオーダーで
          速くなる。
      ¤  悪いところ
        n  ドキュメントされていない仕様が多過ぎ。
        n  ndarrayと透過的に使えるようにしてください   L
¨    Laplacian Mesh Processingはおもしろいですよ J
Future Work	
¨    scipy.sparse.linalg の調査
      ¤  Iterative   sparse linear system solver系


¨    Mesh Processingのもうちょっと深いネタを紹介
Further Readings	
[Sorkine 2005] Sorkine, Olga.
“Laplacian Mesh Processing” Eurographics 2005
http://igl.ethz.ch/projects/Laplacian-mesh-processing/STAR/STAR-Laplacian-mesh-processing.pdf

    ¤  Mesh    Laplacianの基礎と応用に関するまとめ
Further Readings	
Levy, Bruno and Zhang, Hao.
“Spectral Mesh Processing” ACM SIGGRAPH 2010
http://alice.loria.fr/WIKI/index.php/Graphite/SpectralMeshProcessing
   ¤  Laplacianの特異値分解を用いてMeshの周波数解析
Further Readings	
[Alexa 2011] Alexa, Marc and Wardetzky, Max.
“Discrete Laplacians on General Polygonal Meshes”
ACM SIGGRAPH 2011
http://cybertron.cg.tu-berlin.de/polymesh/ (ソースコード有)
   ¤  Discrete Laplacianを一般的なポリゴンメッシュに対し定義

Weitere ähnliche Inhalte

Was ist angesagt?

深層生成モデルを用いたマルチモーダル学習
深層生成モデルを用いたマルチモーダル学習深層生成モデルを用いたマルチモーダル学習
深層生成モデルを用いたマルチモーダル学習Masahiro Suzuki
 
【論文読み会】Alias-Free Generative Adversarial Networks(StyleGAN3)
【論文読み会】Alias-Free Generative Adversarial Networks(StyleGAN3)【論文読み会】Alias-Free Generative Adversarial Networks(StyleGAN3)
【論文読み会】Alias-Free Generative Adversarial Networks(StyleGAN3)ARISE analytics
 
Deep Learningで似た画像を見つける技術 | OHS勉強会#5
Deep Learningで似た画像を見つける技術 | OHS勉強会#5Deep Learningで似た画像を見つける技術 | OHS勉強会#5
Deep Learningで似た画像を見つける技術 | OHS勉強会#5Toshinori Hanya
 
[DL輪読会]1次近似系MAMLとその理論的背景
[DL輪読会]1次近似系MAMLとその理論的背景[DL輪読会]1次近似系MAMLとその理論的背景
[DL輪読会]1次近似系MAMLとその理論的背景Deep Learning JP
 
最適輸送入門
最適輸送入門最適輸送入門
最適輸送入門joisino
 
組合せ最適化入門:線形計画から整数計画まで
組合せ最適化入門:線形計画から整数計画まで組合せ最適化入門:線形計画から整数計画まで
組合せ最適化入門:線形計画から整数計画までShunji Umetani
 
数式を使わずイメージで理解するEMアルゴリズム
数式を使わずイメージで理解するEMアルゴリズム数式を使わずイメージで理解するEMアルゴリズム
数式を使わずイメージで理解するEMアルゴリズム裕樹 奥田
 
[DL輪読会]近年のエネルギーベースモデルの進展
[DL輪読会]近年のエネルギーベースモデルの進展[DL輪読会]近年のエネルギーベースモデルの進展
[DL輪読会]近年のエネルギーベースモデルの進展Deep Learning JP
 
[DL輪読会]Weakly-Supervised Disentanglement Without Compromises
[DL輪読会]Weakly-Supervised Disentanglement Without Compromises[DL輪読会]Weakly-Supervised Disentanglement Without Compromises
[DL輪読会]Weakly-Supervised Disentanglement Without CompromisesDeep Learning JP
 
Sparse Codingをなるべく数式を使わず理解する(PCAやICAとの関係)
Sparse Codingをなるべく数式を使わず理解する(PCAやICAとの関係)Sparse Codingをなるべく数式を使わず理解する(PCAやICAとの関係)
Sparse Codingをなるべく数式を使わず理解する(PCAやICAとの関係)Teppei Kurita
 
Bayesian Neural Networks : Survey
Bayesian Neural Networks : SurveyBayesian Neural Networks : Survey
Bayesian Neural Networks : Surveytmtm otm
 
変分推論と Normalizing Flow
変分推論と Normalizing Flow変分推論と Normalizing Flow
変分推論と Normalizing FlowAkihiro Nitta
 
[DL輪読会]A Bayesian Perspective on Generalization and Stochastic Gradient Descent
 [DL輪読会]A Bayesian Perspective on Generalization and Stochastic Gradient Descent [DL輪読会]A Bayesian Perspective on Generalization and Stochastic Gradient Descent
[DL輪読会]A Bayesian Perspective on Generalization and Stochastic Gradient DescentDeep Learning JP
 
[DL輪読会]Deep Learning 第15章 表現学習
[DL輪読会]Deep Learning 第15章 表現学習[DL輪読会]Deep Learning 第15章 表現学習
[DL輪読会]Deep Learning 第15章 表現学習Deep Learning JP
 
[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習Deep Learning JP
 
[DL輪読会]Flow-based Deep Generative Models
[DL輪読会]Flow-based Deep Generative Models[DL輪読会]Flow-based Deep Generative Models
[DL輪読会]Flow-based Deep Generative ModelsDeep Learning JP
 
Sliced Wasserstein距離と生成モデル
Sliced Wasserstein距離と生成モデルSliced Wasserstein距離と生成モデル
Sliced Wasserstein距離と生成モデルohken
 
組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015
組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015
組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015SaitoTsutomu
 
統計的学習理論チュートリアル: 基礎から応用まで (Ibis2012)
統計的学習理論チュートリアル: 基礎から応用まで (Ibis2012)統計的学習理論チュートリアル: 基礎から応用まで (Ibis2012)
統計的学習理論チュートリアル: 基礎から応用まで (Ibis2012)Taiji Suzuki
 

Was ist angesagt? (20)

深層生成モデルを用いたマルチモーダル学習
深層生成モデルを用いたマルチモーダル学習深層生成モデルを用いたマルチモーダル学習
深層生成モデルを用いたマルチモーダル学習
 
【論文読み会】Alias-Free Generative Adversarial Networks(StyleGAN3)
【論文読み会】Alias-Free Generative Adversarial Networks(StyleGAN3)【論文読み会】Alias-Free Generative Adversarial Networks(StyleGAN3)
【論文読み会】Alias-Free Generative Adversarial Networks(StyleGAN3)
 
共起要素のクラスタリングを用いた分布類似度計算
共起要素のクラスタリングを用いた分布類似度計算共起要素のクラスタリングを用いた分布類似度計算
共起要素のクラスタリングを用いた分布類似度計算
 
Deep Learningで似た画像を見つける技術 | OHS勉強会#5
Deep Learningで似た画像を見つける技術 | OHS勉強会#5Deep Learningで似た画像を見つける技術 | OHS勉強会#5
Deep Learningで似た画像を見つける技術 | OHS勉強会#5
 
[DL輪読会]1次近似系MAMLとその理論的背景
[DL輪読会]1次近似系MAMLとその理論的背景[DL輪読会]1次近似系MAMLとその理論的背景
[DL輪読会]1次近似系MAMLとその理論的背景
 
最適輸送入門
最適輸送入門最適輸送入門
最適輸送入門
 
組合せ最適化入門:線形計画から整数計画まで
組合せ最適化入門:線形計画から整数計画まで組合せ最適化入門:線形計画から整数計画まで
組合せ最適化入門:線形計画から整数計画まで
 
数式を使わずイメージで理解するEMアルゴリズム
数式を使わずイメージで理解するEMアルゴリズム数式を使わずイメージで理解するEMアルゴリズム
数式を使わずイメージで理解するEMアルゴリズム
 
[DL輪読会]近年のエネルギーベースモデルの進展
[DL輪読会]近年のエネルギーベースモデルの進展[DL輪読会]近年のエネルギーベースモデルの進展
[DL輪読会]近年のエネルギーベースモデルの進展
 
[DL輪読会]Weakly-Supervised Disentanglement Without Compromises
[DL輪読会]Weakly-Supervised Disentanglement Without Compromises[DL輪読会]Weakly-Supervised Disentanglement Without Compromises
[DL輪読会]Weakly-Supervised Disentanglement Without Compromises
 
Sparse Codingをなるべく数式を使わず理解する(PCAやICAとの関係)
Sparse Codingをなるべく数式を使わず理解する(PCAやICAとの関係)Sparse Codingをなるべく数式を使わず理解する(PCAやICAとの関係)
Sparse Codingをなるべく数式を使わず理解する(PCAやICAとの関係)
 
Bayesian Neural Networks : Survey
Bayesian Neural Networks : SurveyBayesian Neural Networks : Survey
Bayesian Neural Networks : Survey
 
変分推論と Normalizing Flow
変分推論と Normalizing Flow変分推論と Normalizing Flow
変分推論と Normalizing Flow
 
[DL輪読会]A Bayesian Perspective on Generalization and Stochastic Gradient Descent
 [DL輪読会]A Bayesian Perspective on Generalization and Stochastic Gradient Descent [DL輪読会]A Bayesian Perspective on Generalization and Stochastic Gradient Descent
[DL輪読会]A Bayesian Perspective on Generalization and Stochastic Gradient Descent
 
[DL輪読会]Deep Learning 第15章 表現学習
[DL輪読会]Deep Learning 第15章 表現学習[DL輪読会]Deep Learning 第15章 表現学習
[DL輪読会]Deep Learning 第15章 表現学習
 
[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習
 
[DL輪読会]Flow-based Deep Generative Models
[DL輪読会]Flow-based Deep Generative Models[DL輪読会]Flow-based Deep Generative Models
[DL輪読会]Flow-based Deep Generative Models
 
Sliced Wasserstein距離と生成モデル
Sliced Wasserstein距離と生成モデルSliced Wasserstein距離と生成モデル
Sliced Wasserstein距離と生成モデル
 
組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015
組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015
組合せ最適化を体系的に知ってPythonで実行してみよう PyCon 2015
 
統計的学習理論チュートリアル: 基礎から応用まで (Ibis2012)
統計的学習理論チュートリアル: 基礎から応用まで (Ibis2012)統計的学習理論チュートリアル: 基礎から応用まで (Ibis2012)
統計的学習理論チュートリアル: 基礎から応用まで (Ibis2012)
 

Ähnlich wie Geometry Processingで学ぶSparse Matrix

[Harvard CS264] 12 - Irregular Parallelism on the GPU: Algorithms and Data St...
[Harvard CS264] 12 - Irregular Parallelism on the GPU: Algorithms and Data St...[Harvard CS264] 12 - Irregular Parallelism on the GPU: Algorithms and Data St...
[Harvard CS264] 12 - Irregular Parallelism on the GPU: Algorithms and Data St...npinto
 
CVPR 2012 Review Seminar - Multi-View Hair Capture using Orientation Fields
CVPR 2012 Review Seminar - Multi-View Hair Capture using Orientation FieldsCVPR 2012 Review Seminar - Multi-View Hair Capture using Orientation Fields
CVPR 2012 Review Seminar - Multi-View Hair Capture using Orientation FieldsJun Saito
 
Action Genome: Action As Composition of Spatio Temporal Scene Graphs
Action Genome: Action As Composition of Spatio Temporal Scene GraphsAction Genome: Action As Composition of Spatio Temporal Scene Graphs
Action Genome: Action As Composition of Spatio Temporal Scene GraphsSangmin Woo
 
NIAR_VRC_2010
NIAR_VRC_2010NIAR_VRC_2010
NIAR_VRC_2010fftoledo
 
Collaborative Similarity Measure for Intra-Graph Clustering
Collaborative Similarity Measure for Intra-Graph ClusteringCollaborative Similarity Measure for Intra-Graph Clustering
Collaborative Similarity Measure for Intra-Graph ClusteringWaqas Nawaz
 
The Search for a New Visual Search Beyond Language - StampedeCon AI Summit 2017
The Search for a New Visual Search Beyond Language - StampedeCon AI Summit 2017The Search for a New Visual Search Beyond Language - StampedeCon AI Summit 2017
The Search for a New Visual Search Beyond Language - StampedeCon AI Summit 2017StampedeCon
 
Semi-supervised concept detection by learning the structure of similarity graphs
Semi-supervised concept detection by learning the structure of similarity graphsSemi-supervised concept detection by learning the structure of similarity graphs
Semi-supervised concept detection by learning the structure of similarity graphsSymeon Papadopoulos
 
Actors, a Unifying Pattern for Scalable Concurrency | C4 2006
Actors, a Unifying Pattern for Scalable Concurrency | C4 2006 Actors, a Unifying Pattern for Scalable Concurrency | C4 2006
Actors, a Unifying Pattern for Scalable Concurrency | C4 2006 Real Nobile
 
Processing Large Graphs
Processing Large GraphsProcessing Large Graphs
Processing Large GraphsNishant Gandhi
 
Computer Vision Structure from motion
Computer Vision Structure from motionComputer Vision Structure from motion
Computer Vision Structure from motionWael Badawy
 
Computer Vision sfm
Computer Vision sfmComputer Vision sfm
Computer Vision sfmWael Badawy
 
187186134 5-geometric-modeling
187186134 5-geometric-modeling187186134 5-geometric-modeling
187186134 5-geometric-modelingmanojg1990
 
5 geometric-modeling-ppt-university-of-victoria
5 geometric-modeling-ppt-university-of-victoria5 geometric-modeling-ppt-university-of-victoria
5 geometric-modeling-ppt-university-of-victoriaRaghu Gadde
 
187186134 5-geometric-modeling
187186134 5-geometric-modeling187186134 5-geometric-modeling
187186134 5-geometric-modelingmanojg1990
 
Lecture 01 frank dellaert - 3 d reconstruction and mapping: a factor graph ...
Lecture 01   frank dellaert - 3 d reconstruction and mapping: a factor graph ...Lecture 01   frank dellaert - 3 d reconstruction and mapping: a factor graph ...
Lecture 01 frank dellaert - 3 d reconstruction and mapping: a factor graph ...mustafa sarac
 
Enforcing Behavioral Constraints in Evolving Aspect-Oriented Programs
 Enforcing Behavioral Constraints in Evolving Aspect-Oriented Programs Enforcing Behavioral Constraints in Evolving Aspect-Oriented Programs
Enforcing Behavioral Constraints in Evolving Aspect-Oriented ProgramsRaffi Khatchadourian
 

Ähnlich wie Geometry Processingで学ぶSparse Matrix (20)

[Harvard CS264] 12 - Irregular Parallelism on the GPU: Algorithms and Data St...
[Harvard CS264] 12 - Irregular Parallelism on the GPU: Algorithms and Data St...[Harvard CS264] 12 - Irregular Parallelism on the GPU: Algorithms and Data St...
[Harvard CS264] 12 - Irregular Parallelism on the GPU: Algorithms and Data St...
 
CVPR 2012 Review Seminar - Multi-View Hair Capture using Orientation Fields
CVPR 2012 Review Seminar - Multi-View Hair Capture using Orientation FieldsCVPR 2012 Review Seminar - Multi-View Hair Capture using Orientation Fields
CVPR 2012 Review Seminar - Multi-View Hair Capture using Orientation Fields
 
Action Genome: Action As Composition of Spatio Temporal Scene Graphs
Action Genome: Action As Composition of Spatio Temporal Scene GraphsAction Genome: Action As Composition of Spatio Temporal Scene Graphs
Action Genome: Action As Composition of Spatio Temporal Scene Graphs
 
NIAR_VRC_2010
NIAR_VRC_2010NIAR_VRC_2010
NIAR_VRC_2010
 
Collaborative Similarity Measure for Intra-Graph Clustering
Collaborative Similarity Measure for Intra-Graph ClusteringCollaborative Similarity Measure for Intra-Graph Clustering
Collaborative Similarity Measure for Intra-Graph Clustering
 
The Search for a New Visual Search Beyond Language - StampedeCon AI Summit 2017
The Search for a New Visual Search Beyond Language - StampedeCon AI Summit 2017The Search for a New Visual Search Beyond Language - StampedeCon AI Summit 2017
The Search for a New Visual Search Beyond Language - StampedeCon AI Summit 2017
 
Seaborn.pptx
Seaborn.pptxSeaborn.pptx
Seaborn.pptx
 
lecture_16_jiajun.pdf
lecture_16_jiajun.pdflecture_16_jiajun.pdf
lecture_16_jiajun.pdf
 
Semi-supervised concept detection by learning the structure of similarity graphs
Semi-supervised concept detection by learning the structure of similarity graphsSemi-supervised concept detection by learning the structure of similarity graphs
Semi-supervised concept detection by learning the structure of similarity graphs
 
Actors, a Unifying Pattern for Scalable Concurrency | C4 2006
Actors, a Unifying Pattern for Scalable Concurrency | C4 2006 Actors, a Unifying Pattern for Scalable Concurrency | C4 2006
Actors, a Unifying Pattern for Scalable Concurrency | C4 2006
 
Processing Large Graphs
Processing Large GraphsProcessing Large Graphs
Processing Large Graphs
 
Computer Vision Structure from motion
Computer Vision Structure from motionComputer Vision Structure from motion
Computer Vision Structure from motion
 
Computer Vision sfm
Computer Vision sfmComputer Vision sfm
Computer Vision sfm
 
Reyes
ReyesReyes
Reyes
 
187186134 5-geometric-modeling
187186134 5-geometric-modeling187186134 5-geometric-modeling
187186134 5-geometric-modeling
 
5 geometric-modeling-ppt-university-of-victoria
5 geometric-modeling-ppt-university-of-victoria5 geometric-modeling-ppt-university-of-victoria
5 geometric-modeling-ppt-university-of-victoria
 
5 geometric modeling
5 geometric modeling5 geometric modeling
5 geometric modeling
 
187186134 5-geometric-modeling
187186134 5-geometric-modeling187186134 5-geometric-modeling
187186134 5-geometric-modeling
 
Lecture 01 frank dellaert - 3 d reconstruction and mapping: a factor graph ...
Lecture 01   frank dellaert - 3 d reconstruction and mapping: a factor graph ...Lecture 01   frank dellaert - 3 d reconstruction and mapping: a factor graph ...
Lecture 01 frank dellaert - 3 d reconstruction and mapping: a factor graph ...
 
Enforcing Behavioral Constraints in Evolving Aspect-Oriented Programs
 Enforcing Behavioral Constraints in Evolving Aspect-Oriented Programs Enforcing Behavioral Constraints in Evolving Aspect-Oriented Programs
Enforcing Behavioral Constraints in Evolving Aspect-Oriented Programs
 

Kürzlich hochgeladen

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 

Kürzlich hochgeladen (20)

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 

Geometry Processingで学ぶSparse Matrix

  • 1. GEOMETRY PROCESSINGで学ぶ SPARSE MATRIX 2012/3/18 Tokyo.SciPy #3 齊藤 淳 Jun Saito @dukecyto
  • 2. 本日の概要 Laplacian Mesh Processingを通じて sparse matrix一般、scipy.sparseの理解を深める !! = ! − !L !
  • 3. Computer Graphics Animation (c) copyright 2008, Blender Foundation / www.bigbuckbunny.org
  • 4. Computer Graphics Animation Modeling Animation Rendering •  作る •  動かす •  絵にする
  • 5. SIGGRAPH 2011 Papers Categories Modeling Animation Rendering Images •  Understanding •  Capturing & •  Stochastic •  Drawing, Painting Shapes Modeling Humans Rendering & and Stylization •  Mapping & •  Facial Animation Visibility •  Tone Editing Warping Shapes •  Call Animal Control! •  Volumes & Photons •  By-Example Image •  Capturing •  Contact and •  Real-Time Synthesis Geometry and Constraints Rendering •  Image Processing Appearance •  Example-Based Hardware •  Video Resizing & •  Geometry Simulation •  Sampling & Noise Stabilization Processing •  Fluid Simulation •  Stereo & Disparity •  Discrete Differential •  Fast Simulation •  Interactive Image Geometry Editing •  Geometry •  Colorful Acquisition •  Surfaces •  Procedural & Interactive Modeling •  Fun With Shapes
  • 6. SIGGRAPH 2011 Papers Categories Modeling Animation Rendering Images •  Understanding •  Capturing & •  Stochastic •  Drawing, Painting Shapes Modeling Humans Rendering & and Stylization •  Mapping & •  Facial Animation Visibility •  Tone Editing Warping Shapes •  Call Animal Control! •  Volumes & Photons •  By-Example Image •  Capturing •  Contact and •  Real-Time Synthesis Geometry and Constraints Rendering •  Image Processing Appearance •  Example-Based Hardware •  Video Resizing & •  Geometry Simulation •  Sampling & Noise Stabilization Processing •  Fluid Simulation •  Stereo & Disparity •  Discrete Differential •  Fast Simulation •  Interactive Image Geometry Editing •  Geometry •  Colorful Acquisition •  Surfaces •  Procedural & Interactive Modeling •  Fun With Shapes
  • 7. Geometry Processingとは Geometry processing, or mesh processing, is a fast-growing area of research that uses concepts from applied mathematics, computer science and engineering to design efficient algorithms for the ¨  acquisition ¨  reconstruction ¨  analysis ¨  manipulation ¨  simulation ¨  transmission of complex 3D models. http://en.wikipedia.org/wiki/Geometry_processing
  • 9. Differential Coordinates ¨  形状の局所的な特徴 ¤  方向は法線、大きさは平均曲率の近似 γ 1 1 δi = ∑ ( vi − v ) ∫γ ( vi − v ) ds di v∈N ( i ) len(γ ) v∈ Discrete Laplace-Beltrami operator Continuous Laplace-Beltrami operator [Sorkine 2005]
  • 10. Discrete Laplace Operator “Majority of Applications contemporary geometry processing tools rely on Mesh Parameterization discrete Laplace Fairing / Smoothing operators” Denoising [Alexa 2011] Manipulation / Editing Compression Shape Analysis Physical Simulation
  • 12. Graph Laplacian (a.k.a. Uniform Laplacian, Topological Laplacian) http://en.wikipedia.org/wiki/Laplacian_matrix
  • 13. Cotan-Weighted Laplacian 緑: Graph Laplacian 赤: Cotan-Weighted Laplacian 1 1 !!! = cot !!" + cot !!" (!! − !! ) 4!(!! ) 2 !∈! ! [Sorkine 2005]
  • 14. Stanford 3D Scan Repository ¨  Stanford Bunny ¤  頂点数: 35,947 ¤  35,947 x 35,947 = 1.2 G
  • 15. Stanford 3D Scan Repository ¨  Dragon ¤  頂点数: 566,098 ¤  566,098 x 566,098 = 298G
  • 16. 疎行列 Sparse Matrix 成分のほとんどがゼロである ことを活用した形式で行列を 記憶・演算 “Sparse matrices are widely used in scientific computation, especially in large-scale optimization, structural and circuit analysis, computational fluid dynamics, and, generally, the numerical solution of partial differential equations.” Sparse Matrices in MATLAB: Design and Implementation
  • 17. 疎行列 Sparse Matrix 成分のほとんどがゼロである ことを活用した形式で行列を 記憶・演算 Laplacian Matrixは ¨  sparse ¨  symmetric ¨  positive semi-definite
  • 18. Python Sparse Matrix Packages SciPy Sparse PySparse CVXOPT
  • 19. Python Sparse Matrix Packages SciPy Sparse PySparse CVXOPT
  • 20. From OpenOpt doc... “Unfortunately, sparse matrices still remains one of most weak features in Python usage for scientific purposes”
  • 21. From OpenOpt doc... “Unlike MATLAB, Octave, and a number of other software, there is not standard Python library for sparse matrices: someone uses scipy.sparse, someone PySparse, someone (as CVXOPT) uses its own library and/or BLAS, someone just uses 3 columns (for the number indexes and value). SciPy developers refused to author of scipy.sparse to include it into NumPy, I think it's a big mistake, probably now it would been a unified standard. Still I hope in future numpy versions difference in API for handling sparse and dense arrays will be removed. “
  • 22. 基本的な流れ 構築に適した形 演算に適した形式 式で行列を作る に変換し演算を行う A = lil_matrix((N,N))! A = A.tocsr()! A[i,j] = a! A = A.dot(D)! ! f = factorized(A)! x = f.solve(b)!
  • 23. Graph Laplacian (a.k.a. Uniform Laplacian, Topological Laplacian) http://en.wikipedia.org/wiki/Laplacian_matrix
  • 24. Graph Laplacian in scipy.sparse from scipy import sparse! ! N = len(points)! L = sparse.lil_matrix((N, N))! for vids in faces:! L[vids, vids] = 1! D = sparse.spdiags(L.sum(axis=0), 0, N, N)! L = L.tocsc()-D!
  • 25. Graph Laplacian in scipy.sparse from scipy import sparse! ! N = len(points)! L = sparse.lil_matrix((N, N))! for vids in faces:! L[vids, vids] = 1! D = sparse.spdiags(L.sum(axis=0), 0, N, N)! L = L.tocsc()-D!
  • 26. points and faces from Maya ! import numpy as np! import pymel.core as pm! ! mesh = pm.PyNode(‘bunny’)! points = np.array(mesh.getPoints())! faces = np.array(mesh.getVertices()! ! ! [1]).reshape(mesh.numFaces(),3)!
  • 27. Graph Laplacian in scipy.sparse from scipy import sparse! ! N = len(points)! L = sparse.lil_matrix((N, N))! for vids in faces:! L[vids, vids] = 1! D = sparse.spdiags(L.sum(axis=0), 0, N, N)! L = L.tocsc()-D!
  • 28. Sparse Matrix Storage Formats 構築に適した形式 演算に適した形式 ¨  LIst of Lists ¨  Compressed Sparse (LIL) Row (CSR) ¨  Compressed Sparse ¨  COOrdinate lists (COO) Column (CSC) ¨  Block Sparse Row ¨  Dictionary Of Keys (BSR) (DOK) ¨  DIAgonal (DIA)
  • 29. sparse.lil_matrix LIst of Lists (LIL) 形式 ¨  データ構造 ¨  利点 ¤  行毎に非ゼロ要素の ¤  柔軟なslice ソートされた列インデッ ¤  他のmatrix形式への変 クスを保持するarray 換が速い ¤  対応する非ゼロ要素の ¨  欠点 値も同様に保持 ¤  LIL+ LIL が遅い (CSR/ ¨  用途 CSC推奨) ¤  行列の構築用 ¤  column slicingが遅い ¤  巨大な行列を構築する (CSC推奨) 際にはCOOも検討する ¤  行列ベクトル積が遅い と良い (CSR/CSC推奨)
  • 30. sparse.csr_matrix Compressed Sparse Rows (CSR)形式 ¨  CSC: 行と列が逆 ¨  利点 ¨  データ構造 ¤  高速な演算 CSR + CSR, CSR * CSR,等. ¤  Row slicingが速い ¤  行列ベクトル積が速い ¨  欠点 ¤  Column slicingが遅い A = [1 2 3 1 2 2 1] 非ゼロ要素リスト! (CSC推奨) (IA = [1 1 1 2 3 3 4] i行)! IA' = [1 4 5 7] ! ¤  他のmatrix形式への変 JA = [1 2 3 4 1 4 4] j列! 換が遅い (そうでもない?後述ベンチマーク参照) A, IA’, JAを保持 http://ja.wikipedia.org/wiki/%E7%96%8E%E8%A1%8C%E5%88%97
  • 31. sparse.dia_matrix DIAgonal (DIA)形式 ¨  帯行列に適した形式 ¨  オフセットを指定可能 >>> data = array([[1,2,3,4]]).repeat(3,axis=0)! >>> offsets = array([0,-1,2])! >>> dia_matrix( (data,offsets), shape=(4,4)).todense()! matrix([[1, 0, 3, 0],! [1, 2, 0, 4],! [0, 2, 3, 0],! [0, 0, 3, 4]])!
  • 32. Sparse Matrix Format Benchmark: Construction Benchmark by modified bench_sparse.py in SciPy distribution
  • 33. Sparse Matrix Format Benchmark: Conversion Benchmark by modified bench_sparse.py in SciPy distribution
  • 34. Sparse Matrix Format Benchmark: Matrix Vector Product Benchmark by modified bench_sparse.py in SciPy distribution
  • 35. Graph Laplacian in scipy.sparse from scipy import sparse! ! N = len(points)! L = sparse.lil_matrix((N, N))! for vids in faces:! L[vids, vids] = 1! D = sparse.spdiags(L.sum(axis=0), 0, N, N)! L = L.tocsc()-D!
  • 36. Fancy indexingの仕様の違い sparse.lil_matrix numpy.array >>> L = sparse.lil_matrix((N,N))! >>> Ldense = np.zeros((N,N))! >>> ix = [1,3,4]! >>> ix = [1,3,4]! >>> L[ix,ix] = 1! >>> Ldense[ix,ix] = 1! >>> L.todense()! >>> Ldense! matrix([[ 0., 0., 0., 0., 0.],! array([[ 0., 0., 0., 0., 0.],! [ 0., 1., 0., 1., 1.],! [ 0., 1., 0., 0., 0.],! [ 0., 0., 0., 0., 0.],! [ 0., 0., 0., 0., 0.],! [ 0., 1., 0., 1., 1.],! [ 0., 0., 0., 1., 0.],! [ 0., 1., 0., 1., 1.]])! [ 0., 0., 0., 0., 1.]])!
  • 37. 補足: numpy.ix_() >>> Ldense = np.zeros((N,N))! >>> ix = [1,3,4]! >>> Ldense[np.ix_(ix,ix)] = 1! >>> Ldense! array([[ 0., 0., 0., 0., 0.],! [ 0., 1., 0., 1., 1.],! [ 0., 0., 0., 0., 0.],! [ 0., 1., 0., 1., 1.],! [ 0., 1., 0., 1., 1.]])!
  • 38. Graph Laplacian in scipy.sparse from scipy import sparse! ! N = len(points)! L = sparse.lil_matrix((N, N))! for vids in faces:! L[vids, vids] = 1! D = sparse.spdiags(L.sum(axis=0), 0, N, N)! L = L.tocsc()-D!
  • 39. 細かい演算の仕様 ! # LがCSC,CSRだとNotImplementedError! L -= D! ! # OK! L = L-D!
  • 40. Laplacian Mesh Fairing ! ! = ! − !L ! A Signal Processing Approach To Fair Surface Design [Taubin 95]
  • 41. Mesh Fairing in scipy.sparse from scipy.sparse import linalg as spla! ! A = sparse.identity(L.shape[0]) - _lambda * L! solve = spla.factorized(A.tocsc())! x = solve(points[:,0])! y = solve(points[:,1])! z = solve(points[:,2])! new_points = np.array([x, y, z]).T! ! # Set result back to Maya mesh! mesh.setPoints(new_points)!
  • 42. Mesh Fairing in scipy.sparse from scipy.sparse import linalg as spla! ! A = sparse.identity(L.shape[0]) - _lambda * L! solve = spla.factorized(A.tocsc())! x = solve(points[:,0])! y = solve(points[:,1])! z = solve(points[:,2])! new_points = np.array([x, y, z]).T! ! # Set result back to Maya mesh! mesh.setPoints(new_points)!
  • 43. Solving sparse linear system ¨  sparse.linalg.factorized(A) ¤  AのLU分解結果を保持したlinear system solver関数を 返す ¤  AはCSC形式で渡す必要がある SparseEfficiencyWarning: splu requires CSC matrix format
  • 44. Mesh Fairing in scipy.sparse from scipy.sparse import linalg as spla! ! A = sparse.identity(L.shape[0]) - _lambda * L! solve = spla.factorized(A.tocsc())! x = solve(points[:,0])! y = solve(points[:,1])! z = solve(points[:,2])! new_points = np.array([x, y, z]).T! ! # Set result back to Maya mesh! mesh.setPoints(new_points)!
  • 45. Solving sparse linear system # Error! 右辺はベクトルのみ! new_points = solve(points)! ! # 仕方がないので一列ずつ! x = solve(points[:,0])! y = solve(points[:,1])! z = solve(points[:,2])! new_points = np.array([x, y, z]).T!
  • 46. Cotan-Weighted Laplacian 緑: Graph Laplacian 赤: Cotan-Weighted Laplacian 1 1 !!! = cot !!" + cot !!" (!! − !! ) 4!(!! ) 2 !∈! ! [Sorkine 2005]
  • 47. Cotan Laplacian in scipy.sparse (1/2) def laplacian_cotan(points, faces):! EDGE_LOOP = [(0,1,2),(0,2,1),(1,2,0)]! N = len(points)! point_area = np.zeros(N)! L = sparse.lil_matrix((N, N))! for vids in faces:! point_area[vids] += area_triangle(points[vids]) / 3.0! for i in EDGE_LOOP:! v0 = vids[i[0]]! v1 = vids[i[1]]! v2 = vids[i[2]]! e1 = points[v1] - points[v2]! e2 = points[v0] - points[v2]!
  • 48. Cotan Laplacian in scipy.sparse (2/2) cosa = np.dot(e1, e2) / math.sqrt(np.dot(e1, e1) * np.dot(e2, e2))! sina = math.sqrt(1 - cosa * cosa)! cota = cosa / sina! w = 0.5 * cota! L[v0, v0] -= w! L[v0, v1] += w! L[v1, v1] -= w! L[v1, v0] += w! D = sparse.spdiags(0.25/point_area, 0, N, N)! return D.dot(L.tocsc())!
  • 49. Cotan Laplacian in scipy.sparse (2/2) cosa = np.dot(e1, e2) / math.sqrt(np.dot(e1, e1) * np.dot(e2, e2))! sina = math.sqrt(1 - cosa * cosa)! cota = cosa / sina! w = 0.5 * cota! L[v0, v0] -= w! L[v0, v1] += w! L[v1, v1] -= w! L[v1, v0] += w! D = sparse.spdiags(0.25/point_area, 0, N, N)! return D.dot(L.tocsc())!
  • 51. Laplacian Matrix構築 Cythonによる高速化 ¨  Python: 2.6秒 ¨  Cython: 1.8秒 ¨  Cython + Dense: 0.8秒! ¤ あまり大きくないMeshならばDenseで Laplacianを作った方が速い
  • 52. ファイル入出力 ¨  numpy.savetxt() >>> io.savemat('sparsetest.mat', {'lil': L.tolil(), ¤  Sparse Matrixでは使えない 'csr': L.tocsr()}, oned_as='row') ¨  scipy.io.savemat() / >>> M = io.loadmat(‘sparsetest.mat') loadmat() >>> M['lil'] ¤  MATLAB .mat形式で保存 <5x5 sparse matrix of type '<type 'numpy.float64'>' ¤  Sparse Matrixは強制的に CSCで保存される with 9 stored elements in Compressed Sparse Column format> >>> M['csr'] <5x5 sparse matrix of type '<type 'numpy.float64'>' with 9 stored elements in Compressed Sparse Column format>
  • 53. MATLAB vs. SciPy – Sparse Matrices MATLAB SciPy Sparse ¨  sparse()で行列を作る ¨  内部形式(denseも含 だけ! め)を意識して使う ¨  後の演算はdenseと全 ¨  形式によって同じ演 く同じ 算、関数が使えない ¨  内部形式はCSC ケースがある
  • 54. まとめ ¨  Sparse matrix一般 ¤  よく使われるデータ構造を理解した ¨  scipy.sparse ¤  使い方の基本がわかった ¤  いいところ n  やりたいことはできる。実用可能。 n  Mesh Processingが省メモリで計算可能。〜1000倍のオーダーで 速くなる。 ¤  悪いところ n  ドキュメントされていない仕様が多過ぎ。 n  ndarrayと透過的に使えるようにしてください L ¨  Laplacian Mesh Processingはおもしろいですよ J
  • 55. Future Work ¨  scipy.sparse.linalg の調査 ¤  Iterative sparse linear system solver系 ¨  Mesh Processingのもうちょっと深いネタを紹介
  • 56. Further Readings [Sorkine 2005] Sorkine, Olga. “Laplacian Mesh Processing” Eurographics 2005 http://igl.ethz.ch/projects/Laplacian-mesh-processing/STAR/STAR-Laplacian-mesh-processing.pdf ¤  Mesh Laplacianの基礎と応用に関するまとめ
  • 57. Further Readings Levy, Bruno and Zhang, Hao. “Spectral Mesh Processing” ACM SIGGRAPH 2010 http://alice.loria.fr/WIKI/index.php/Graphite/SpectralMeshProcessing ¤  Laplacianの特異値分解を用いてMeshの周波数解析
  • 58. Further Readings [Alexa 2011] Alexa, Marc and Wardetzky, Max. “Discrete Laplacians on General Polygonal Meshes” ACM SIGGRAPH 2011 http://cybertron.cg.tu-berlin.de/polymesh/ (ソースコード有) ¤  Discrete Laplacianを一般的なポリゴンメッシュに対し定義