Git Product home page Git Product logo

sampath's Introduction

SAM-Path: A Segment Anything Model for Semantic Segmentation in Digital Pathology

Pytorch implementation for the SAM-PAth framework described in the paper SAM-Path: A Segment Anything Model for Semantic Segmentation in Digital Pathology, arxiv and (MedAGI 2023, accepted for oral presentation).

The overview of our framework.

Installation

Install Anaconda/miniconda.
Install the dependencies of SAM. Please do not install the original SAM itself as we made some modifications.

Then Install required packages:

  $ pip install monai torchmetrics==0.11.4 pytorch_lightning==2.0.2 albumentations box wandb

Data organization

Our dataset is organized as csv indicated datasets. All the images and masks should be stored in a directory and the path of this directory (dataset_root) should be set in the config file. The root directory should contain two sub-directories img and mask. All the input images and masks should be directly put into these two sub-directories respectively. Our preprocessed dataset can be downloaded from: https://drive.google.com/drive/folders/1BUPZz3nB52J5zRs1ZcEvNK03zw18BeLN?usp=sharing

The file names and train/validation/test separation are listed in the csv file. This csv file should contain 2 columns: img_id and fold. img_id is the filename of input image without the file extension. fold is the integer label of an input image. -1 means it is a test sample. We use the fold=0 as the validation dataset and fold=1,2,3,4 as the training dataset. The csv files we used are provided in the dataset_cfg folder.

Training

We used train.py to train and evaluate our framework.

usage: main.py [--config CONFIG_PATH] [--devices GPU_ID]
               [--project PROJECT_NAME] [----name RUN_NAME]

For example:

python main.py --config configs.BCSS --devices 0 --project sampath --name bcss_run0
python main.py --config configs.CRAG --devices 1 --project sampath --name crag_run0

Config files are located in the configs folder. Not the extension .py should not be included and the sub-folders should be linked by . Pretrained SAM and HIPT models can be downloaded from their ogriginal repository: SAM and HIPT.

Contact

If you have any questions or concerns, feel free to report issues or directly contact us (Jingwei Zhang [email protected]).

Citation

If you use the code or results in your research, please use the following BibTeX entry.

@article{zhang2023sam,
  title={SAM-Path: A Segment Anything Model for Semantic Segmentation in Digital Pathology},
  author={Zhang, Jingwei and Ma, Ke and Kapse, Saarthak and Saltz, Joel and Vakalopoulou, Maria and Prasanna, Prateek and Samaras, Dimitris},
  journal={arXiv preprint arXiv:2307.09570},
  year={2023}
}

sampath's People

Contributors

jingweizhang-xyz avatar

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.