1 / 36

向量量化編碼法 (Vector Quantization, VQ)

向量量化編碼法 (Vector Quantization, VQ). 靜宜大學資訊管理學系 胡育誠. 1. 向量量化編碼法. 向量量化編碼法 (vector quantization, VQ) 是由 Y. Linde, A. Buzo, and R. M. Gray 等學者於 1980 所提出。 基本概念 一張灰階影像切割成不重疊的影像區塊(向量) 利用一群具有代表性的影像區塊(編碼本)來編碼個別的影像區塊 基本定義 Q : R k  Y ,where Y is a finite subset of R k.

lee-gregory
Download Presentation

向量量化編碼法 (Vector Quantization, VQ)

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

E N D

Presentation Transcript


  1. 向量量化編碼法(Vector Quantization, VQ) 靜宜大學資訊管理學系 胡育誠

  2. 1. 向量量化編碼法 • 向量量化編碼法(vector quantization, VQ)是由Y. Linde, A. Buzo, and R. M. Gray 等學者於1980所提出。 • 基本概念 • 一張灰階影像切割成不重疊的影像區塊(向量) • 利用一群具有代表性的影像區塊(編碼本)來編碼個別的影像區塊 • 基本定義 Q : Rk  Y ,where Y is a finite subset of Rk.

  3. 1 向量量化編碼法 • 向量量化編碼法(vector quantization, VQ) • 編碼本設計程序(codebook design) • 影像編碼程序(image encoding) • 影像解碼程序(image decoding)

  4. X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X    X X X X    X X X X VQ 的壓縮與解壓縮程序 解壓縮後影像區塊 原始影像區塊 搜尋近似碼向量 表格 查詢 Channel 編號 index 編號 index 編碼本 codebook 編碼本 codebook

  5. VQ 的壓縮程序 編碼本 codebook 影像區塊x=(x1,x2,…,xk) d(x,y1) d(x,y2) … … d(x,yN) 原始影像 index of ymin

  6. 0 1 2 影像區塊 (21,44,45,78) 253 254 255 VQ 的壓縮程序的範例 • 找出每個影像區塊在編碼本(codebook)中的最近似碼向量 Codebook (12,14,13,16) (20,25,17,11) Index (24,45,47,76) 2 VQencoder (78,22,77,20) (33,32,97,98) (20,55,53,26)

  7. VQ 的壓縮程序 • 問題描述 • 假設編碼本的大小為Nc 且影像區塊的維度為k • 需計算Nc個歐基里德距離(squared Euclidean distance, SED)來找出個別區塊在編碼本中最近似的碼向量 • 所需的計算成本如下: Nc*(2k-1) 加法 Nc-1 比較, k* Nc乘法

  8. 向量量化編碼法 • 優點 • 所需位元率為(log2Nc /k)。位元率相當的低 • 具有簡單的解壓縮程序 • 缺點 • 編碼本小時,重建影像品質不佳 • 編碼本大時,位元率較高 • 編碼本設計&影像壓縮程序需要較多的計算成本

  9. 2. 設計編碼本 • 編碼本設計程序 • 設計出一群用來編碼/解碼的影像區塊,個別影像區塊又被稱為編碼字(codeword) • 設計出的編碼字必須具有代表性 • 從文獻資料得知,k-means叢聚演算法是最常被用來設計編碼本的方法,又被稱為LBG演算法 • 重複的執行下列兩個處理 • 歸類處理 • 重心計算處理

  10. 2.1 LBG 演算法 • Codebook generation 0 1 . . . N-1 N Training Images Training set Separating the images to vectors

  11. 2.1 LBG 演算法 • Codebook generation 0 1 . . . 0 1 . . . 254 255 N-1 N Initial codebook Training set Codebook initiation

  12. 2.1.1 歸類處理 • 歸類處理 • 找出每一個訓練區塊在編碼本中最近似的碼向量 • 最近似的碼向量是與給定的訓練影像區塊之歐基理德距離最小的碼向量 • An example: • The dimensionality of vector = k (= w*h) • An input vector x = (x1, x2, …, xk) • A codeword yi = (yi1, yi2, …, yik) • The Euclidean distance between x and yi

  13. Training set 0 1 . . . Index sets 0 1 . . . (1, 2, 5, 9, 45, …) (101, 179, 201, …) (8, 27, 38, 19, 200, …) 254 255 (23, 0, 67, 198, 224, …) Codebook Ci N-1 N

  14. 2.1.2 重心計算處理 • 重心計算處理 • 將歸類在相同一個編碼字的所有訓練影像區塊的重心算出 • 利用新算出的重心取代原本的編碼字 Index sets 0 1 . . . (1, 2, 5, 9, 45, …) (101, 179, 201, …) (8, 27, 38, 19, 200, …) 254 255 (23, 0, 67, 198, 224, …) Codebook Ci Codebook Ci+1

  15. 2.1.3 影像編碼範例 Example: Let the vector dimension equals 4. Let the codebook size nc equals 8. To encode an input vector, v = (150,145,121,130) (1) Compute the distance between v with all vectors in codebook d(v, cw1) = 114.2 d(v, cw2) = 188.3 d(v, cw3) = 112.3 d(v, cw4) = 124.6 d(v, cw5) = 122.3 d(v, cw6) = 235.1 d(v, cw7) = 152.5 d(v, cw8) = 63.2 (2) So, we choose cw8 to replace the input vector v. Codebook

  16. 2.1 LBG 演算法範例 • 一次訓練 256 個 codewords • 做了100次 • 連續兩次 MSE 之差別已經夠小

  17. 2.2 Full Search (FS) • For example: • Let the codebook size (Nc) be 256 • # of searched nodes • per image vector = 256 • Time consuming • The closest codeword Image vector C = {c1, c2, …, cNc}

  18. 3. 邊緣吻合向量量化法 • 邊緣吻合向量量化法 (side match VQ, SMVQ) • 利用編碼過的影像區塊的資訊預測目前編碼的影像區塊 • 動態產生一個適合編碼目前區塊的狀態編碼本(state codebook),用來編碼 • 可以降低所需的位元率

  19. 3. 邊緣吻合向量量化法 Main Idea: Neighbor pixels within an image are similar unless there is an edge across Side match for the the block X

  20. 3. 邊緣吻合向量量化法

  21. 3. 邊緣吻合向量量化法 Implementation of SMVQ Seed Block Residual Block

  22. 3. 邊緣吻合向量量化法 找出最接近 (x1,x2,x3,x4,x5,x,x,x,x9,x,x,x,x13,x,x,x) 的前 16 個codeword,組成 smaller codebook

  23. 3. 邊緣吻合向量量化法 • 解決Derailment(出軌) Problem Error =< TH 0010 Error > TH 10100010 計算原始圖的black vector與smaller codebook 的誤差 Error If Error =< Threshold,選擇 smaller codebook 的index If Error > Threshold,選擇 原始 codebook 的index

  24. 4. 樹狀結構向量量化編碼法 • 樹狀結構向量量化編碼法(tree-structured VQ, TSVQ) • 利用樹狀結構來組織碼向量 樹狀結構編碼本 • 可以降低傳統向量量化編碼法的編碼本搜尋時間

  25. 4. 樹狀結構向量量化編碼法 • 樹狀編碼本產生程序 • 利用二元樹來組織編碼本 • 利用n-ary樹來組織編碼本

  26. 樹狀結構編碼本產生的例子-訓練資料

  27. 樹狀結構編碼本產生的例子-第一步

  28. 樹狀結構編碼本產生的例子-第二步

  29. 樹狀結構編碼本產生的例子-第三步

  30. 樹狀結構編碼本產生的例子

  31. 4. 樹狀結構向量量化編碼法 • 編碼本搜尋程序 • 單一路徑(single path)搜尋法 • 多重路徑(multiple path)搜尋法

  32. 編碼本搜尋(單一路徑)

  33. 編碼本搜尋(兩個路徑)

  34. 樹狀結構向量量化編碼法 • 缺點: • 找到的碼向量不見得是編碼本中與輸入影像區塊最相似的碼向量

  35. 樹狀結構向量量化編碼法 • For example: • Let the codebook size • be 256 • # of searched nodes • per image vector = 4+4+…+4 = 4*(8-1)=28 • More efficient than FS • closer codeword than TSVQ The “closest” codeword? Or the closer codeword?

  36. 樹狀結構向量量化編碼法 • 多重路徑搜尋所搜尋的樹狀結構節點個數隨著路徑個數增加而增加 • 不保證搜尋到的碼向量是編碼本中與輸入影像區塊最相似的碼向量

More Related