Skip to content

Commit 45aa8e5

Browse files
jpuigcervercopybara-github
authored andcommitted
Add CBIS-DDSM dataset to TFDS.
The DDSM is a database of 2,620 scanned film mammography studies. It contains normal, benign, and malignant cases with verified pathology information. The default config is made of patches extracted from the original mammograms, following the description from http://arxiv.org/abs/1708.09427, in order to frame the task to solve in a traditional image classification setting. PiperOrigin-RevId: 252581171
1 parent 958d7cc commit 45aa8e5

File tree

74 files changed

+1287
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1287
-0
lines changed

tensorflow_datasets/image/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from tensorflow_datasets.image.bigearthnet import Bigearthnet
2020
from tensorflow_datasets.image.caltech import Caltech101
2121
from tensorflow_datasets.image.cats_vs_dogs import CatsVsDogs
22+
from tensorflow_datasets.image.cbis_ddsm import CuratedBreastImagingDDSM
2223
from tensorflow_datasets.image.celeba import CelebA
2324
from tensorflow_datasets.image.celebahq import CelebAHq
2425
from tensorflow_datasets.image.chexpert import Chexpert

tensorflow_datasets/image/cbis_ddsm.py

Lines changed: 853 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
N/A
2+
CLUSTERED
3+
CLUSTERED-LINEAR
4+
CLUSTERED-SEGMENTAL
5+
DIFFUSELY_SCATTERED
6+
LINEAR
7+
LINEAR-SEGMENTAL
8+
REGIONAL
9+
REGIONAL-REGIONAL
10+
SEGMENTAL
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
N/A
2+
AMORPHOUS
3+
AMORPHOUS-PLEOMORPHIC
4+
AMORPHOUS-ROUND_AND_REGULAR
5+
COARSE
6+
COARSE-LUCENT_CENTER
7+
COARSE-PLEOMORPHIC
8+
COARSE-ROUND_AND_REGULAR
9+
COARSE-ROUND_AND_REGULAR-LUCENT_CENTER
10+
COARSE-ROUND_AND_REGULAR-LUCENT_CENTERED
11+
DYSTROPHIC
12+
EGGSHELL
13+
FINE_LINEAR_BRANCHING
14+
LARGE_RODLIKE
15+
LARGE_RODLIKE-ROUND_AND_REGULAR
16+
LUCENT_CENTER
17+
LUCENT_CENTERED
18+
LUCENT_CENTER-PUNCTATE
19+
MILK_OF_CALCIUM
20+
PLEOMORPHIC
21+
PLEOMORPHIC-AMORPHOUS
22+
PLEOMORPHIC-FINE_LINEAR_BRANCHING
23+
PLEOMORPHIC-PLEOMORPHIC
24+
PUNCTATE
25+
PUNCTATE-AMORPHOUS
26+
PUNCTATE-AMORPHOUS-PLEOMORPHIC
27+
PUNCTATE-FINE_LINEAR_BRANCHING
28+
PUNCTATE-LUCENT_CENTER
29+
PUNCTATE-PLEOMORPHIC
30+
PUNCTATE-ROUND_AND_REGULAR
31+
ROUND_AND_REGULAR
32+
ROUND_AND_REGULAR-AMORPHOUS
33+
ROUND_AND_REGULAR-EGGSHELL
34+
ROUND_AND_REGULAR-LUCENT_CENTER
35+
ROUND_AND_REGULAR-LUCENT_CENTER-DYSTROPHIC
36+
ROUND_AND_REGULAR-LUCENT_CENTERED
37+
ROUND_AND_REGULAR-LUCENT_CENTER-PUNCTATE
38+
ROUND_AND_REGULAR-PLEOMORPHIC
39+
ROUND_AND_REGULAR-PUNCTATE
40+
ROUND_AND_REGULAR-PUNCTATE-AMORPHOUS
41+
SKIN
42+
SKIN-COARSE-ROUND_AND_REGULAR
43+
SKIN-PUNCTATE
44+
SKIN-PUNCTATE-ROUND_AND_REGULAR
45+
VASCULAR
46+
VASCULAR-COARSE
47+
VASCULAR-COARSE-LUCENT_CENTERED
48+
VASCULAR-COARSE-LUCENT_CENTER-ROUND_AND_REGULAR-PUNCTATE
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
N/A
2+
CIRCUMSCRIBED
3+
CIRCUMSCRIBED-ILL_DEFINED
4+
CIRCUMSCRIBED-MICROLOBULATED
5+
CIRCUMSCRIBED-MICROLOBULATED-ILL_DEFINED
6+
CIRCUMSCRIBED-OBSCURED
7+
CIRCUMSCRIBED-OBSCURED-ILL_DEFINED
8+
CIRCUMSCRIBED-SPICULATED
9+
ILL_DEFINED
10+
ILL_DEFINED-SPICULATED
11+
MICROLOBULATED
12+
MICROLOBULATED-ILL_DEFINED
13+
MICROLOBULATED-ILL_DEFINED-SPICULATED
14+
MICROLOBULATED-SPICULATED
15+
OBSCURED
16+
OBSCURED-CIRCUMSCRIBED
17+
OBSCURED-ILL_DEFINED
18+
OBSCURED-ILL_DEFINED-SPICULATED
19+
OBSCURED-SPICULATED
20+
SPICULATED
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
N/A
2+
ARCHITECTURAL_DISTORTION
3+
ASYMMETRIC_BREAST_TISSUE
4+
FOCAL_ASYMMETRIC_DENSITY
5+
IRREGULAR
6+
IRREGULAR-ARCHITECTURAL_DISTORTION
7+
IRREGULAR-ASYMMETRIC_BREAST_TISSUE
8+
IRREGULAR-FOCAL_ASYMMETRIC_DENSITY
9+
LOBULATED
10+
LOBULATED-ARCHITECTURAL_DISTORTION
11+
LOBULATED-IRREGULAR
12+
LOBULATED-LYMPH_NODE
13+
LOBULATED-OVAL
14+
LYMPH_NODE
15+
OVAL
16+
OVAL-LOBULATED
17+
OVAL-LYMPH_NODE
18+
ROUND
19+
ROUND-IRREGULAR-ARCHITECTURAL_DISTORTION
20+
ROUND-LOBULATED
21+
ROUND-OVAL
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
BACKGROUND
2+
BENING_CALCIFICATION
3+
BENING_MASS
4+
MALIGNANT_CALCIFICATION
5+
MALIGNANT_MASS
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# coding=utf-8
2+
# Copyright 2019 The TensorFlow Datasets Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
"""Tests for cbis_ddsm dataset module."""
17+
18+
from __future__ import absolute_import
19+
from __future__ import division
20+
from __future__ import print_function
21+
from tensorflow_datasets import testing
22+
from tensorflow_datasets.image import cbis_ddsm
23+
24+
25+
class CuratedBreastImagingDDSMOriginalCalcTest(testing.DatasetBuilderTestCase):
26+
DATASET_CLASS = cbis_ddsm.CuratedBreastImagingDDSM
27+
BUILDER_CONFIG_NAMES_TO_TEST = ['original-calc']
28+
SPLITS = {
29+
'train': 3, # Abnormalities: 7
30+
'test': 2, # Abnormalities: 4
31+
}
32+
DL_EXTRACT_RESULT = {
33+
'test': 'calc_case_description_test_set.csv',
34+
'train': 'calc_case_description_train_set.csv',
35+
}
36+
37+
38+
class CuratedBreastImagingDDSMOriginalMassTest(testing.DatasetBuilderTestCase):
39+
DATASET_CLASS = cbis_ddsm.CuratedBreastImagingDDSM
40+
BUILDER_CONFIG_NAMES_TO_TEST = ['original-mass']
41+
SPLITS = {
42+
'train': 3, # Abnormalities: 10
43+
'test': 2, # Abnormalities: 4
44+
}
45+
DL_EXTRACT_RESULT = {
46+
'test': 'mass_case_description_test_set.csv',
47+
'train': 'mass_case_description_train_set.csv',
48+
}
49+
50+
51+
class CuratedBreastImagingDDSMPatchesTest(testing.DatasetBuilderTestCase):
52+
DATASET_CLASS = cbis_ddsm.CuratedBreastImagingDDSM
53+
BUILDER_CONFIG_NAMES_TO_TEST = ['patches']
54+
SPLITS = {
55+
# Total patches = [(10 + 4 + 7 + 4) + (3 + 2 + 3 + 2)] * 10
56+
'train': 280,
57+
'validation': 40,
58+
'test': 30,
59+
}
60+
DL_EXTRACT_RESULT = {
61+
'calc-test': 'calc_case_description_test_set.csv',
62+
'calc-train': 'calc_case_description_train_set.csv',
63+
'mass-test': 'mass_case_description_test_set.csv',
64+
'mass-train': 'mass_case_description_train_set.csv',
65+
}
66+
67+
68+
if __name__ == '__main__':
69+
testing.test_main()

0 commit comments

Comments
 (0)