MFreidank commited on
Commit
95d0568
·
1 Parent(s): 82ce17f

Initial commit, classification configs only

Browse files
Files changed (3) hide show
  1. LICENSE.txt +88 -0
  2. README.md +255 -0
  3. glenda.py +254 -0
LICENSE.txt ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Creative Commons Attribution-NonCommercial 4.0 International Public License
2
+
3
+ By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
4
+
5
+ Section 1 – Definitions.
6
+
7
+ Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
8
+ Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
9
+ Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
10
+ Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
11
+ Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
12
+ Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
13
+ Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
14
+ Licensor means the individual(s) or entity(ies) granting rights under this Public License.
15
+ NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
16
+ Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
17
+ Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
18
+ You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
19
+ Section 2 – Scope.
20
+
21
+ License grant.
22
+ Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
23
+ reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
24
+ produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
25
+ Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
26
+ Term. The term of this Public License is specified in Section 6(a).
27
+ Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
28
+ Downstream recipients.
29
+ Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
30
+ No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
31
+ No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
32
+ Other rights.
33
+
34
+ Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
35
+ Patent and trademark rights are not licensed under this Public License.
36
+ To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
37
+ Section 3 – License Conditions.
38
+
39
+ Your exercise of the Licensed Rights is expressly made subject to the following conditions.
40
+
41
+ Attribution.
42
+
43
+ If You Share the Licensed Material (including in modified form), You must:
44
+
45
+ retain the following if it is supplied by the Licensor with the Licensed Material:
46
+ identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
47
+ a copyright notice;
48
+ a notice that refers to this Public License;
49
+ a notice that refers to the disclaimer of warranties;
50
+ a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
51
+ indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
52
+ indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
53
+ You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
54
+ If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
55
+ If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
56
+ Section 4 – Sui Generis Database Rights.
57
+
58
+ Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
59
+
60
+ for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
61
+ if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
62
+ You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
63
+ For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
64
+ Section 5 – Disclaimer of Warranties and Limitation of Liability.
65
+
66
+ Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
67
+ To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
68
+ The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
69
+ Section 6 – Term and Termination.
70
+
71
+ This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
72
+ Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
73
+
74
+ automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
75
+ upon express reinstatement by the Licensor.
76
+ For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
77
+ For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
78
+ Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
79
+ Section 7 – Other Terms and Conditions.
80
+
81
+ The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
82
+ Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
83
+ Section 8 – Interpretation.
84
+
85
+ For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
86
+ To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
87
+ No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
88
+ Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
README.md ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: GLENDA - The ITEC Gynecologic Laparoscopy Endometriosis Dataset
3
+ language:
4
+ - en
5
+ annotations_creators:
6
+ - expert-generated
7
+ language_creators:
8
+ - machine-generated
9
+ license:
10
+ - cc-by-nc-4.0
11
+ multilinguality:
12
+ - monolingual
13
+ size_categories:
14
+ - 10K<n<100K
15
+ task_categories:
16
+ - image-classification
17
+ task_ids: []
18
+ dataset_info:
19
+ - config_name: binary_classification
20
+ features:
21
+ - name: image
22
+ dtype: image
23
+ - name: metadata
24
+ struct:
25
+ - name: id
26
+ dtype: int32
27
+ - name: width
28
+ dtype: int32
29
+ - name: height
30
+ dtype: int32
31
+ - name: file_name
32
+ dtype: string
33
+ - name: path
34
+ dtype: string
35
+ - name: fickr_url
36
+ dtype: string
37
+ - name: coco_url
38
+ dtype: string
39
+ - name: date_captured
40
+ dtype: string
41
+ - name: case_id
42
+ dtype: int32
43
+ - name: video_id
44
+ dtype: int32
45
+ - name: frame_id
46
+ dtype: int32
47
+ - name: from_seconds
48
+ dtype: int32
49
+ - name: to_seconds
50
+ dtype: int32
51
+ - name: labels
52
+ dtype:
53
+ class_label:
54
+ names:
55
+ '0': no_pathology
56
+ '1': endometriosis
57
+ splits:
58
+ - name: train
59
+ num_bytes: 4524957
60
+ num_examples: 13811
61
+ download_size: 895554144
62
+ dataset_size: 4524957
63
+ - config_name: multiclass_classification
64
+ features:
65
+ - name: image
66
+ dtype: image
67
+ - name: metadata
68
+ struct:
69
+ - name: id
70
+ dtype: int32
71
+ - name: width
72
+ dtype: int32
73
+ - name: height
74
+ dtype: int32
75
+ - name: file_name
76
+ dtype: string
77
+ - name: path
78
+ dtype: string
79
+ - name: fickr_url
80
+ dtype: string
81
+ - name: coco_url
82
+ dtype: string
83
+ - name: date_captured
84
+ dtype: string
85
+ - name: case_id
86
+ dtype: int32
87
+ - name: video_id
88
+ dtype: int32
89
+ - name: frame_id
90
+ dtype: int32
91
+ - name: from_seconds
92
+ dtype: int32
93
+ - name: to_seconds
94
+ dtype: int32
95
+ - name: labels
96
+ dtype:
97
+ class_label:
98
+ names:
99
+ '0': No-Pathology
100
+ '1': 6.1.1.1_Endo-Peritoneum
101
+ '2': 6.1.1.2_Endo-Ovar
102
+ '3': 6.1.1.3_Endo-TIE
103
+ '4': 6.1.1.4_Endo-Uterus
104
+ splits:
105
+ - name: train
106
+ num_bytes: 4524957
107
+ num_examples: 13811
108
+ download_size: 895554144
109
+ dataset_size: 4524957
110
+ ---
111
+
112
+ # Dataset Card for GLENDA - The ITEC Gynecologic Laparoscopy Endometriosis Dataset
113
+
114
+ ## Table of Contents
115
+ - [Table of Contents](#table-of-contents)
116
+ - [Dataset Description](#dataset-description)
117
+ - [Dataset Summary](#dataset-summary)
118
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
119
+ - [Languages](#languages)
120
+ - [Dataset Structure](#dataset-structure)
121
+ - [Data Instances](#data-instances)
122
+ - [Data Fields](#data-fields)
123
+ - [Data Splits](#data-splits)
124
+ - [Dataset Creation](#dataset-creation)
125
+ - [Curation Rationale](#curation-rationale)
126
+ - [Source Data](#source-data)
127
+ - [Annotations](#annotations)
128
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
129
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
130
+ - [Social Impact of Dataset](#social-impact-of-dataset)
131
+ - [Discussion of Biases](#discussion-of-biases)
132
+ - [Other Known Limitations](#other-known-limitations)
133
+ - [Additional Information](#additional-information)
134
+ - [Dataset Curators](#dataset-curators)
135
+ - [Licensing Information](#licensing-information)
136
+ - [Citation Information](#citation-information)
137
+ - [Contributions](#contributions)
138
+
139
+ ## Dataset Description
140
+
141
+ - **Homepage:** http://ftp.itec.aau.at/datasets/GLENDA/index.html
142
+ - **Repository:**
143
+ - **Paper:** [GLENDA: Gynecologic Laparoscopy Endometriosis Dataset](https://link.springer.com/chapter/10.1007/978-3-030-37734-2_36)
144
+ - **Leaderboard:**
145
+ - **Point of Contact:** freidankm@gmail.com
146
+
147
+ ### Dataset Summary
148
+ GLENDA (Gynecologic Laparoscopy ENdometriosis DAtaset) comprises over 350 annotated endometriosis lesion images taken from 100+ gynecologic laparoscopy surgeries as well as over 13K unannotated non pathological images of 20+ surgeries. The dataset is purposefully created to be utilized for a variety of automatic content analysis problems in the context of Endometriosis recognition.
149
+
150
+ **Description**
151
+
152
+ Endometriosis is a benign but potentially painful condition among women in child bearing age involving the growth of uterine-like tissue in locations outside of the uterus. Corresponding lesions can be found in various positions and severities, often in multiple instances per patient requiring a physician to determine its extent. This most frequently is accomplished by calculating its magnitude via utilizing the combination of two popular classification systems, the revised American Society for Reproductive Medicine (rASRM) and the European Enzian scores. Endometriosis can not reliably identified by laymen, therefore, the dataset has been created with the help of medical experts in the field of endometriosis treatment.
153
+
154
+ **Purposes**
155
+
156
+ * binary (endometriosis) classification
157
+ * detection/localization
158
+
159
+ **Overview**
160
+
161
+ The dataset includes region-based annotations of 4 pathological endometriosis categories as well as non pathological counter example images. Annotations are created for single video frames that may be part of larger sequences comprising several consecutive frames (all showing the annotated condition). Frames can contain multiple annotations, potentially of different categories. Each single annotation is exported as a binary image (similar to below examples, albeit one image per annotation).
162
+
163
+ # TODO: FIXME: A bit more useful info on dataset case distribution class distribution and link to original + preview link
164
+ TODO: FIXME: A bit more useful info on dataset case distribution class distribution and link to original + preview link
165
+
166
+ ### Supported Tasks and Leaderboards
167
+ - `image_classification`: The dataset can be used for binary (no pathology / endometriosis) or multiclass image classification (No-Pathology, 6.1.1.1\_Endo-Peritoneum, 6.1.1.2\_Endo-Ovar, 6.1.1.3\_Endo-DIE, 6.1.1.4\_Endo-Uterus. These classes respectively correspond to: no visible pathology in relation to endometriosis, peritoneal endometriosis, endometriosis on ovaries, deep infiltrating endometriosis (DIE) and uterine endometriosis.).
168
+
169
+ ## Dataset Structure
170
+
171
+ ### Data Instances
172
+
173
+ #### binary\_classification
174
+ TODO DESCRIBE
175
+
176
+ #### multiclass\_classification
177
+ TODO DESCRIBE
178
+
179
+ ## Dataset Creation
180
+
181
+ ### Curation Rationale
182
+
183
+ From the [official website](http://ftp.itec.aau.at/datasets/GLENDA/index.html)
184
+ > The dataset is purposefully created to be utilized for a variety of automatic content analysis problems in the context of Endometriosis recognition
185
+
186
+ ### Source Data
187
+
188
+ #### Initial Data Collection and Normalization
189
+
190
+ From the [official website](http://ftp.itec.aau.at/datasets/GLENDA/index.html)
191
+ > The dataset includes region-based annotations of 4 pathological endometriosis categories as well as non pathological counter example images. Annotations are created for single video frames that may be part of larger sequences comprising several consecutive frames (all showing the annotated condition). Frames can contain multiple annotations, potentially of different categories. Each single annotation is exported as a binary image (similar to below examples, albeit one image per annotation).
192
+
193
+ ### Annotations
194
+
195
+ #### Annotation process
196
+
197
+ From the [official website](http://ftp.itec.aau.at/datasets/GLENDA/index.html)
198
+ > Corresponding lesions can be found in various positions and severities, often in multiple instances per patient requiring a physician to determine its extent. This most frequently is accomplished by calculating its magnitude via utilizing the combination of two popular classification systems, the revised American Society for Reproductive Medicine (rASRM) and the European Enzian scores. Endometriosis can not reliably identified by laymen, therefore, the dataset has been created with the help of medical experts in the field of endometriosis treatment.
199
+
200
+ #### Who are the annotators?
201
+
202
+ Medical experts in the field of endometriosis treatment.
203
+
204
+ ### Personal and Sensitive Information
205
+
206
+ [More Information Needed]
207
+
208
+ ### Social Impact of Dataset
209
+
210
+ [More Information Needed]
211
+
212
+ ### Discussion of Biases
213
+
214
+ [More Information Needed]
215
+
216
+ ### Other Known Limitations
217
+
218
+ [More Information Needed]
219
+
220
+ ## Additional Information
221
+
222
+ ### Dataset Curators
223
+ [More Information Needed]
224
+
225
+ ### Licensing Information
226
+
227
+ The dataset is exclusively provided for scientific research purposes and as such cannot be used commercially or for any other purpose. If any other purpose is intended, you may directly contact the originator of the videos, Prof. Dr. Jörg Keckstein.
228
+
229
+ GLENDA is licensed under Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0, Creative Commons License) and is created as well as maintained by Distributed Multimedia Systems Group of the Institute of Information Technology (ITEC) at Alpen-Adria Universität in Klagenfurt, Austria.
230
+
231
+ This license allows users of this dataset to copy, distribute and transmit the work under the following conditions:
232
+ * Attribution: You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
233
+ * Non-Commercial: You may not use the material for commercial purposes.
234
+
235
+ For further legal details, please read the [complete license terms](https://creativecommons.org/licenses/by-nc/4.0/legalcode).
236
+
237
+ For additional information, please visit the [official website](http://ftp.itec.aau.at/datasets/GLENDA/index.html).
238
+
239
+
240
+ ### Citation Information
241
+
242
+ ```
243
+ @inproceedings{10.1007/978-3-030-37734-2_36,
244
+ abstract = {Gynecologic laparoscopy as a type of minimally invasive surgery (MIS) is performed via a live feed of a patient's abdomen surveying the insertion and handling of various instruments for conducting treatment. Adopting this kind of surgical intervention not only facilitates a great variety of treatments, the possibility of recording said video streams is as well essential for numerous post-surgical activities, such as treatment planning, case documentation and education. Nonetheless, the process of manually analyzing surgical recordings, as it is carried out in current practice, usually proves tediously time-consuming. In order to improve upon this situation, more sophisticated computer vision as well as machine learning approaches are actively developed. Since most of such approaches heavily rely on sample data, which especially in the medical field is only sparsely available, with this work we publish the Gynecologic Laparoscopy ENdometriosis DAtaset (GLENDA) -- an image dataset containing region-based annotations of a common medical condition named endometriosis, i.e. the dislocation of uterine-like tissue. The dataset is the first of its kind and it has been created in collaboration with leading medical experts in the field.},
245
+ address = {Cham},
246
+ author = {Leibetseder, Andreas and Kletz, Sabrina and Schoeffmann, Klaus and Keckstein, Simon and Keckstein, J{\"o}rg},
247
+ booktitle = {MultiMedia Modeling},
248
+ editor = {Ro, Yong Man and Cheng, Wen-Huang and Kim, Junmo and Chu, Wei-Ta and Cui, Peng and Choi, Jung-Woo and Hu, Min-Chun and De Neve, Wesley},
249
+ isbn = {978-3-030-37734-2},
250
+ pages = {439--450},
251
+ publisher = {Springer International Publishing},
252
+ title = {GLENDA: Gynecologic Laparoscopy Endometriosis Dataset},
253
+ year = {2020}
254
+ }
255
+ ```
glenda.py ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __doc__ = """\
2
+ GLENDA (Gynecologic Laparoscopy ENdometriosis DAtaset) comprises over 350 annotated endometriosis lesion images taken from 100+ gynecologic laparoscopy surgeries as well as over 13K unannotated non pathological images of 20+ surgeries. The dataset is purposefully created to be utilized for a variety of automatic content analysis problems in the context of Endometriosis recognition.
3
+
4
+ Description
5
+ Endometriosis is a benign but potentially painful condition among women in child bearing age involving the growth of uterine-like tissue in locations outside of the uterus. Corresponding lesions can be found in various positions and severities, often in multiple instances per patient requiring a physician to determine its extent. This most frequently is accomplished by calculating its magnitude via utilizing the combination of two popular classification systems, the revised American Society for Reproductive Medicine (rASRM) and the European Enzian scores. Endometriosis can not reliably identified by laymen, therefore, the dataset has been created with the help of medical experts in the field of endometriosis treatment.
6
+
7
+ Purposes
8
+ * (endometriosis) classification (binary or using 4 pathological endometriosis categories)
9
+ * detection/localization
10
+
11
+ Overview
12
+ The dataset includes region-based annotations of 4 pathological endometriosis categories as well as non pathological counter example images. Annotations are created for single video frames that may be part of larger sequences comprising several consecutive frames (all showing the annotated condition). Frames can contain multiple annotations, potentially of different categories. Each single annotation is exported as a binary image (similar to below examples, albeit one image per annotation).
13
+
14
+ Disclaimer
15
+ The dataset is exclusively provided for scientific research purposes and as such cannot be used commercially or for any other purpose. If any other purpose is intended, you may directly contact the originator of the videos, Prof. Dr. Jörg Keckstein.
16
+
17
+ In addition, reference must be made to the following publication when this dataset is used in any academic and research reports:
18
+ A. Leibetseder, S. Kletz, K. Schoeffmann, S. Keckstein and J. Keckstein. 2020. GLENDA: Gynecologic Laparoscopy Endometriosis Dataset. In Proceedings of the 26th International Conference on Multimedia Modeling, MMM 2020. Springer, Cham.
19
+ """
20
+ import json
21
+ from pathlib import Path
22
+ import re
23
+
24
+ import datasets
25
+
26
+ DESCRIPTION = str(__doc__)
27
+
28
+ LICENSE = "cc-by-nc-4.0"
29
+
30
+
31
+ CITATION = "Leibetseder, A., Kletz, S., Schoeffmann, K., Keckstein, S., Keckstein, J. (2020). GLENDA: Gynecologic Laparoscopy Endometriosis Dataset. In: , et al. MultiMedia Modeling. MMM 2020. Lecture Notes in Computer Science(), vol 11962. Springer, Cham. https://doi.org/10.1007/978-3-030-37734-2_36"
32
+
33
+ HOMEPAGE = "http://ftp.itec.aau.at/datasets/GLENDA/index.html"
34
+
35
+ VERSION = "1.5"
36
+
37
+ URLS = {
38
+ "endometriosis_classes": "http://ftp.itec.aau.at/datasets/GLENDA/downloads//Glenda_v1.5_classes.zip",
39
+ "no_pathology": "http://ftp.itec.aau.at/datasets/GLENDA/downloads/GLENDA_v1.5_no_pathology.zip",
40
+ }
41
+
42
+ CLASS_NAMES = {
43
+ "binary_classification": ("no_pathology", "endometriosis"),
44
+ "multiclass_classification": (
45
+ "No-Pathology",
46
+ "6.1.1.1_Endo-Peritoneum",
47
+ "6.1.1.2_Endo-Ovar",
48
+ "6.1.1.3_Endo-TIE",
49
+ "6.1.1.4_Endo-Uterus",
50
+ ),
51
+ }
52
+
53
+ ENDOMETRIOSIS_IMAGE_METADATA_REGEX = re.compile(
54
+ r"c_(?P<case_id>[0-9]+)_v_\(video_(?P<video_id>[0-9]+).mp4\)_f_(?P<frame_id>[0-9]+).jpg"
55
+ )
56
+
57
+ NO_PATHOLOGY_IMAGE_METADATA_REGEX = re.compile(
58
+ r"v_(?P<video_id>[0-9]+)_s_(?P<from_seconds>[0-9]+)-(?P<to_seconds>[0-9]+)/f_(?P<frame_id>[0-9]+).jpg"
59
+ )
60
+
61
+
62
+ class GLENDA(datasets.GeneratorBasedBuilder):
63
+ BUILDER_CONFIGS = [
64
+ datasets.BuilderConfig(
65
+ name="binary_classification",
66
+ description="Contains images without visible pathology in relation to endometriosis (label = 'no_pathology') and different endometriosis classes (label = 'endometriosis').",
67
+ version=datasets.Version(f"{VERSION}.0"),
68
+ ),
69
+ datasets.BuilderConfig(
70
+ name="multiclass_classification",
71
+ description="Contains images without visible pathology in relation to endometriosis (label = 'No-Pathology') and different endometriosis classes (label is exactly one of: 6.1.1.1_Endo-Peritoneum, 6.1.1.2_Endo-Ovar, 6.1.1.3_Endo-TIE, 6.1.1.4_Endo-Uterus).",
72
+ version=datasets.Version(f"{VERSION}.0"),
73
+ ),
74
+ # TODO: FIXME: Coming soon
75
+ # datasets.BuilderConfig(
76
+ # name="object_detection",
77
+ # description="Contains images without visible pathology in relation to endometriosis and different endometriosis classes with bounding box annotations.",
78
+ # version=datasets.Version(f"{VERSION}.0"),
79
+ # ),
80
+ # datasets.BuilderConfig(
81
+ # name="instance_segmentation",
82
+ # # TODO
83
+ # description="Contains images without visible pathology in relation to endometriosis and different endometriosis classes with instance segmentation annotations.",
84
+ # version=datasets.Version(f"{VERSION}.0"),
85
+ # ),
86
+ ]
87
+
88
+ def _info(self):
89
+ features = {
90
+ "image": datasets.Image(),
91
+ "metadata": {
92
+ "id": datasets.Value(dtype="int32"),
93
+ "width": datasets.Value(dtype="int32"),
94
+ "height": datasets.Value(dtype="int32"),
95
+ "file_name": datasets.Value(dtype="string"),
96
+ "path": datasets.Value(dtype="string"),
97
+ "fickr_url": datasets.Value(dtype="string"),
98
+ "coco_url": datasets.Value(dtype="string"),
99
+ "date_captured": datasets.Value(dtype="string"),
100
+ "case_id": datasets.Value("int32"),
101
+ "video_id": datasets.Value("int32"),
102
+ "frame_id": datasets.Value("int32"),
103
+ "from_seconds": datasets.Value("int32"),
104
+ "to_seconds": datasets.Value("int32"),
105
+ },
106
+ }
107
+
108
+ task_templates = None
109
+ supervised_keys = None
110
+
111
+ if self.config.name in ("binary_classification", "multiclass_classification"):
112
+ class_names = CLASS_NAMES[self.config.name]
113
+ features["labels"] = datasets.ClassLabel(
114
+ num_classes=len(class_names),
115
+ names=class_names,
116
+ )
117
+ supervised_keys = (("image", "labels"),)
118
+ task_templates = [
119
+ datasets.ImageClassification(
120
+ image_column="image", label_column="labels"
121
+ )
122
+ ]
123
+ else:
124
+ raise NotImplementedError()
125
+
126
+ return datasets.DatasetInfo(
127
+ description=DESCRIPTION,
128
+ features=datasets.Features(features),
129
+ homepage=HOMEPAGE,
130
+ license=LICENSE,
131
+ citation=CITATION,
132
+ task_templates=task_templates,
133
+ supervised_keys=supervised_keys,
134
+ )
135
+
136
+ def _split_generators(self, dl_manager):
137
+ endometriosis_data_path = Path(
138
+ dl_manager.download_and_extract(URLS["endometriosis_classes"])
139
+ ).joinpath(f"Glenda_v{VERSION}_classes")
140
+
141
+ no_pathology_data_path = Path(
142
+ dl_manager.download_and_extract(URLS["no_pathology"])
143
+ ).joinpath("no_pathology", "frames")
144
+
145
+ coco_annotation_filepath = Path(endometriosis_data_path).joinpath("coco.json")
146
+
147
+ with open(coco_annotation_filepath, "r") as coco_annotation_file:
148
+ coco_annotations = json.load(coco_annotation_file)
149
+
150
+ category_id2_name = {
151
+ category["id"]: category["name"]
152
+ for category in coco_annotations["categories"]
153
+ }
154
+
155
+ image_filepaths, image_metadata, image_labels = [], [], []
156
+
157
+ for annotation, metadata in zip(
158
+ coco_annotations["annotations"],
159
+ coco_annotations["images"],
160
+ ):
161
+ image_filepaths.append(
162
+ endometriosis_data_path.joinpath(
163
+ metadata["coco_url"],
164
+ )
165
+ )
166
+ regex_match = re.search(
167
+ string=metadata["file_name"],
168
+ pattern=ENDOMETRIOSIS_IMAGE_METADATA_REGEX,
169
+ )
170
+ metadata.update(
171
+ {
172
+ field_name: int(field_value)
173
+ for field_name, field_value in regex_match.groupdict().items()
174
+ }
175
+ )
176
+ # NOTE: Only defined for `no_pathology` images
177
+ metadata["from_seconds"] = None
178
+ metadata["to_seconds"] = None
179
+
180
+ _ = metadata.pop("metadata")
181
+ # This field does not accurately reflect the dataset license,
182
+ # so let's not include it to avoid confusion.
183
+ _ = metadata.pop("license")
184
+ image_metadata.append(metadata)
185
+
186
+ if self.config.name == "binary_classification":
187
+ _, positive_label_name = CLASS_NAMES[self.config.name]
188
+ image_labels.append(positive_label_name)
189
+ elif self.config.name == "multiclass_classification":
190
+ image_labels.append(category_id2_name[annotation["category_id"]])
191
+ else:
192
+ raise NotImplementedError()
193
+
194
+ max_id = max(metadata["id"] for metadata in image_metadata)
195
+ for image_id, image_filepath in enumerate(
196
+ no_pathology_data_path.glob("*/*.jpg"), start=max_id + 1
197
+ ):
198
+ image_filepaths.append(image_filepath)
199
+ image_filename_with_parent_folder = image_filepath.relative_to(
200
+ no_pathology_data_path
201
+ )
202
+
203
+ metadata = {
204
+ "id": image_id,
205
+ "width": image_metadata[-1]["width"],
206
+ "height": image_metadata[-1]["height"],
207
+ "file_name": image_filepath.name,
208
+ "path": f"frames/{image_filename_with_parent_folder}",
209
+ "fickr_url": None,
210
+ "coco_url": f"frames/{image_filename_with_parent_folder}",
211
+ "date_captured": None,
212
+ }
213
+ match = re.search(
214
+ string=str(image_filename_with_parent_folder),
215
+ pattern=NO_PATHOLOGY_IMAGE_METADATA_REGEX,
216
+ )
217
+ metadata.update(
218
+ {
219
+ field_name: int(field_value)
220
+ for field_name, field_value in match.groupdict().items()
221
+ }
222
+ )
223
+ # NOTE: Only defined for `endometriosis` images
224
+ metadata["case_id"] = None
225
+ image_metadata.append(metadata)
226
+
227
+ if self.config.name in (
228
+ "binary_classification",
229
+ "multiclass_classification",
230
+ ):
231
+ negative_class_label_name, *_ = CLASS_NAMES[self.config.name]
232
+ image_labels.append(negative_class_label_name)
233
+
234
+ return [
235
+ datasets.SplitGenerator(
236
+ name=datasets.Split.TRAIN,
237
+ gen_kwargs={
238
+ "image_filepaths": image_filepaths,
239
+ "labels": image_labels,
240
+ "metadata": image_metadata,
241
+ },
242
+ )
243
+ ]
244
+
245
+ def _generate_examples(self, image_filepaths, labels, metadata):
246
+ for example_id, (image_filepath, label, image_metadata) in enumerate(
247
+ zip(image_filepaths, labels, metadata)
248
+ ):
249
+ with open(image_filepath, "rb") as image_file:
250
+ yield example_id, {
251
+ "image": {"path": str(image_filepath), "bytes": image_file.read()},
252
+ "labels": label,
253
+ "metadata": image_metadata,
254
+ }