Remove deprecated tasks
#1
by
albertvillanova
HF staff
- opened
- image-folder.py +0 -13
image-folder.py
CHANGED
@@ -8,13 +8,6 @@ logger = datasets.logging.get_logger(__name__)
|
|
8 |
_DESCRIPTION = "A generic image folder"
|
9 |
|
10 |
|
11 |
-
try:
|
12 |
-
from datasets.tasks import ImageClassification
|
13 |
-
has_img_classification_task = True
|
14 |
-
except ImportError as e:
|
15 |
-
has_img_classification_task = False
|
16 |
-
|
17 |
-
|
18 |
class ImageFolder(datasets.GeneratorBasedBuilder):
|
19 |
def _info(self):
|
20 |
|
@@ -28,11 +21,6 @@ class ImageFolder(datasets.GeneratorBasedBuilder):
|
|
28 |
raise RuntimeError()
|
29 |
|
30 |
classes = sorted([x.name.lower() for x in Path(folder).glob('*/**')])
|
31 |
-
|
32 |
-
if has_img_classification_task:
|
33 |
-
task_templates = [datasets.tasks.ImageClassification(image_file_path_column="file", label_column="labels", labels=classes)]
|
34 |
-
else:
|
35 |
-
task_templates = None
|
36 |
|
37 |
return datasets.DatasetInfo(
|
38 |
description=_DESCRIPTION,
|
@@ -42,7 +30,6 @@ class ImageFolder(datasets.GeneratorBasedBuilder):
|
|
42 |
"labels": datasets.features.ClassLabel(names=classes)
|
43 |
}
|
44 |
),
|
45 |
-
task_templates=task_templates,
|
46 |
)
|
47 |
|
48 |
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
|
|
8 |
_DESCRIPTION = "A generic image folder"
|
9 |
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
class ImageFolder(datasets.GeneratorBasedBuilder):
|
12 |
def _info(self):
|
13 |
|
|
|
21 |
raise RuntimeError()
|
22 |
|
23 |
classes = sorted([x.name.lower() for x in Path(folder).glob('*/**')])
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
return datasets.DatasetInfo(
|
26 |
description=_DESCRIPTION,
|
|
|
30 |
"labels": datasets.features.ClassLabel(names=classes)
|
31 |
}
|
32 |
),
|
|
|
33 |
)
|
34 |
|
35 |
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|