Datasets:
Stavros Niafas
commited on
Commit
·
b72f6cb
1
Parent(s):
9acdb34
edit readme
Browse files
README.md
CHANGED
|
@@ -36,10 +36,10 @@ dataset_info:
|
|
| 36 |
1: '1'
|
| 37 |
splits:
|
| 38 |
- name: train
|
| 39 |
-
num_bytes:
|
| 40 |
num_examples: 1200
|
| 41 |
download_size: 39731200
|
| 42 |
-
dataset_size:
|
| 43 |
---
|
| 44 |
## Dataset Summary
|
| 45 |
|
|
|
|
| 36 |
1: '1'
|
| 37 |
splits:
|
| 38 |
- name: train
|
| 39 |
+
num_bytes: 192150
|
| 40 |
num_examples: 1200
|
| 41 |
download_size: 39731200
|
| 42 |
+
dataset_size: 192150
|
| 43 |
---
|
| 44 |
## Dataset Summary
|
| 45 |
|
dof.py
CHANGED
|
@@ -14,8 +14,7 @@
|
|
| 14 |
# limitations under the License.
|
| 15 |
"""The depth-of-field dataset"""
|
| 16 |
|
| 17 |
-
import
|
| 18 |
-
|
| 19 |
import datasets
|
| 20 |
from datasets.tasks import ImageClassification
|
| 21 |
|
|
@@ -62,22 +61,21 @@ class DoF(datasets.GeneratorBasedBuilder):
|
|
| 62 |
)
|
| 63 |
|
| 64 |
def _split_generators(self, dl_manager):
|
| 65 |
-
|
| 66 |
return [
|
| 67 |
datasets.SplitGenerator(
|
| 68 |
name=datasets.Split.TRAIN,
|
| 69 |
gen_kwargs={
|
| 70 |
-
"images": dl_manager.
|
| 71 |
},
|
| 72 |
)
|
| 73 |
]
|
| 74 |
|
| 75 |
def _generate_examples(self, images):
|
| 76 |
"""Generate images and labels for splits."""
|
| 77 |
-
for file_path
|
| 78 |
-
|
| 79 |
-
label = file_path.split("/")[0]
|
| 80 |
yield file_path, {
|
| 81 |
-
"image": {"path": file_path, "
|
| 82 |
"label": label,
|
| 83 |
}
|
|
|
|
| 14 |
# limitations under the License.
|
| 15 |
"""The depth-of-field dataset"""
|
| 16 |
|
| 17 |
+
from PIL import Image
|
|
|
|
| 18 |
import datasets
|
| 19 |
from datasets.tasks import ImageClassification
|
| 20 |
|
|
|
|
| 61 |
)
|
| 62 |
|
| 63 |
def _split_generators(self, dl_manager):
|
| 64 |
+
images_path = dl_manager.download_and_extract(_URL)
|
| 65 |
return [
|
| 66 |
datasets.SplitGenerator(
|
| 67 |
name=datasets.Split.TRAIN,
|
| 68 |
gen_kwargs={
|
| 69 |
+
"images": dl_manager.iter_files(images_path),
|
| 70 |
},
|
| 71 |
)
|
| 72 |
]
|
| 73 |
|
| 74 |
def _generate_examples(self, images):
|
| 75 |
"""Generate images and labels for splits."""
|
| 76 |
+
for file_path in images:
|
| 77 |
+
label = file_path.split("/")[-2:][0]
|
|
|
|
| 78 |
yield file_path, {
|
| 79 |
+
"image": {"path": file_path, "image": Image.open(file_path)},
|
| 80 |
"label": label,
|
| 81 |
}
|