Julia code for the paper S. Gu, L. Zhang, W. Zuo, and X. Feng, “Projective Dictionary Pair Learning for Pattern Classification,” In NIPS 2014



previous DPL.jl

Build Status Coverage Status




using ProjectiveDictionaryPairLearning

The output should be something similar to this

The running time for DPL training is : 6.79 s
The running time for DPL testing is : 0.23 s
Recognition rate for DPL is : 97.579%

Comparison with MATLAB version

Actually the MATLAB version runs much faster as below.

The running time for DPL training is : 3.12 s
The running time for DPL testing is : 0.17 s
Recognition rate for DPL is : 0.976


Prepare Data and Labels

  • Training Data TrData: Column Vectors (Should be normalize!d)
  • Training Label TrLabel: Class Label Integers in A Row
  • Testing Data TtData: Column Vectors (Should also be normalize!d )
  • Testing Label TtLabel: Class Label Integers in A Row

Set Parameters

DictSize = 30
τ = 0.05
λ = 0.003
γ = 0.0001

DPL Training

DictMat, EncoderMat = TrainDPL(TrData, TrLabel, DictSize, τ, λ, γ)

DPL Testing

PredictLabel, Error, Distance = ClassificationDPL(TtData, DictMat, EncoderMat, DictSize)

Ref: dpldemo() in ProjectiveDictionaryPairLearning.jl

Advanced Usage

Inner functions have been exposed to use.

  • initialization.jl: DataMat, D, P, DataInvMat, A = initialization(Data, Label, DictSize, τ, λ, γ)
  • updateA!.jl: updateA!(A, D, DataMat, P, τ, DictSize)
  • updateD!.jl: updateD!(D, A, DataMat)
  • updateP!.jl: updateP!(P, A, DataInvMat, DataMat, τ)

Ref: TrainDPL.jl in ProjectiveDictionaryPairLearning.jl



The original matlab code is for the paper:

The julia port of this code is for the paper:

Qu, Xiaofeng; Zhang, David; Lu, Guangming; and Guo, Zhenhua, “Door knob hand recognition system,” Will appear in Systems, Man, and Cybernetics: Systems, IEEE Transactions on.

Authors' Pages



The example feature dataset (YaleB_Jiang) used in this code is from Dr. Zhuolin Jiang: http://www.umiacs.umd.edu/~zhuolin/projectlcksvd.html.

For the experiments on AR and caltech 101 dataset, we also used the feature datasets provided by Dr. Jiang.

For experiment on UCF50, we used the Action bank feature provided in: http://www.cse.buffalo.edu/~jcorso/r/actionbank/. Please refer to our paper for the detailed experimental setting.


If you have problems with the paper, the algorithm or the original matlab code, please contact us at shuhanggu@gmail.com or cslzhang@comp.polyu.edu.hk.

If you have problems with the julia code, please contact us at xiaofeng.qu.hk@ieee.org.


  • A thank you to afternone, who optimized the julia code


  • ~~Add test~~
  • NEW add more tests
  • ~~Optimize the performance~~
  • NEW optimize the performance further
  • ~~Proper packaging~~

First Commit


Last Touched

6 months ago


102 commits

Used By: