Skip to content
forked from PKU-HMI/INIF

[Nature Computational Science] Official code for Implicit Neural Image Field for Biological Microscopy Image Compression

License

Notifications You must be signed in to change notification settings

RoyZry98/INIF-Pytorch

 
 

Repository files navigation

Implicit Neural Image Field for Biological Microscopy Image Compression

Python 3.10 arXiv

System Requirements

Operating System

Note

Currently only Linux System is supported.

Dependencies

Framework
  • jax==0.4.26[cuda12_pip]
  • tensorflow==2.8.4 (Nvidia-GPU version)
pip
  • dm-haiku
  • learned optimizer (lopt)
  • optax
  • ipywidgets
  • tifffile
  • opencv-python
  • matplotlib
  • pandas
  • learned-optimization

Installation

From source:

  1. clone this repository:
    git clone https://github.com/daviddaiiiii/INIF.git
  2. Create the conda environment and activate:
    conda deactivate
    conda create -n INIF python=3.10
    conda activate INIF
  3. Run the setup.sh file to install automatically:
    chmod +x setup.sh
    ./setup.sh
    These codes would:
    1. Give the script execution permissions
    2. Install the dependencies via pip

Tip

In case of issues when downloading the weight of learned optimizers automatically from Google Cloud, below are some workaround:

Some workaround:
  1. We provide the default weight and continue trained weight in '../INIF/Learned_optimizer_weight'

  2. go to '../anaconda3/envs/INIF/lib/pythonX.XX/site-packages/learned_optimization/research/general_lopt/pretrained_optimizers.py'

    💡 ctrl+click on 'from learned_optimization.research.general_lopt import pretrained_optimizers' to jump to the file

  3. replace the path in line143 to '../INIF/Learned_optimizer_weight

    _pretrain_no_config_root = 'gs://gresearch/learned_optimization/pretrained_lopts/no_config/'

Docker:

  1. Install docker if you don't have it: get-docker

Important

To utilize GPU, nvidia-docker package is also required.

  1. retrieve the docker image from the dockerhub:

    docker pull pkuhmi/inif_env:latest
  2. start a container:

    docker run --gpus all -it --rm --shm-size 16G --ulimit memlock=-1 -v ./INIF:/INIF/ --name inif pkuhmi/inif_env:latest
    where:
    • --gpus: use the gpu
    • -it: interact with the container
    • --rm: remove the container after exit
    • --shm-size: set the shared memory size to avoid memory issues
    • --ulimit memlock=-1: remove mem lock limit
    • -v: mount the current directory to the container
    • --name: name the container

Tip

We recommend to use the VSCode Docker extension to attach the container to the VSCode workspace and run the tutorial.

Citation

Please cite our work if you find it useful.

@article{dai2024implicit,
  title={Implicit Neural Image Field for Biological Microscopy Image Compression},
  author={Dai, Gaole and Tseng, Cheng-Ching and Wuwu, Qingpo and Zhang, Rongyu and Wang, Shaokang and Lu, Ming and Huang, Tiejun and Zhou, Yu and Tuz, Ali Ata and Gunzer, Matthias and others},
  journal={arXiv preprint arXiv:2405.19012},
  year={2024}
}

Quick Start 🚀

We provide a google colab notebook that demonstrates how to use INIF for the general image compression: Open In Colab

You can also try it out locally by following the tutorial.

About

[Nature Computational Science] Official code for Implicit Neural Image Field for Biological Microscopy Image Compression

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 91.5%
  • Python 7.7%
  • Shell 0.8%