Mario Šaško
commited on
Commit
•
4d70bf3
1
Parent(s):
c55d9c1
Use new Image feature
Browse files- cats_vs_dogs_sample.py +4 -4
cats_vs_dogs_sample.py
CHANGED
@@ -48,14 +48,14 @@ class CatsVsDogs(datasets.GeneratorBasedBuilder):
|
|
48 |
description=_DESCRIPTION,
|
49 |
features=datasets.Features(
|
50 |
{
|
51 |
-
"
|
52 |
"labels": datasets.features.ClassLabel(names=["cat", "dog"]),
|
53 |
}
|
54 |
),
|
55 |
-
supervised_keys=("
|
56 |
task_templates=[
|
57 |
ImageClassification(
|
58 |
-
|
59 |
)
|
60 |
],
|
61 |
homepage=_HOMEPAGE,
|
@@ -72,6 +72,6 @@ class CatsVsDogs(datasets.GeneratorBasedBuilder):
|
|
72 |
logger.info("generating examples from = %s", images_path)
|
73 |
for i, filepath in enumerate(images_path.glob("**/*.jpg")):
|
74 |
yield str(i), {
|
75 |
-
"
|
76 |
"labels": filepath.parent.name.lower(),
|
77 |
}
|
|
|
48 |
description=_DESCRIPTION,
|
49 |
features=datasets.Features(
|
50 |
{
|
51 |
+
"image": datasets.Image(),
|
52 |
"labels": datasets.features.ClassLabel(names=["cat", "dog"]),
|
53 |
}
|
54 |
),
|
55 |
+
supervised_keys=("image", "labels"),
|
56 |
task_templates=[
|
57 |
ImageClassification(
|
58 |
+
image_column="image", label_column="labels", labels=["cat", "dog"]
|
59 |
)
|
60 |
],
|
61 |
homepage=_HOMEPAGE,
|
|
|
72 |
logger.info("generating examples from = %s", images_path)
|
73 |
for i, filepath in enumerate(images_path.glob("**/*.jpg")):
|
74 |
yield str(i), {
|
75 |
+
"image": str(filepath),
|
76 |
"labels": filepath.parent.name.lower(),
|
77 |
}
|