Clean up CholecSeg8k.py
Browse files- CholecSeg8k.py +13 -12
CholecSeg8k.py
CHANGED
|
@@ -1,22 +1,24 @@
|
|
| 1 |
import os
|
| 2 |
import datasets
|
| 3 |
|
| 4 |
-
_CITATION = ""
|
| 5 |
_DESCRIPTION = "CholecSeg8K dataset for semantic segmentation in laparoscopic cholecystectomy surgery."
|
| 6 |
_HOMEPAGE_URL = "https://www.kaggle.com/datasets/newslab/cholecseg8k"
|
| 7 |
_DATA_URL = "data/CholecSeg8k.zip"
|
| 8 |
_LICENSE= "cc-by-nc-sa-4.0"
|
| 9 |
|
| 10 |
-
|
| 11 |
class CholecSeg8KConfig(datasets.BuilderConfig):
|
| 12 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
def __init__(self, name, description, homepage, data_url):
|
| 15 |
-
"""BuilderConfig for CholecSeg8k.
|
| 16 |
-
Args:
|
| 17 |
-
data_url: `string`, url to download the zip file from.
|
| 18 |
-
**kwargs: keyword arguments forwarded to super.
|
| 19 |
-
"""
|
| 20 |
super(CholecSeg8KConfig, self).__init__(
|
| 21 |
name=self.name,
|
| 22 |
version=datasets.Version("1.0.0"),
|
|
@@ -27,8 +29,8 @@ class CholecSeg8KConfig(datasets.BuilderConfig):
|
|
| 27 |
self.homepage = homepage
|
| 28 |
self.data_url = data_url
|
| 29 |
|
| 30 |
-
|
| 31 |
def _build_config(name):
|
|
|
|
| 32 |
return CholecSeg8KConfig(
|
| 33 |
name=name,
|
| 34 |
description=_DESCRIPTION,
|
|
@@ -36,12 +38,12 @@ def _build_config(name):
|
|
| 36 |
data_url=_DATA_URL,
|
| 37 |
)
|
| 38 |
|
| 39 |
-
|
| 40 |
class CholecSeg8K(datasets.GeneratorBasedBuilder):
|
| 41 |
|
| 42 |
BUILDER_CONFIGS = [_build_config("all")]
|
| 43 |
|
| 44 |
def _info(self):
|
|
|
|
| 45 |
return datasets.DatasetInfo(
|
| 46 |
description=_DESCRIPTION,
|
| 47 |
features=datasets.Features(
|
|
@@ -59,7 +61,7 @@ class CholecSeg8K(datasets.GeneratorBasedBuilder):
|
|
| 59 |
)
|
| 60 |
|
| 61 |
def _split_generators(self, dl_manager):
|
| 62 |
-
|
| 63 |
datapath = dl_manager.download_and_extract(_DATA_URL)
|
| 64 |
|
| 65 |
return [
|
|
@@ -69,7 +71,6 @@ class CholecSeg8K(datasets.GeneratorBasedBuilder):
|
|
| 69 |
),
|
| 70 |
]
|
| 71 |
|
| 72 |
-
|
| 73 |
def _generate_examples(self, datapath):
|
| 74 |
"""Yields examples."""
|
| 75 |
key=0
|
|
|
|
| 1 |
import os
|
| 2 |
import datasets
|
| 3 |
|
| 4 |
+
_CITATION = "https://arxiv.org/abs/2012.12453"
|
| 5 |
_DESCRIPTION = "CholecSeg8K dataset for semantic segmentation in laparoscopic cholecystectomy surgery."
|
| 6 |
_HOMEPAGE_URL = "https://www.kaggle.com/datasets/newslab/cholecseg8k"
|
| 7 |
_DATA_URL = "data/CholecSeg8k.zip"
|
| 8 |
_LICENSE= "cc-by-nc-sa-4.0"
|
| 9 |
|
|
|
|
| 10 |
class CholecSeg8KConfig(datasets.BuilderConfig):
|
| 11 |
+
"""
|
| 12 |
+
BuilderConfig for CholecSeg8k dataset.
|
| 13 |
+
|
| 14 |
+
Args:
|
| 15 |
+
name (str): Name of the configuration.
|
| 16 |
+
description (str): Description of the dataset.
|
| 17 |
+
homepage (str): Homepage URL of the dataset.
|
| 18 |
+
data_url (str): URL to download the dataset.
|
| 19 |
+
"""
|
| 20 |
|
| 21 |
def __init__(self, name, description, homepage, data_url):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
super(CholecSeg8KConfig, self).__init__(
|
| 23 |
name=self.name,
|
| 24 |
version=datasets.Version("1.0.0"),
|
|
|
|
| 29 |
self.homepage = homepage
|
| 30 |
self.data_url = data_url
|
| 31 |
|
|
|
|
| 32 |
def _build_config(name):
|
| 33 |
+
"""Builds and returns the dataset configuration."""
|
| 34 |
return CholecSeg8KConfig(
|
| 35 |
name=name,
|
| 36 |
description=_DESCRIPTION,
|
|
|
|
| 38 |
data_url=_DATA_URL,
|
| 39 |
)
|
| 40 |
|
|
|
|
| 41 |
class CholecSeg8K(datasets.GeneratorBasedBuilder):
|
| 42 |
|
| 43 |
BUILDER_CONFIGS = [_build_config("all")]
|
| 44 |
|
| 45 |
def _info(self):
|
| 46 |
+
"""Returns the dataset info."""
|
| 47 |
return datasets.DatasetInfo(
|
| 48 |
description=_DESCRIPTION,
|
| 49 |
features=datasets.Features(
|
|
|
|
| 61 |
)
|
| 62 |
|
| 63 |
def _split_generators(self, dl_manager):
|
| 64 |
+
"""Generates data splits."""
|
| 65 |
datapath = dl_manager.download_and_extract(_DATA_URL)
|
| 66 |
|
| 67 |
return [
|
|
|
|
| 71 |
),
|
| 72 |
]
|
| 73 |
|
|
|
|
| 74 |
def _generate_examples(self, datapath):
|
| 75 |
"""Yields examples."""
|
| 76 |
key=0
|