ArielleE commited on
Commit
8bf9e70
1 Parent(s): 4e11427

Update Superimposed-Masked-Dataset.py

Browse files
Files changed (1) hide show
  1. Superimposed-Masked-Dataset.py +2 -1
Superimposed-Masked-Dataset.py CHANGED
@@ -7,6 +7,7 @@ import datasets
7
  from datasets.tasks import ImageClassification
8
 
9
  from .classes import IMAGENET2012_CLASSES
 
10
 
11
 
12
  _CITATION = """\
@@ -73,7 +74,7 @@ class SMD(datasets.GeneratorBasedBuilder):
73
  """Yields examples."""
74
  idx = 0
75
  for archive, mask_archive in zip(archives, mask_archives):
76
- mask_files = {path: np.load(file) for path, file in mask_archive if path.endswith(".npy")}
77
  for path, file in archive:
78
  if path.endswith(".png"):
79
  synset_id = os.path.basename(os.path.dirname(path))
 
7
  from datasets.tasks import ImageClassification
8
 
9
  from .classes import IMAGENET2012_CLASSES
10
+ from io import BytesIO
11
 
12
 
13
  _CITATION = """\
 
74
  """Yields examples."""
75
  idx = 0
76
  for archive, mask_archive in zip(archives, mask_archives):
77
+ mask_files = {path: np.load(BytesIO(file.read())) for path, file in mask_archive if path.endswith(".npy")}
78
  for path, file in archive:
79
  if path.endswith(".png"):
80
  synset_id = os.path.basename(os.path.dirname(path))