PathINR: An Efficient and Differentiable Implicit Representation for Gigapixel Pathological Images in Artificial Intelligence
Official code for PathINR, an Implicit Neural Representation method for flexible, differentiable and parallel reconstruction in computational pathology. PathINR supports the multi-resolution hash grid from InstantNGP.
This repository is built on Kaolin Wisp and its extension for compression SHACIRA.
- Clone
git clone https://github.com/Bcai0797/PathINR.git
cd PathINR- Setup environment
conda create -n "pathinr" python=3.9.5
conda activate pathinr- Install Pytorch packages along with Kaolin Wisp packages
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
pip install kaolin==0.13.0 -f https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-1.12.1_cu113.htmlSee installation instructions of Kaolin Wisp for more details.
- Build and install other dependencies as well as CUDA kernels for grid interpolation
pip install -r requirements.txt
pip install -r requirements_app.txt
python setup.py developWe use dataset CAMELYON17 for evaluation and put data under the folder data.
The scripts for training and testing PathINR are contained under the folder eval.
eval/batch_inr.sh: training PathINR.eval/batch_inr_eval.sh: PSNR evaluation.eval/batch_inr_crop.sh: sampling tile / patch.eval/batch_inr_inversion_adam.sh: model inversion and gradient calculation.eval/eval_grd: gradient visualization.