This repository contains the code that produces the results reported in
Antonio Lorente Mur, Pierre Leclerc, Françoise Peyrin, and Nicolas Ducros, "Single-pixel image reconstruction from experimental data using neural networks," Opt. Express 29, 17097-17110 (2021). DOI (open access).
Contact: [email protected], CREATIS Laboratory, University of Lyon, France.
Clone the repo and navigate to the folder that corresponds to this study
git clone https://github.com/openspyrit/spyrit-examples.git
cd ./spyrit-examples/2021_Optics_express/
This folder contains two scripts
- main.py: generates the figures in the paper (typically run in Spyder). It requires trained networks.
- train.py: can be used to train the reconstruction networks (typically run in a terminal).
Our scripts primarily relies on the SPyRiT package (tested with v1.1.2) that can be installed via pip
. We recommend creating a virtual (e.g., conda) environment first.
NB: On Windows, you need to install torch before SPyRiT.
# conda (or pip) install
conda create --name spyrit-env
conda activate spyrit-env
conda install -c anaconda spyder
conda install -c anaconda pip
# for windows only
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
# pip install
pip install spyrit # tested with spyrit==1.1.2
pip install pylops
We exploit some of the single-pixel raw acquisitions that constitute the SPIHIM dataset. The preprocessed data considered in the paper can be downloaded here. Unzip in ./spyrit-examples/2021_Optics_express/expe/
.
We provide the trained network here. Unzip in ./spyrit-examples/2021_Optics_express/model/
.
We provide train.py
to train several variants of networks, from a single command line. This includes
- DC-Net: Denoised Completion (Tikhonov) network
python train.py
- C-Net: Completion network (DC-Net with no denoising)
python train.py --no_denoi
- Free-Net. This is a C-Net where the completion layer is learnt (i.e., free during training)
python train.py --no_denoi --net_arch 3
- Noiseless-Net. This is a C-Net trained with no noise (i.e., infinite number of photons)
python train.py --no_denoi --intensity_max 'inf'
By default, all networks are trained for M = 512 measurements during 20 epochs. For other values, consider
python train.py --CR 1024 --num_epochs 100
To consider different noise levels, play with the maximum number of photons (default, 2500 photons). For instance
python train.py --intensity_max 50
We train our networks by simulating single-pixel measurements from the STL-10 image database. Running the above command lines will download the database.
[optional] If you already have the STL-10 on your computer, create a symbolic link.
- Linux: [CHECK]
ln -s <stl-10 parent folder> /data/
- Windows Powershell:
New-Item -ItemType SymbolicLink -Name \data\ -Target <stl-10 parent folder>