bwohlberg / sporco

Sparse Optimisation Research Code
http://brendt.wohlberg.net/software/SPORCO/
BSD 3-Clause "New" or "Revised" License
258 stars 37 forks source link

How do I get sparse representation using dictionaries? #14

Closed ghostlyFeng closed 4 years ago

ghostlyFeng commented 4 years ago

I got some dictionaries representation with onlinecdl.OnlineConvBPDNDictLearn, but now i do not know how to get sparse representation use the dictionaries representation which was learned.

bwohlberg commented 4 years ago

Because the method is online, it doesn't store the coefficient maps for each training image. If you need the sparse representations you'll need to first learn the dictionary and then compute them using class sporco.admm.cbpdn.ConvBPDN or one of the other classes in module sporco.admm.cbpdn. If you don't specifically need to use the online CDL class, consider using one of the the batch CDL classes since they do allow you to access the coefficient maps computed during dictionary learning.

ghostlyFeng commented 4 years ago

D : dictonary S : image lmbda = 0.2 d = cbpdn.ConvBPDN(D, S, lmbda) x = d.solve() so x is sparse representation?

bwohlberg commented 4 years ago

Correct, except that you usually want S to be a highpass filtered version of the image rather than the image itself. See this example for details.