Git Product home page Git Product logo

synth-colon's Introduction

Synthetic data for unsupervised polyp segmentation

UPDATE

We release CUT-seg, a new model that is computationally less expensive, and requires less real images than CycleGAN. It is composed by a segmentation model and a generative model that are jointly trained to produce realistic images while learning to segment polyps. We take advantage of recent one-sided translation models because they use significantly less memory, allowing us to add a segmentation model in the training loop.


Source code used in the paper and generation of the Synth-Colon dataset.

Abstract

Deep learning has shown excellent performance in analysing medical images. However, datasets are hard to obtain due privacy issues, standardization problems, and lack of annotations. We address these problems by producing realistic synthetic images using a combination of 3D technologies and generative adversarial networks. We use zero annotations from medical professionals in our pipeline. Our fully unsupervised method achieves promising results on five real polyp segmentation datasets. As a part of this study we release Synth-Colon, an entirely synthetic dataset that includes 20.000 realistic colon images and additional details about depth and 3D geometry.

Setup

  • In order to run our code Docker, Docker-Compose and NVIDIA-Docker are required.

  • hardnet68.pth pre-trained weights for HarDNet68 can be found here. Change the weight path in lib/hardnet_68.py line 203 for loading the pretrain_weight

  • Required datasets can be found here: train, test. Edit docker/docker-compose.yml with the location of your data. It should have the following structure: polyp-data/{TrainDataset, TestDataset}

1. Starting the containers

First, run docker-compose up -d in the docker/ folder. It will start 3 containers with all the dependencies installed. This step can take up to 3 hours.

2. Synthetic images and annotations generation with Blender

In order to generate the dataset run: docker exec synth-polyp python ./synth/src/generate.py --name synth_polyp_V15 --size 8000

3. Produce realistic images with CycleGAN

  • Prepare data for CycleGAN(20 Kvasir images and 200 synthetc images): docker exec cyclegan python /cyclegan/cyclegan/prepare_cyclegan.py --name synth_polyp_V15 --synth-dataset /cyclegan/data/synth_polyp_V15 --real-dataset /polyp-data/TestDataset/Kvasir/images --train-size-real 20 --train-size-synth 400 --test-size 5

  • Train CycleGAN for 200 epochs: docker exec cyclegan python /cyclegan/cyclegan/train.py --dataroot /cyclegan/data/synth_polyp_V15/ --name synth_polyp_V15 --model cycle_gan --checkpoints_dir /cyclegan/data/synth_polyp_V15/checkpoints. It can day up to 12 hours.

  • Infer 200 images synthetic to CycleGAN: docker exec cyclegan python /cyclegan/cyclegan/test.py --dataroot /cyclegan/data/synth_polyp_V15/ --checkpoints_dir /cyclegan/data/synth_polyp_V15/checkpoints --name synth_polyp_V15 --model cycle_gan --phase train --epoch 200

4. Train polyp segmentation using synthetic data

  • docker exec -it main python /main/Train.py --train_path --test_path /polyp-data/TestDataset/Kvasir --train_save synth_polyp_V15 | tee logs/synth_polyp_V15.log

5. Evaluation

  • Generate the masks for the test set: docker exec -it main python /main/Test.py --pth_path /main/data/synth_polyp_V15/snapshots/HarD-MSEG-best.pth --test_data /polyp-data/TestDataset --save_path /main/data/synth_polyp_V15/results

  • To obtain all the metrics (iou, mae, spe) run this Matlab script using Octave: cd eval; octave; pkg install -forge image; pkg load image; main. It can take up to two hours.

  • The results are in eval/EvaluateResults

References

synth-colon's People

Contributors

enric1994 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

synth-colon's Issues

too large maximum depth value

Hi, thanks for your great work.
I tried to use the depth dataset you generated, but I found that many of them have a maximum depth value of 99999999...
These depth maps have some depth inconsistency in the visualized graph, as the image you show on the main page which has a yellow region on the top-left representing the abnormal values (https://github.com/enric1994/synth-colon/blob/master/images/depth.png).
I wonder how that was generated and how should I correct that if I want to use your depth dataset for training proposes.

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.