Git Product home page Git Product logo

calciumgan's Introduction

Synthesising Realistic Calcium Imaging Data of Neuronal Populations Using GAN

Implementation of CalciumGAN, used to obtain the results detailed in CalciumGAN: A Generative Adversarial Network Model for Synthesising Realistic Calcium Imaging Data of Neuronal Populations.

Citing this work

@article{li2020calciumgan,
  title={CalciumGAN: A Generative Adversarial Network Model for Synthesising Realistic Calcium Imaging Data of Neuronal Populations},
  author={Li, Bryan M and Amvrosiadis, Theoklitos and Rochefort, Nathalie and Onken, Arno},
  journal={arXiv preprint arXiv:2009.02707},
  year={2020}
}

Table of content

1. Installation

1.1 Requirements

  • It is recommended to install the codebase in a virtual environment, such as conda.

1.2 Quick install

  • Create a new conda environment in Python 3.6
    conda create -n calciumgan python=3.6
  • Activate calciumgan virtual environment
    conda activate calciumgan
  • Install all dependencies and packages with setup.sh script, works on both Linus and macOS.
    sh setup.sh

1.3 Manual setup

Install the following packages:

2. Dataset

  • Navigate to dataset
    cd dataset

2.1 Recorded Calcium Imaging Data

  • Place all raw calcium imaging data under dataset/raw_data
  • Apply OASIS to infer spike train
    python spike_train_inference.py --input_dir raw_data
  • Generate TFRecords from a specific pickle file --input, normalize the data, preform segmentation and store the TFrecords in output_dir. Use --help to see all available arguments.
    python generate_tfrecords.py --input raw_data/signals.pkl --output_dir tfrecords/sl2048 --sequence_length 2048 --normalize

2.2 Dichotomized Gaussian Artificial Data

  • Generate artificial spike trains and calcium-like signals from the Dichomotized Gaussian distribution with the mean and covariance of data in --input, save the the output pickle file to --output. TFRecords in --output_dir. Use --help to see all available arguments.
    python generate_dg_data.py --input raw_data/signals.pkl --output dg.pkl
  • Generate TFRecords from a specific pickle file --input, normalize the data, preform segmentation and store the TFrecords in output_dir. Use --help to see all available arguments.
    python generate_tfrecords.py --input dg.pkl --output_dir tfrecords/sl2048_dg --sequence_length 2048 --normalize

3. Train model

  • To train CalciumGAN on the recorded calcium imaging data with the default hyper-parameters for 400 epochs. Checkpoints, generated data, model training information are stored in --output_dir.
    python main.py --input_dir dataset/tfrecords/sl2048 --output_dir runs/001 --epochs 400 --batch_size 128 --model calciumgan --algoirthm wgan-gp --noise_dim 32 --num_units 64 --kernel_size 24 --strides 2 --m 10 --layer_norm --mixed_precision --save_generated last 
  • Use --help to check all available arguments. Mixed precision compute, TensorBoard profiling, hyper-parameter search are some of the features built into this codebase.
  • The training command applies to both recorded data and dischotomized Gaussian artificial data.

4. Spike analysis

4.1 Recorded Calcium Imaging Data

  • Deconvolve the calcium signals to spike trains from generated data in --output_dir, then compute various spikes statistics. Use --help to check all available arguments.
    python compute_metrics.py --output_dir runs/001
  • All the plots can be found in runs/001/metrics/plots

4.2 Dichotomized Gaussian Artificial Data

  • Deconvolve the calcium signals to spike trains from generated data in --output_dir, then compute various spikes statistics. Use --help to check all available arguments.
    python compute_dg_metrics.py --output_dir runs/002
  • PLots of mean and covariance can be found in diagrams/

5. Visualization and Profiling

  • Run tensorboard
    tensorboard --logdir runs/001
  • We have implemented profiling with TensorFlow Profiler support. You can enable profiling with --profile flag when training the model with main.py.

6. Hyper-parameters Search

  • We have incorporated the Hyperparameter Turning with Keras feature. Modify the hyper-parameters you would like to test in seasrch.py and run
    python search.py --input_dir dataset/tfrecords/sl2048 --output_dir runs/hparams_search --epochs 400 --mixed_precision

calciumgan's People

Contributors

bryanlimy avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

calciumgan's Issues

Request for an Example Input Data

Hi, Bryan. Thank you for releasing the code of your paper. But I found that the repo does not contain a copy of the reference data to start training. Could you please release an example of training data so that we can know the format of the input data and utilize your model for other research purposes?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.