|
import datasets |
|
|
|
_TAR_FILES=[ |
|
"part0.tar.gz", |
|
"part1.tar.gz", |
|
"part2.tar.gz", |
|
"part3.tar.gz", |
|
"part4.tar.gz", |
|
"part5.tar.gz", |
|
"part6.tar.gz", |
|
] |
|
|
|
class Food101(datasets.GeneratorBasedBuilder): |
|
"""Food-101 Images dataset.""" |
|
|
|
def _info(self): |
|
return datasets.DatasetInfo( |
|
description="TMP description", |
|
homepage="google it", |
|
citation="lmao", |
|
license="dunno, tbh, assume the worst, k thx." |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
archive_path = dl_manager.download(_TAR_FILES[0]) |
|
return [ |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TRAIN, |
|
gen_kwargs={ |
|
"images": dl_manager.iter_archive(archive_path), |
|
}, |
|
), |
|
] |
|
|
|
def _generate_examples(self, images): |
|
"""Generate images and labels for splits.""" |
|
for file_path, file_obj in images: |
|
yield file_path, { |
|
"image": {"path": file_path, "bytes": file_obj.read()}, |
|
} |
|
|
|
|
|
|
|
|
|
|