Datasets:
Tasks:
Image Classification
Sub-tasks:
multi-class-image-classification
Languages:
English
Size:
1M<n<10M
ArXiv:
License:
Use correct file endings
Browse files
ForNet.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
import gzip
|
| 2 |
-
import itertools
|
| 3 |
import json
|
| 4 |
import multiprocessing
|
| 5 |
import os
|
|
@@ -1541,6 +1540,9 @@ class ForNet(datasets.GeneratorBasedBuilder):
|
|
| 1541 |
logger.info(f"will save cls_to_idx to '{cls_to_idx_loc}'")
|
| 1542 |
logger.info("Opening files")
|
| 1543 |
class_to_zipfile = {}
|
|
|
|
|
|
|
|
|
|
| 1544 |
for f in patch_files:
|
| 1545 |
with zipfile.ZipFile(f, "r") as zf:
|
| 1546 |
for name in zf.namelist():
|
|
@@ -1548,9 +1550,7 @@ class ForNet(datasets.GeneratorBasedBuilder):
|
|
| 1548 |
class_to_zipfile[name.split("/")[-2]] = f
|
| 1549 |
file_ending = "pkl" if name.endswith(".pkl") else "pkl.gz"
|
| 1550 |
name_start = "/".join(name.split("/")[:-2])
|
| 1551 |
-
|
| 1552 |
-
name_start = ""
|
| 1553 |
-
file_ending = "pkl" if patch_files[0].startswith("train") else "pkl.gz"
|
| 1554 |
if len(name_start) > 0:
|
| 1555 |
name_start += "/"
|
| 1556 |
logger.info(f"Loading extra information: {hf_indices}, {fg_bg_ratios}")
|
|
@@ -1621,7 +1621,7 @@ class ForNet(datasets.GeneratorBasedBuilder):
|
|
| 1621 |
running = False
|
| 1622 |
tqdm.write("Finished imagenet iteration; waiting for zip loaders to finish")
|
| 1623 |
|
| 1624 |
-
if foraug_idx % 10_000 == 0:
|
| 1625 |
errors = comm_dict["n_errors"]
|
| 1626 |
if errors > last_errors:
|
| 1627 |
last_errors = errors
|
|
|
|
| 1 |
import gzip
|
|
|
|
| 2 |
import json
|
| 3 |
import multiprocessing
|
| 4 |
import os
|
|
|
|
| 1540 |
logger.info(f"will save cls_to_idx to '{cls_to_idx_loc}'")
|
| 1541 |
logger.info("Opening files")
|
| 1542 |
class_to_zipfile = {}
|
| 1543 |
+
|
| 1544 |
+
name_start = "" if split == "train" else "val"
|
| 1545 |
+
file_ending = "pkl"
|
| 1546 |
for f in patch_files:
|
| 1547 |
with zipfile.ZipFile(f, "r") as zf:
|
| 1548 |
for name in zf.namelist():
|
|
|
|
| 1550 |
class_to_zipfile[name.split("/")[-2]] = f
|
| 1551 |
file_ending = "pkl" if name.endswith(".pkl") else "pkl.gz"
|
| 1552 |
name_start = "/".join(name.split("/")[:-2])
|
| 1553 |
+
|
|
|
|
|
|
|
| 1554 |
if len(name_start) > 0:
|
| 1555 |
name_start += "/"
|
| 1556 |
logger.info(f"Loading extra information: {hf_indices}, {fg_bg_ratios}")
|
|
|
|
| 1621 |
running = False
|
| 1622 |
tqdm.write("Finished imagenet iteration; waiting for zip loaders to finish")
|
| 1623 |
|
| 1624 |
+
if foraug_idx % 10_000 == 0 and foraug_idx > 0:
|
| 1625 |
errors = comm_dict["n_errors"]
|
| 1626 |
if errors > last_errors:
|
| 1627 |
last_errors = errors
|