• Stars
    star
    124
  • Rank 288,207 (Top 6 %)
  • Language
    Jupyter Notebook
  • License
    Other
  • Created over 6 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

hybrid optical electronic convolutional neural networks

opticalCNN

Note 1: If you have a more up-to-date version of scipy, you may need to change the scipy.misc.imsave function to imageio.imwrite. Note 2: The Tensorflow fft2 function may also have changed in more recent updates, which has caused some differences in optimization results.

Our code was run with Python 3.5.5 and Tensorflow 1.4.0.

Example to optimize a single-layer optical correlator for QuickDraw-16:

  1. Download quickdraw-16 training dataset (see below) into assets folder
  2. onn_quickdraw-16-tiled.py: optimizes a single-layer tiled kernel PSF model for the quickdraw-16 dataset
  3. Walk through ONNMaskOpt.ipynb until the "Visualization of phase mask optimization" section. You can use the saved checkpoint folder we link below, or the checkpoint from running onn_quickdraw-16-tiled.py
  4. onn_maskopt.py: optimizes a phase mask to correspond to a pre-computed PSF. You can use the sample psf in the assets folder or use the one you save from the ONNMaskOpt.ipynb walkthrough
  5. Walk through ONNMaskOpt.ipynb from "Visualization of phase mask optimization" and plug in the checkpoint from onn_maskopt.py.

Example to optimize a hybrid two-layer CNN for CIFAR-10 (rough outline):

  1. Download the CIFAR-10 dataset.
  2. Train a network with hybrid_cifar10.py. There is much more code than necessary in this file from our experimenting. For similar conditions as in paper results, use: params['doTiledConv'] = False, params['doOpticalConv'] = False, params['doAmplitudeMask'] = False, params['doZernike'] = False, params['doFC'] = True, params['isNonNeg'] = True, params['doOptNeg'] = True, params['doNonnegReg'] = False
  3. Walk through the first sections of HybridNNMaskOpt.ipynb until "Extract optimized phase mask", making sure to save the tiled psf .npy file and training images for phase mask optimization. You'll need to change directories to suit your own needs.
  4. Optimize the phase mask for the weights of the learned convolutional kernels with hybrid_maskopt.py. Note that you can also run with the hybrid_maskopt.py phase mask optimization with the included file "assets/psf_hybrid_optneg_8x9_1e-1.npy"
  5. Fine tune the fully-connected layer with the learned phase mask (code not available).

Other code:

  • jupyter notebooks are useful for visualization, but in the current state they rely on files that may not be added yet
  • other scripts are added, but they are not completely demo-ready
  • the core code for hybrid two-layer networks have "hybrid" in the filename

Downloads:

Additional code used to interface with prototype hardware is available upon request.

Paper

Title: Hybrid optical-electronic convolutional neural networks with optimized diffractive optics for image classification

Authors: Julie Chang*, Vincent Sitzmann, Xiong Dun, Wolfgang Heidrich, and Gordon Wetzstein*

*Correspondence to: [email protected], [email protected]

Link to our paper: https://www.nature.com/articles/s41598-018-30619-y

Website

Link to our project page: http://www.computationalimaging.org/publications/hybrid-optical-electronic-convolutional-neural-networks/

Data

The original images used in all experiments were downloaded directly from MNIST, CIFAR-10, or Google QuickDraw source websites. The If you are interested in the CIFAR-10 dataset captured by our prototype, please send us an email.

More Repositories

1

ACORN

ACORN: Adaptive Coordinate Networks for Neural Scene Representation | SIGGRAPH 2021
Python
289
star
2

GSM

Gaussian Shell Maps for Efficient 3D Human Generation (CVPR 2024)
Jupyter Notebook
196
star
3

automatic-integration

Official repo for AutoInt: Automatic Integration for Fast Neural Volume Rendering in CVPR 2021
Python
179
star
4

bacon

Official respository for "Band-limited Coordinate Networks for Multiscale Scene Representation" | CVPR 2022
Python
173
star
5

neural-holography

Code and data for Neural Holography
Python
162
star
6

nlos-fk

Processing code for "Wave-Based Non-Line-of-Sight Imaging using Fast f-k Migration"
MATLAB
70
star
7

holographic-AR-glasses

Python
61
star
8

AcousticNLOS

Processing code for acoustic non-line-of-sight imaging
Python
56
star
9

DepthFromDefocusWithLearnedOptics

ICCP2021: Depth from Defocus with Learned Optics for Imaging and Occlusion-aware Depth Estimation
Python
54
star
10

DeepOpticsHDR

Code associated with the paper "Deep Optics for Single-shot High-dynamic-range Imaging"
Python
52
star
11

neural-3d-holography

Code and data for Neural 3D Holography | SIGGRAPH Asia 2021
Python
44
star
12

GraphPDE

Jupyter Notebook
43
star
13

confocal-diffuse-tomography

Code and data for "Three-dimensional imaging through scattering media based on confocal diffuse tomography"
Python
30
star
14

ThreeDeconv.jl

A convex 3D deconvolution algorithm for low photon count fluorescence imaging
Julia
30
star
15

partially_coherent_neural_holography

Python
26
star
16

KeyholeImaging

Code associated with the paper "Keyhole Imaging: Non-Line-of-Sight Imaging and Tracking of Moving Objects Along a Single Optical Path"
Python
24
star
17

olas

Overlap-Add Stereograms Source Code
MATLAB
20
star
18

nlos-dlct

Non-line-of-sight Surface Reconstruction Using the Directional LCT
MATLAB
19
star
19

time-multiplexed-neural-holography

Code and data for Time-multiplexed Neural Holography | SIGGRAPH 2022
Python
19
star
20

diffusion-in-the-dark

Repository for Diffusion in the Dark (WACV 2024)
Jupyter Notebook
17
star
21

single_spad_depth

Code for Disambiguating Monocular Depth Estimation with a Single Transient
Jupyter Notebook
11
star
22

spad_pileup

MATLAB
11
star
23

EE267-Spring2022

JavaScript
7
star
24

DeepS3PR

Code associated with the paper "Deep S3PR: Simultaneous Source Separation and Phase Retrieval Using Deep Generative Models"
Python
6
star
25

multishot-localization-microscopy

Python
4
star
26

spad_single

Jupyter Notebook
4
star
27

PixelRNN

Official Implementation of PixelRNN: In-Pixel Recurrent Neural Networks for End-to-end--optimized Perception with Neural Sensors
Python
2
star
28

EE267-Spring2024

A repository for the starter code of homework for EE267.
JavaScript
1
star