We provide the code that produces the results that we report in
Nicolas Ducros. Book title. Chapter Title. 2022 ⟨doi⟩. Download PDF.
Contact: [email protected], CREATIS Laboratory, University of Lyon, France.
- Install SPyRiT and all dependencies. On Windows, you need first to install torch first (see the SPyRiT installation guide).
pip install -e spyrit .
NB: The scripts were tested with the commit 0035901.
- Launch Spyder from the current folder
spyder
and run main_*.py
.
[optional] If you already have the STL-10 dataset on your computer, create a symbolic link. Otherwise the STL-10 dataset will be downloaded.
- Linux:
ln -s <stl-10 parent folder> /data/
- Windows Powershell:
New-Item -ItemType SymbolicLink -Name \data\ -Target <stl-10 parent folder>
Most of the scripts require a covariance matrix and mean image
-
Download and save them both in
./stats/
:https://www.creatis.insa-lyon.fr/~ducros/spyritexamples/2021_ISTE/Average_64x64.npy
https://www.creatis.insa-lyon.fr/~ducros/spyritexamples/2021_ISTE/Cov_64x64.npy
-
Or (alternative likely to take longer without GPU) compute them
from spyrit.misc.statistics import stat_walsh_stl10
stat_walsh_stl10()
You can download the networks from this url.
We also provide train.py
to train the different variants of the network, from a single command line.
-
Completion network
python train.py
-
Pseudo inverse network
python train.py --net_arch 2
-
Free network
python train.py --net_arch 3
Note that
- the models are saved in the default folder
.\models\
. To save them at another location consider
python train.py --model_root myfolder
- The defaults training parameters can be changed. For instance, run
python train.py --num_epochs 10 --batch_size 512 --lr 1e-8
to train your network for 10 epochs, with a batch size of 512, and a learning rate of 1e-8.
- you can keep
Average_64x64.npy
,Cov_64x64.npy
andVar_64x64.npy
in.\stats\
, to avoid re-computing them, which can be time-consuming.