Code Monkey home page Code Monkey logo

segment-then-segment's Introduction

Segment-then-segment: Context-Preserving Crop-Based Segmentation for Large Biomedical Images

The code repository for the paper:

Benčević, Marin, Yuming Qiu, Irena Galić, and Aleksandra Pizurica. 2023. "Segment-then-Segment: Context-Preserving Crop-Based Segmentation for Large Biomedical Images" Sensors 23, no. 2: 633. https://doi.org/10.3390/s23020633 https://www.mdpi.com/1424-8220/23/2/633

BibTeX:

@Article{bencevic2023,
AUTHOR = {Benčević, Marin and Qiu, Yuming and Galić, Irena and Pizurica, Aleksandra},
TITLE = {Segment-then-Segment: Context-Preserving Crop-Based Segmentation for Large Biomedical Images},
JOURNAL = {Sensors},
VOLUME = {23},
YEAR = {2023},
NUMBER = {2},
ARTICLE-NUMBER = {633},
URL = {https://www.mdpi.com/1424-8220/23/2/633},
ISSN = {1424-8220},
DOI = {10.3390/s23020633}
}

Requirements:

  • Python 3.8
  • PyTorch 1.10
  • PyTorch Lightning 1.4.9
  • Check environment.yml for more packages.

Usage

Training

Use the following script for training:

python train.py -h

To reproduce all of the experiments in the paper, use:

python train_all.py

This script is also useful to train your own experiments if needed.

Testing

The testing script requires both a model trained on cropped and uncropped images, and will evaluate both of them, using the uncropped model as rough segmentation.

python test_model_crops.py -h

If, instead, you would like to only test one of the models use:

python test.py -h

If you use the --cropped option the model will use ground-truth ideal crops. This can be seen as a best-case measure, or as a proxy result for using manual bounding boxes.

To reproduce all of the experiments in the paper, use:

python test_all.py

Datasets

hist - Kaggle 2018 Data Science Bowl / BBBC038v1

We used image set BBBC038v1, available from the Broad Bioimage Benchmark Collection (Caicedo et al., Nature Methods, 2019).

Download the stage1_train.zip and uncrompress it inside the data folder as follows:

data/
  hist/
    dsb2018/
      stage1_train/
        0a7.../
        0ac.../
        ...

Then run python split_dsb18_dataset.py to prepare the dataset.

polyp - Kvasir-SEG

Jha, D. et al. (2020). Kvasir-SEG: A Segmented Polyp Dataset. In: MultiMedia Modeling. MMM 2020. Lecture Notes in Computer Science, vol 11962. Springer, Cham. https://doi.org/10.1007/978-3-030-37734-2_37

Download link: https://datasets.simula.no/kvasir-seg/

Download kvasir-seg.zip and uncrompress it to make the following folder structurre:

data/
  polyp/
    Kvasir-SEG/
      images/
      masks/

Then run python split_polyp_dataset.py to prepare the dataset.

aa - AVT

Radl, L., Jin, Y., Pepe, A., Li, J., Gsaxner, C., Zhao, F., & Egger, J. (2022). AVT: Multicenter aortic vessel tree CTA dataset collection with ground truth segmentation masks. In Data in Brief (Vol. 40, p. 107801). Elsevier BV. https://doi.org/10.1016/j.dib.2022.107801

The dataset needs to added to the project in the form of the following folder structure (note that we have flattened the original directory structure):

data/
  aorta/
    data/
      avt/
        D1.nrrd
        D1.seg.nrrd
        ...

Then run python split_aa_dataset.py to prepare the dataset.

segment-then-segment's People

Contributors

marinbenc avatar

Watchers

 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.