AlexBlck commited on
Commit
aad8398
1 Parent(s): 9405cd6
Files changed (1) hide show
  1. ANAKIN.py +8 -2
ANAKIN.py CHANGED
@@ -141,6 +141,7 @@ class Anakin(datasets.GeneratorBasedBuilder):
141
  gen_kwargs={
142
  "files": data_dir,
143
  "masks": mask_dir,
 
144
  },
145
  ),
146
  datasets.SplitGenerator(
@@ -149,6 +150,7 @@ class Anakin(datasets.GeneratorBasedBuilder):
149
  gen_kwargs={
150
  "files": data_dir,
151
  "masks": mask_dir,
 
152
  },
153
  ),
154
  datasets.SplitGenerator(
@@ -157,13 +159,17 @@ class Anakin(datasets.GeneratorBasedBuilder):
157
  gen_kwargs={
158
  "files": data_dir,
159
  "masks": mask_dir,
 
160
  },
161
  ),
162
  ]
163
 
164
- def _generate_examples(self, files, masks):
165
  for key, sample in enumerate(files):
166
  idx = sample["trimmed"].split("/")[-1].split(".")[0]
167
- sample["masks"] = [m for m in masks[idx]]
 
 
 
168
  print(sample)
169
  yield key, sample
 
141
  gen_kwargs={
142
  "files": data_dir,
143
  "masks": mask_dir,
144
+ "df": df,
145
  },
146
  ),
147
  datasets.SplitGenerator(
 
150
  gen_kwargs={
151
  "files": data_dir,
152
  "masks": mask_dir,
153
+ "df": df,
154
  },
155
  ),
156
  datasets.SplitGenerator(
 
159
  gen_kwargs={
160
  "files": data_dir,
161
  "masks": mask_dir,
162
+ "df": df,
163
  },
164
  ),
165
  ]
166
 
167
+ def _generate_examples(self, files, masks, df):
168
  for key, sample in enumerate(files):
169
  idx = sample["trimmed"].split("/")[-1].split(".")[0]
170
+ if df[df["video-id"] == idx]["has-masks"].values[0]:
171
+ sample["masks"] = [m for m in masks[idx]]
172
+ else:
173
+ sample["masks"] = None
174
  print(sample)
175
  yield key, sample