bastienp commited on
Commit
c67f462
·
1 Parent(s): 2422a71

feat: dataset script

Browse files
Files changed (1) hide show
  1. watermarkdataset.py +41 -0
watermarkdataset.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import torch
3
+
4
+ import datasets
5
+ from pycocotools.coco import COCO
6
+
7
+ _DESCRIPTION = """\
8
+ Watermark Dataset
9
+ """
10
+
11
+ _VERSION = datasets.Version("1.0.0")
12
+
13
+ _REPO = "data"# "https://huggingface.co/datasets/bastienp/visible-watermark-pita/raw/main/data"
14
+ _URLS = {"train": f"{_REPO}/train.zip", "valid": f"{_REPO}/valid.zip"}
15
+
16
+ _CATEGORIES = ["watermark"]
17
+
18
+ class WatermarkPita(datasets.GeneratorBasedBuilder):
19
+ """Watermark Dataset"""
20
+
21
+ VERSION = datasets.Version("1.0.0")
22
+
23
+ def _info(self):
24
+ return datasets.DatasetInfo(
25
+ features=datasets.Features(
26
+ {
27
+ "image": datasets.Image(),
28
+ "objects": datasets.Sequence({
29
+ "label": datasets.ClassLabel(names=_CATEGORIES),
30
+ "bbox": datasets.Sequence(datasets.Value("int32"), length=4)
31
+ }),
32
+ }
33
+ ),
34
+
35
+ description=_DESCRIPTION,
36
+ )
37
+
38
+ def _split_generators(self, dl_manager):
39
+ return
40
+
41
+ def _generate_examples(self, images, metadata_path):