Update test.py
Browse files
test.py
CHANGED
|
@@ -33,53 +33,53 @@ class imgdataset(datasets.GeneratorBasedBuilder):
|
|
| 33 |
]
|
| 34 |
|
| 35 |
|
| 36 |
-
def _info(self):
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
|
| 60 |
-
def _split_generators(self, dl_manager):
|
| 61 |
-
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
def _download_image(self, dl_manager):
|
| 84 |
|
| 85 |
|
|
@@ -111,23 +111,23 @@ class imgdataset(datasets.GeneratorBasedBuilder):
|
|
| 111 |
os.makedirs(folder)
|
| 112 |
urllib.request.urlretrieve(url, path)
|
| 113 |
|
| 114 |
-
def _generate_examples(self, filepath, split):
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
|
|
|
|
| 33 |
]
|
| 34 |
|
| 35 |
|
| 36 |
+
# def _info(self):
|
| 37 |
+
# if self.config.name == "train":
|
| 38 |
+
# features = datasets.Features(
|
| 39 |
+
# {
|
| 40 |
+
# "Class_name": datasets.Value("string"),
|
| 41 |
+
# "file_name": datasets.Value("string"),
|
| 42 |
+
# "file_id": datasets.Value("string")
|
| 43 |
+
|
| 44 |
+
# }
|
| 45 |
+
# )
|
| 46 |
+
# else:
|
| 47 |
+
# features = datasets.Features(
|
| 48 |
+
# {
|
| 49 |
+
# "Class_name": datasets.Value("string"),
|
| 50 |
+
# "file_name": datasets.Value("string"),
|
| 51 |
+
# "file_id": datasets.Value("string")
|
| 52 |
+
|
| 53 |
+
# }
|
| 54 |
+
# )
|
| 55 |
+
# return datasets.DatasetInfo(
|
| 56 |
+
# description=_DESCRIPTION,
|
| 57 |
+
# features=features,
|
| 58 |
+
# )
|
| 59 |
|
| 60 |
+
# def _split_generators(self, dl_manager):
|
| 61 |
+
# """This function returns the examples in the raw (text) form."""
|
| 62 |
|
| 63 |
+
# # urls = _URLS[self.config.name]
|
| 64 |
+
# # data_dir = dl_manager.download_and_extract(urls)
|
| 65 |
+
# return [
|
| 66 |
+
# datasets.SplitGenerator(
|
| 67 |
+
# name=datasets.Split.TRAIN,
|
| 68 |
+
# # These kwargs will be passed to _generate_examples
|
| 69 |
+
# gen_kwargs={
|
| 70 |
+
# "filepath": os.path.join("/content/drive/MyDrive/", "train_dataset.csv"),
|
| 71 |
+
# "split": "train",
|
| 72 |
+
# },
|
| 73 |
+
# ),
|
| 74 |
+
# datasets.SplitGenerator(
|
| 75 |
+
# name=datasets.Split.VALIDATION,
|
| 76 |
+
# # These kwargs will be passed to _generate_examples
|
| 77 |
+
# gen_kwargs={
|
| 78 |
+
# "filepath": os.path.join("/content/drive/MyDrive/", "reg_dataset.csv"),
|
| 79 |
+
# "split": "reg",
|
| 80 |
+
# },
|
| 81 |
+
# ),
|
| 82 |
+
# ]
|
| 83 |
def _download_image(self, dl_manager):
|
| 84 |
|
| 85 |
|
|
|
|
| 111 |
os.makedirs(folder)
|
| 112 |
urllib.request.urlretrieve(url, path)
|
| 113 |
|
| 114 |
+
# def _generate_examples(self, filepath, split):
|
| 115 |
+
# # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
| 116 |
+
# # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
| 117 |
+
|
| 118 |
+
# with open(filepath, encoding="utf-8") as f:
|
| 119 |
+
# for key, row in enumerate(f):
|
| 120 |
+
# data = csv.loads(row)
|
| 121 |
+
# if self.config.name == "train":
|
| 122 |
+
# yield key, {
|
| 123 |
+
# "Class_name": datasets.Value("string"),
|
| 124 |
+
# "file_name": datasets.Value("string"),
|
| 125 |
+
# "file_id": datasets.Value("string")
|
| 126 |
+
# }
|
| 127 |
+
# else:
|
| 128 |
+
# yield key, {
|
| 129 |
+
# "Class_name": datasets.Value("string"),
|
| 130 |
+
# "file_name": datasets.Value("string"),
|
| 131 |
+
# "file_id": datasets.Value("string")
|
| 132 |
+
# }
|
| 133 |
|