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

[Project] Medical semantic seg dataset: 2pm vessel #2685

Merged
merged 26 commits into from
Jun 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a104395
Update 8 datasets following template made by tianbinli at Feb. 20
Masaaki-75 Feb 21, 2023
9c2791b
Delete projects/example_project directory
Masaaki-75 Feb 22, 2023
f491633
Delete projects/hssn directory
Masaaki-75 Feb 22, 2023
900d079
Delete projects/isnet directory
Masaaki-75 Feb 22, 2023
38932b4
Delete projects/mapillary_dataset directory
Masaaki-75 Feb 22, 2023
51b8892
scripts for project of medical dataset (modality=ct).
Masaaki-75 Mar 2, 2023
5e50996
scripts for project of medical dataset cranium (modality=ct).
Masaaki-75 Mar 2, 2023
da389c5
scripts for project of medical dataset endovis15 (modality=endoscopy).
Masaaki-75 Mar 2, 2023
7ec8087
Merge branch 'dev-1.x' of https://github.com/Masaaki-75/mmsegmentatio…
Masaaki-75 Mar 2, 2023
dd29bcf
scripts for project of medical dataset endovis15 (modality=endoscopy).
Masaaki-75 Mar 2, 2023
dd5356f
scripts for project of medical dataset kvasir_seg (modality=endoscopy).
Masaaki-75 Mar 2, 2023
1300566
scripts for project of medical dataset kvasir_seg_aliyun (modality=en…
Masaaki-75 Mar 2, 2023
79357f0
scripts for project of medical dataset gamma (modality=fundus_photogr…
Masaaki-75 Mar 2, 2023
605ecd6
scripts for project of medical dataset rite (modality=fundus_photogra…
Masaaki-75 Mar 2, 2023
f49066c
scripts for project of medical dataset bcss (modality=histopathology).
Masaaki-75 Mar 2, 2023
b94a6db
scripts for project of medical dataset fusc2021 (modality=histopathol…
Masaaki-75 Mar 2, 2023
667d3a4
scripts for project of medical dataset pannuke (modality=histopatholo…
Masaaki-75 Mar 2, 2023
443f605
scripts for project of medical dataset pcam (modality=histopathology).
Masaaki-75 Mar 2, 2023
ae08b20
scripts for project of medical dataset 2pm_vessel (modality=microscop…
Masaaki-75 Mar 2, 2023
04363df
updated scripts for project of medical dataset 2pm_vessel (modality=m…
Masaaki-75 Mar 3, 2023
a47db1c
updated scripts for project of medical dataset 2pm_vessel (modality=m…
Masaaki-75 Mar 28, 2023
0b93699
--fix=restore
xiexinch Jun 25, 2023
ef2a795
Merge remote-tracking branch 'upstream/dev-1.x' into 2pm_vessel
xiexinch Jun 25, 2023
98102c0
--other=fix script
xiexinch Jun 25, 2023
4c9e0fe
--doc=remove results
xiexinch Jun 25, 2023
49a2cfc
--other=rename config
xiexinch Jun 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
scripts for project of medical dataset bcss (modality=histopathology).
  • Loading branch information
Masaaki-75 committed Mar 2, 2023
commit f49066c0ce0acb852fab2eff723d875b7be7c3d8

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,48 +1,52 @@
# Retinal Images vessel Tree Extraction (RITE)
# Breast Cancer Semantic Segmentation (BCSS)

## Description

This project support **`Retinal Images vessel Tree Extraction (RITE) `**, and the dataset used in this project can be downloaded from [here](https://opendatalab.com/RITE).
This project support **`Breast Cancer Semantic Segmentation (BCSS) `**, and the dataset used in this project can be downloaded from [here](https://bcsegmentation.grand-challenge.org/).

### Dataset Overview

The RITE (Retinal Images vessel Tree Extraction) is a database that enables comparative studies on segmentation or classification of arteries and veins on retinal fundus images, which is established based on the public available DRIVE database (Digital Retinal Images for Vessel Extraction). RITE contains 40 sets of images, equally separated into a training subset and a test subset, the same as DRIVE. The two subsets are built from the corresponding two subsets in DRIVE. For each set, there is a fundus photograph, a vessel reference standard. The fundus photograph is inherited from DRIVE. For the training set, the vessel reference standard is a modified version of 1st_manual from DRIVE. For the test set, the vessel reference standard is 2nd_manual from DRIVE.
The BCSS dataset contains over 20,000 segmentation annotations of tissue region from breast cancer images from TCGA. This large-scale dataset was annotated through the collaborative effort of pathologists, pathology residents, and medical students using the Digital Slide Archive.  It enables the generation of highly accurate machine-learning models for tissue segmentation.

### Statistic Information
### Information Statistics

| dataset name | anatomical region | task type | modality | num. classes | train/val/test images | release date | License |
| ------------------------------------ | ----------------- | ------------ | ------------------ | ------------ | --------------------- | ------------ | --------------------------------------------------------------- |
| [Rite](https://opendatalab.com/RITE) | head_and_neck | segmentation | fundus_photography | 2 | 20/-/20 | 2013 | [CC-BY-NC 4.0](https://creativecommons.org/licenses/by-sa/4.0/) |
| dataset_name | anatomical region | task type | modality | number of categories | train/val/test image | release date | License |
| --------------------------------------------------- | ----------------- | ------------ | -------------- | -------------------- | -------------------- | ------------ | ------------------------------------------------------------- |
| [bcss](https://bcsegmentation.grand-challenge.org/) | throax | segmentation | histopathology | 6 | 151/-/- | 2019 | [CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/) |

| class name | pixel percentage | Num. images in this category |
| ---------- | ---------------- | ---------------------------- |
| background | 91.60 | 40 |
| vessel | 8.40 | 40 |
| class_name | Percentage of pixels(%) | Number of pictures in this category |
| ------------ | ------------------------- | ----------------------------------- |
| background | 21.75 | 49 |
| tumor | 31.04 | 151 |
| stroma | 28.16 | 151 |
| inflammatory | 9.44 | 126 |
| necrosis | 5.16 | 91 |
| other | 4.45 | 141 |

### Visualization

![rite](https://github.com/uni-medical/medical-datasets-visualization/blob/main/2d/semantic_seg/fundus_photography/rite/rite_dataset.png?raw=true)
![bcss](https://github.com/uni-medical/medical-datasets-visualization/blob/main/2d/semantic_seg/histopathology/bcss/bcss_dataset.png?raw=true)

### Prerequisites

- Python 3.8
- PyTorch 1.10.0
- pillow(PIL) 9.3.0
- scikit-learn(sklearn) 1.2.0
- pillow(PIL)
- scikit-learn(sklearn)
- [MIM](https://github.com/open-mmlab/mim) v0.3.4
- [MMCV](https://github.com/open-mmlab/mmcv) v2.0.0rc4
- [MMEngine](https://github.com/open-mmlab/mmengine) v0.2.0 or higher
- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation) v1.0.0rc5

All the commands below rely on the correct configuration of PYTHONPATH, which should point to the project's directory so that Python can locate the module files. In rite/ root directory, run the following line to add the current directory to PYTHONPATH:
All the commands below rely on the correct configuration of PYTHONPATH, which should point to the project's directory so that Python can locate the module files. In bcss/ root directory, run the following line to add the current directory to PYTHONPATH:

```shell
export PYTHONPATH=`pwd`:$PYTHONPATH
```

### Dataset preparing

- download dataset from [here](https://opendatalab.com/RITE) and decompression data to path 'data/'.
- download dataset from [here](https://bcsegmentation.grand-challenge.org/) and decompression data to path 'data/'.
- run script `"python tools/prepare_dataset.py"` to split dataset and change folder structure as below.

```none
Expand All @@ -51,8 +55,8 @@ export PYTHONPATH=`pwd`:$PYTHONPATH
├── projects
│ ├── medical
│ │ ├── 2d_image
│ │ │ ├── fundus_photography
│ │ │ │ ├── rite
│ │ │ ├── histopathology
│ │ │ │ ├── bcss
│ │ │ │ │ ├── configs
│ │ │ │ │ ├── datasets
│ │ │ │ │ ├── tools
Expand Down Expand Up @@ -101,21 +105,21 @@ You should claim whether this is based on the pre-trained weights, which are con

## Results

### Retinal Images Vessel Tree Extraction
### Breast Cancer Semantic Segmentation (BCSS)

| Method | Backbone | Crop Size | lr | mIoU | mDice | config |
| :-------------: | :------: | :-------: | :----: | :---: | :---: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| fcn_unet_s5-d16 | unet | 512x512 | 0.01 | 76.48 | 84.68 | [config](https://github.com/open-mmlab/mmsegmentation/tree/dev-1.x/projects/medical/2d_image/fundus_photography/rite/configs/fcn-unet-s5-d16_unet_1xb16-0.01-20k_rite-512x512.py) |
| fcn_unet_s5-d16 | unet | 512x512 | 0.001 | 61.06 | 63.69 | [config](https://github.com/open-mmlab/mmsegmentation/tree/dev-1.x/projects/medical/2d_image/fundus_photography/rite/configs/fcn-unet-s5-d16_unet_1xb16-0.001-20k_rite-512x512.py) |
| fcn_unet_s5-d16 | unet | 512x512 | 0.0001 | 58.87 | 62.42 | [config](https://github.com/open-mmlab/mmsegmentation/tree/dev-1.x/projects/medical/2d_image/fundus_photography/rite/configs/fcn-unet-s5-d16_unet_1xb16-0.0001-20k_rite-512x512.py) |
| Method | Backbone | Crop Size | lr | mIoU | mDice | config |
| :-------------: | :------: | :-------: | :----: | :---: | :---: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| fcn_unet_s5-d16 | unet | 512x512 | 0.01 | 76.48 | 84.68 | [config](https://github.com/open-mmlab/mmsegmentation/tree/dev-1.x/projects/medical/2d_image/histopathology/bcss/configs/fcn-unet-s5-d16_unet_1xb16-0.01-20k_bcss-512x512.py) |
| fcn_unet_s5-d16 | unet | 512x512 | 0.001 | 61.06 | 63.69 | [config](https://github.com/open-mmlab/mmsegmentation/tree/dev-1.x/projects/medical/2d_image/histopathology/bcss/configs/fcn-unet-s5-d16_unet_1xb16-0.001-20k_bcss-512x512.py) |
| fcn_unet_s5-d16 | unet | 512x512 | 0.0001 | 58.87 | 62.42 | [config](https://github.com/open-mmlab/mmsegmentation/tree/dev-1.x/projects/medical/2d_image/histopathology/bcss/configs/fcn-unet-s5-d16_unet_1xb16-0.0001-20k_bcss-512x512.py) |

## Checklist

- [x] Milestone 1: PR-ready, and acceptable to be one of the `projects/`.

- [x] Finish the code
- [x] Basic docstrings & proper citation
- [x] Test-time correctness
- [ ] Test-time correctness
- [x] A full README

- [x] Milestone 2: Indicates a successful model implementation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dataset_type = 'RITEDataset'
dataset_type = 'BCSSDataset'
data_root = 'data/'
img_scale = (512, 512)
train_pipeline = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
_base_ = [
'mmseg::_base_/models/fcn_unet_s5-d16.py', './rite_512x512.py',
'mmseg::_base_/models/fcn_unet_s5-d16.py', './bcss_512x512.py',
'mmseg::_base_/default_runtime.py',
'mmseg::_base_/schedules/schedule_20k.py'
]
custom_imports = dict(imports='datasets.rite_dataset')
custom_imports = dict(imports='datasets.bcss_dataset')
img_scale = (512, 512)
data_preprocessor = dict(size=img_scale)
optimizer = dict(lr=0.0001)
optim_wrapper = dict(optimizer=optimizer)
model = dict(
data_preprocessor=data_preprocessor,
decode_head=dict(num_classes=2),
decode_head=dict(num_classes=6),
auxiliary_head=None,
test_cfg=dict(mode='whole', _delete_=True))
vis_backends = None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
_base_ = [
'mmseg::_base_/models/fcn_unet_s5-d16.py', './rite_512x512.py',
'mmseg::_base_/models/fcn_unet_s5-d16.py', './bcss_512x512.py',
'mmseg::_base_/default_runtime.py',
'mmseg::_base_/schedules/schedule_20k.py'
]
custom_imports = dict(imports='datasets.rite_dataset')
custom_imports = dict(imports='datasets.bcss_dataset')
img_scale = (512, 512)
data_preprocessor = dict(size=img_scale)
optimizer = dict(lr=0.001)
optim_wrapper = dict(optimizer=optimizer)
model = dict(
data_preprocessor=data_preprocessor,
decode_head=dict(num_classes=2),
decode_head=dict(num_classes=6),
auxiliary_head=None,
test_cfg=dict(mode='whole', _delete_=True))
vis_backends = None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
_base_ = [
'mmseg::_base_/models/fcn_unet_s5-d16.py', './rite_512x512.py',
'mmseg::_base_/models/fcn_unet_s5-d16.py', './bcss_512x512.py',
'mmseg::_base_/default_runtime.py',
'mmseg::_base_/schedules/schedule_20k.py'
]
custom_imports = dict(imports='datasets.rite_dataset')
custom_imports = dict(imports='datasets.bcss_dataset')
img_scale = (512, 512)
data_preprocessor = dict(size=img_scale)
optimizer = dict(lr=0.01)
optim_wrapper = dict(optimizer=optimizer)
model = dict(
data_preprocessor=data_preprocessor,
decode_head=dict(num_classes=2),
decode_head=dict(num_classes=6),
auxiliary_head=None,
test_cfg=dict(mode='whole', _delete_=True))
vis_backends = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@


@DATASETS.register_module()
class RITEDataset(BaseSegDataset):
"""RITEDataset dataset.

In segmentation map annotation for RITEDataset,
0 stands for background, which is included in 2 categories.
``reduce_zero_label`` is fixed to False. The ``img_suffix``
is fixed to '.png' and ``seg_map_suffix`` is fixed to '.png'.
class BCSSDataset(BaseSegDataset):
"""BCSSDataset dataset.

In segmentation map annotation for BCSSDataset, 0 stands for background,
which is included in 6 categories. ``reduce_zero_label`` is fixed to
False. The ``img_suffix`` is fixed to '.png' and ``seg_map_suffix`` is
fixed to '.png'.
Args:
img_suffix (str): Suffix of images. Default: '.png'
seg_map_suffix (str): Suffix of segmentation maps. Default: '.png'
reduce_zero_label (bool): Whether to mark label zero as ignored.
Default to False.
Default to False..
"""
METAINFO = dict(classes=('background', 'vessel'))
METAINFO = dict(
classes=('background', 'tumor', 'stroma', 'inflammatory', 'necrosis',
'other'))

def __init__(self,
img_suffix='.png',
Expand Down