File size: 1,924 Bytes
af7d9cc
 
 
 
 
 
 
 
 
 
 
1bd8af4
292b6be
 
 
 
 
 
 
 
 
 
 
 
 
 
1bd8af4
af7d9cc
 
 
 
 
 
 
 
8ed77c9
af7d9cc
 
 
 
5e568ac
1bd8af4
 
5e568ac
1bd8af4
 
 
af7d9cc
5e568ac
1bd8af4
 
 
 
af7d9cc
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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",
    ]
_TAR_FILES_DICT={
    "1024.512": "1024-512-merged1.tar.gz",
    "1152.512": "1152-512-merged1.tar.gz",
    "384.1152": "384-1152-merged1.tar.gz",
    "512.1024": "512-1024-merged1.tar.gz",
    "512.1152": "512-1152-merged1.tar.gz",
    "512.896": "512-896-merged1.tar.gz",
    "640.640": "640-640-merged1.tar.gz",
    "640.768": "640-768-merged1.tar.gz",
    "640.896": "640-896-merged1.tar.gz",
    "768.640": "768-640-merged1.tar.gz",
    "768.768": "768-768-merged1.tar.gz",
    "896.512": "896-512-merged1.tar.gz",
    "896.640": "896-640-merged1.tar.gz",
    "1152.384": "1152-384-merged1.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):
        
        l=[]
        for k in _TAR_FILES_DICT.keys():
            archive_path = dl_manager.download(_TAR_FILES_DICT[k])
            l.append(
                datasets.SplitGenerator(
                name=k,
                gen_kwargs={
                    "images": dl_manager.iter_archive(archive_path),
                },)
            )
            
        return l

    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()},
                }
        
        

#https://huggingface.co/datasets/oscar-corpus/OSCAR-2201/blob/main/OSCAR-2201.py
#https://huggingface.co/datasets/food101