Git Product home page Git Product logo

deeplesion's Introduction

DeepLesion

This repository converts the DeepLesion dataset for use with mmdetection.

DeepLesion is a large-scale dataset for medical object detection. This dataset contains over 32,000 annotated CT images and is split into train, validation, and test sets. It coarsely defines eight types of lesions, including bone, abdomen, mediastinum, liver, lung, kidney, soft tissue, and pelvis. We have treated all lesions under the same 'lesion' category.

1️⃣ Preparing the Images

git clone https://github.com/anir16293/Deep-Lesion.git

Modify the download_directory in batch_download_zips.py

# it takes a while, so using tmux is recommended
python batch_download_zips.py 

In unzip_me.py, set base_dir to the directory of the downloaded zip files and set a new output_dir

# it takes a while, so using tmux is recommended
python unzip_me.py

If cv2 is not installed, run pip install opencv-python to install it

Modify the path in preprocess_me.py. Set csv_path to the location of DL_info.csv

python preprocess_me.py

2️⃣ Preparing the Annotations

In coconize_me.py, insert the location of DL_info.csv into csv_file_path

python coconize_me.py

3️⃣ Inject noise using UNA (optional)

git clone https://github.com/Ryoo72/UNA.git
cd UNA
python una_inj.py --ratio 0.1 --class_type deeplesion --path {path_to_json} --target {target_path}
# EXAMPLE
# python una_inj.py --ratio 0.1 --class_type deeplesion --path ./annotations/deeplesion_train.json --target ./annotations

4️⃣ Setting Up MMDetection

git clone https://github.com/open-mmlab/mmdetection.git

Duplicate configs/_base_/datasets/coco_detection.pyconfigs/_base_/datasets/coco_detection_dl.py and change:

  • data_root
  • ann_file
  • data_prefix

Duplicate configs/_base_/models/fast-rcnn_r50_fpn.pyconfigs/_base_/models/fast-rcnn_r50_fpn_dl.py and change num_classes to 1

Duplicate configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py and change to '../_base_/models/faster-rcnn_r50_fpn_dl.py','../_base_/datasets/coco_detection_dl.py'

Duplicate mmdet/datasets/coco.pymmdet/datasets/deeplesion.py, rename the class to DeepLesionDataset. Configure the class to only include 'lesion', and leave only one arbitrary palette, removing the rest.

If this step is not done correctly, a ValueError: need at least one array to concatenate will occur

Follow the instructions at https://mmdetection.readthedocs.io/en/latest/get_started.html

If you have reached this point without changing the default path, it is convenient to directly move the current DeepLesion directory to mmdetection/data/ for use.

5️⃣ Run experiments

bash ./tools/dist_train.sh \
    {config_file_path} \
    16

Note

✉️ [email protected]

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.