Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeCamp #139 [Feature] Support REFUGE dataset. #2420

Closed
wants to merge 71 commits into from

Conversation

liuruiqiang
Copy link
Contributor

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Please describe the motivation of this PR and the goal you want to achieve through this PR.

Modification

In this PR, I finished the code for converting REFUGE data in mmsegmentation format, and add appropriate transforms for training according to a paper for REFUGE segmentation task, and for training, I use unet as backbone, the model config is involved in unet-s5-d16_fcn_4xb4-40k_refuge-256x256.py

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMDet3D.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

BLUE-coconut and others added 30 commits November 30, 2022 20:18
CodeCamp open-mmlab#144 [Doc] Chinese version of config tutorial
Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
CodeCamp open-mmlab#147 [Doc] Add Chinese version of train & test tutorial
Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
@MengzhangLI MengzhangLI added Dataset Improvement or addition of new dataset WIP Work in process labels Dec 31, 2022
@MengzhangLI
Copy link
Contributor

Update-2023-01-05

The primary results of REFUGE dataset:

  mDice (include background) mDice (Optic Cup, Optic Disc)
swin-tiny-patch4-window7-in1k-pre_upernet_4xb6-80k_refuge 82.59 74.01
swin-tiny-patch4-window7-in1k-pre_upernet_4xb6-80k_refuge (Default Setting) 89.38 84.125
swin-base-patch4-window7-in1k-pre_upernet_4xb6-80k_refuge-256x256 84.81 77.33
swin-base-patch4-window7-in1k-pre_upernet_4xb6-80k_refuge-256x256(Default Setting) 90.28 85.47
swin-large-patch4-window7-in22k-pre_upernet_4xb6-80k_refuge-256x256 90.05 85.14
swin-large-patch4-window7-in22k-pre_upernet_4xb6-80k_refuge-256x256(Default Setting) 90.51 85.82


First, registrate in [REFUGE2020Challenge](https://refuge.grand-challenge.org)and download data from [this link](https://refuge.grand-challenge.org/REFUGE2Download)

To convert REFUGE dataset to MMSegmentation format, you should run the following command:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, in Synapes dataset, it shows:

│   ├── iSAID
│   │   ├── train
│   │   │   ├── images
│   │   │   │   ├── part1.zip
│   │   │   │   ├── part2.zip
│   │   │   │   ├── part3.zip
│   │   │   ├── Semantic_masks
│   │   │   │   ├── images.zip
│   │   ├── val
│   │   │   ├── images
│   │   │   │   ├── part1.zip
│   │   │   ├── Semantic_masks
│   │   │   │   ├── images.zip
│   │   ├── test
│   │   │   ├── images
│   │   │   │   ├── part1.zip
│   │   │   │   ├── part2.zip

To convert REFUGE dataset to MMSegmentation format, you should run the following command:

```shell
python tools/convert_datasets/refuge.py --raw_data_root=.. --tmp_dir=..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make REFUGE.zip which could be downloaded from official website as raw_data thus users could generate mmsegmentation-style data automatically.

@codecov
Copy link

codecov bot commented Jan 9, 2023

Codecov Report

Base: 83.32% // Head: 83.42% // Increases project coverage by +0.10% 🎉

Coverage data is based on head (d7ca049) compared to base (d505ec1).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head d7ca049 differs from pull request most recent head 1c16532. Consider uploading reports for the commit 1c16532 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           dev-1.x    #2420      +/-   ##
===========================================
+ Coverage    83.32%   83.42%   +0.10%     
===========================================
  Files          145      146       +1     
  Lines         8451     8460       +9     
  Branches      1259     1260       +1     
===========================================
+ Hits          7042     7058      +16     
+ Misses        1204     1194      -10     
- Partials       205      208       +3     
Flag Coverage Δ
unittests 83.42% <100.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmseg/datasets/__init__.py 100.00% <100.00%> (ø)
mmseg/datasets/refuge.py 100.00% <100.00%> (ø)
mmseg/datasets/transforms/transforms.py 90.95% <0.00%> (+0.97%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@MengzhangLI MengzhangLI removed the WIP Work in process label Jan 18, 2023
python tools/convert_datasets/refuge.py --raw_data_root=/path/to/refuge/REFUGE2/REFUGE2
```

这个脚本将自动生成正确的文件夹结构。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
这个脚本将自动生成正确的文件夹结构。
处理后的目录结构如下,该数据有400 张图片的训练集, 400 张图片的验证集和 400 张图片的测试集:

also add an example for the dataset structure after precess


这个脚本将自动生成正确的文件夹结构。

使用我们默认的配置, 将生成 400 张图片的训练集, 400 张图片的验证集和 400 张图片的测试集.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
使用我们默认的配置, 将生成 400 张图片的训练集, 400 张图片的验证集和 400 张图片的测试集.

Comment on lines 539 to 541
The script will make directory structure automatically.

In our default setting, it will generate 400 images for training, 400 images for validation and 400 images for testing.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The script will make directory structure automatically.
In our default setting, it will generate 400 images for training, 400 images for validation and 400 images for testing.
There is the dataset structure after running `tools/convert_datasets/refuge.py`, which includes 400 images for training, 400 images for validation and 400 images for testing.

also add the proper dataset structure example

│ ├── __MACOSX
```

To convert REFUGE dataset to MMSegmentation format, you should run the following command:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To convert REFUGE dataset to MMSegmentation format, you should run the following command:
Please run the following command to convert REFUGE dataset:

Copy link
Collaborator

@MeowZheng MeowZheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rebase this pr on the latest code pf dev-1.x

@MeowZheng MeowZheng self-requested a review February 1, 2023 03:31
MeowZheng pushed a commit that referenced this pull request Feb 3, 2023
## Motivation 
Add REFUGE datasets
Old PR: #2420

---------

Co-authored-by: MengzhangLI <mcmong@pku.edu.cn>
@MengzhangLI MengzhangLI closed this Feb 3, 2023
wjkim81 pushed a commit to wjkim81/mmsegmentation that referenced this pull request Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x Related issue of 1.x version Dataset Improvement or addition of new dataset High Priority from Community This issue/pr needs more attention and higher priority than default developing plan medical
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants