Other applications of dictionary learning

Overview

Implemented some of the other applications in Chapter 15 of Sparse Modeling.

notebook ch15-02.ipynb ch15-04.ipynb ch15-05.ipynb

result

_ K-SVD Separation of line art and texture by local morphological component analysis (MCA) using a dictionary _ local_mca.png

_ Interpolate missing pixels with local inpainting with redundant DCT dictionary_ Peppers_recon.png

The numbers are [Peak signal to noise ratio (PSNR)](https://ja.wikipedia.org/wiki/Peak signal to noise ratio)

_ K-Interpolate missing pixels with local inpainting with SVD dictionary_ Peppers_recon_KSVD.png

Removal of impulse noise Peppers_inpulse_recon.png

Method

Local MCA with K-SVD dictionary

White noise with a standard deviation of 10 was added to Barbara as a test image. barbara_sig10.png

I learned a dictionary with K-SVD. The patch size is $ 8 \ times 8 $. The number of atoms was set to 256. The stop conditions for orthogonal matching pursuit (OMP) were set to the number of atoms $ k_ {0} = 4 $ and the tolerance $ \ epsilon = 8 ^ {2} \ times 20 ^ {2} $. The number of repetitions of K-SVD was set to 25.

The total number of patches extracted from the image was 255,025. Due to lack of memory, the number of patches used for one iteration of K-SVD was reduced to 1/10. The patches used for K-SVD were randomly extracted every iteration.

K-SVD dictionary A_KSVD_sig10.png

The activity of atom was calculated as follows. $ Activity(\mathbf{a}) = \Sigma_{i=2}^{n} \Sigma_{j=1}^{n} |a[i, j] - a[i-1, j]| + \Sigma_{i=1}^{n} \Sigma_{j=2}^{n} |a[i, j] - a[i, j-1]| $The maximum value of activity was standardized to 1. Atoms with high activity are textures, and atoms with low activity are line art atoms.

Atom activity (0 for black, 1 for white) activity.png Atoms with activity less than 0.3 were line art, and the others were textures. activity_threshold.png Dark gray is a line art atom, and light gray is a texture atom.

The line art image can be obtained from the line art atom and the coefficient of its sparse expression. The image of the texture can be obtained from the atom of the texture and the coefficient of its sparse expression.

Image impainting and impulse noise removal

Added white noise with a standard deviation of 20 to Peppers. 25%, 50%, and 75% pixels were randomly cleared to 0 and used as a test image. The position of the missing pixel was known. Peppers_inpaint.png

Local inpainting with redundant DCT dictionary

The patch size is $ 8 \ times 8 $. The number of atoms was set to 256. Modified OMP to mask missing pixels and find sparse representation. The OMP stop conditions are $ k_ {0} = 4 $ and $ \ epsilon = (8 ^ {2} -p) \ times 20 ^ {2} \ times 1.1 $. $ p $ is the number of missing pixels in the patch. Images can be restored from the desired sparse representation.

Local inpainting with K-SVD dictionary

The K-SVD was modified as follows.

  1. The OMP was modified to mask the missing pixels and a sparse representation was sought. The OMP stop condition was the same as for local inpainting with a redundant DCT dictionary.
  2. After interpolating the missing pixels using the above sparse representation, the atom and sparse representations were updated with K-SVD.
  3. Repeated 2 and 3.

The initial value of K-SVD was a redundant DCT dictionary. The number of repetitions was 15. 12,800 randomly selected patches were used for one iteration of K-SVD.

K-SVD dictionary obtained from images with 25% loss A_KSVD_25.png

K-SVD dictionary obtained from images with 50% loss A_KSVD_50.png

K-SVD dictionary obtained from images with 75% missing A_KSVD_75.png

Impulse noise removal

The pixel value of 10% of the pixels was randomly increased by +50 or -50 to obtain a test image. The pixel value was clipped to a maximum of 255 and a minimum of 0. The difference from inpainting is that the position of the missing pixel is not known.

Peppers_inpulse.png

Impulse noise was removed with a median filter. The median filter kernel size is $ 3 \ times 3 $. Pixels in which the absolute value of the difference between the noisy image and the image denoised by the median filter was greater than 27 were defined as pixels contaminated with impulse noise.

mask_median.png

PSNR was improved by applying a median filter only to the pixels detected by the estimation mask. The same was true for OMP denoising with a redundant DCT dictionary. The patch size for OMP noise removal by the redundant DCT dictionary is $ 8 \ times 8 $, the number of atoms is 256, and the OMP stop condition is $ k_ {0} = 256 $, $ \ epsilon = (8 ^ {2} -p) \ times 5 ^ {2} \ times 1.1 $.

Unimplemented application

Summary

reference

text.jpg

Recommended Posts

Other applications of dictionary learning
Dictionary learning algorithm
Deep learning 1 Practice of deep learning
Dictionary of keyword arguments
Basics of Machine Learning (Notes)
Reinforcement learning 2 Installation of chainerrl
Deep running 2 Tuning of deep learning
Supervised learning 1 Basics of supervised learning (classification)
Importance of machine learning datasets
1st month of programming learning
Deep reinforcement learning 2 Implementation of reinforcement learning
Significance of machine learning and mini-batch learning
Expansion by argument of python dictionary
Python: Application of supervised learning (regression)
Machine learning ③ Summary of decision tree
Basic grammar of Python3 system (dictionary)
A Tour of Go Learning Summary
Learning history of programming transcendence beginners
Impressions of people with experience in other languages learning Python using PyQ