Skip to content

CrisSherban/sppo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

164 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sppo

Single-Pixel Pattern Optimisation for learning measurement patterns in single-pixel imaging, with a focus on biomedical reconstruction workflows.

Single-pixel Imaging in a nutshell

spi.mp4

Install (Conda or Mamba)

This project ships an environment file: environment.yml.
First, clone the repository and navigate to the project directory:

git clone https://github.com/CrisSherban/sppo
cd sppo

Then create the environment and activate it using either Conda or Mamba:

conda env create -f environment.yml
conda activate sppo

Quick start

Show training CLI options:

python sppo/bilevel_patterns.py --help

Run a small training example:

python sppo/bilevel_patterns.py --n_epochs 1 --train_size 100 --batch_size 16 --num_patterns 64

Bilevel learning formulation

The pattern-learning procedure is written as the bilevel program:

$$\min_{Z\in\mathbb{R}^{M\times N},\;\alpha>0} \left\{F(Z,\alpha)=\sum_{i=1}^{n}\mathcal{L}\!\left(x^{(i)},\hat{x}(sign(Z),\alpha; y^{(i)})\right)\right\},$$

subject to

$$\hat{x}(A,\alpha; y)\in\arg\min_{x\in\mathbb{R}^{N}} \frac{1}{2}\lVert Ax-y\rVert_2^2+\alpha J(x).$$

In this repository:

  • $sign(Z)$ gives binary sensing patterns from the learnable real-valued matrix $Z$.
  • $\alpha$ is the regularisation weight in the reconstruction objective.
  • $J(x)$ is the image regulariser (for example TDV in the provided experiments).
  • The lower-level argmin is solved approximately with a finite iterative solver (e.g. nmAPG), and gradients are propagated through that approximation (with STE for the sign operation).

Results

Performance Overall

Releases

No releases published

Packages

 
 
 

Contributors