fix: script
Browse files
printed-2d-masks-with-holes-for-eyes-attacks.py
CHANGED
|
@@ -116,21 +116,24 @@ class Printed2dMasksWithHolesForEyesAttacks(datasets.GeneratorBasedBuilder):
|
|
| 116 |
datasets.SplitGenerator(name=datasets.Split.TRAIN,
|
| 117 |
gen_kwargs={
|
| 118 |
"images": images,
|
|
|
|
| 119 |
'annotations': annotations
|
| 120 |
}),
|
| 121 |
]
|
| 122 |
|
| 123 |
-
def _generate_examples(self, images, annotations):
|
| 124 |
annotations_df = pd.read_csv(annotations, sep=';')
|
| 125 |
|
| 126 |
-
for idx, image_path
|
|
|
|
| 127 |
image_name = Path(image_path).name
|
| 128 |
yield idx, {
|
| 129 |
"photo":
|
| 130 |
load_image_file(image_path),
|
| 131 |
"attack":
|
| 132 |
-
|
| 133 |
-
|
|
|
|
| 134 |
'phone':
|
| 135 |
annotations_df.loc[annotations_df['photo'].str.lower() ==
|
| 136 |
image_name.lower()]['phone'].values[0],
|
|
|
|
| 116 |
datasets.SplitGenerator(name=datasets.Split.TRAIN,
|
| 117 |
gen_kwargs={
|
| 118 |
"images": images,
|
| 119 |
+
'attacks': attacks,
|
| 120 |
'annotations': annotations
|
| 121 |
}),
|
| 122 |
]
|
| 123 |
|
| 124 |
+
def _generate_examples(self, images, attacks, annotations):
|
| 125 |
annotations_df = pd.read_csv(annotations, sep=';')
|
| 126 |
|
| 127 |
+
for idx, (image_path, (attack_path,
|
| 128 |
+
attack)) in enumerate(zip(images, attacks)):
|
| 129 |
image_name = Path(image_path).name
|
| 130 |
yield idx, {
|
| 131 |
"photo":
|
| 132 |
load_image_file(image_path),
|
| 133 |
"attack":
|
| 134 |
+
attack_path,
|
| 135 |
+
# annotations_df.loc[annotations_df['photo'].str.lower() ==
|
| 136 |
+
# image_name.lower()]['attack'].values[0],
|
| 137 |
'phone':
|
| 138 |
annotations_df.loc[annotations_df['photo'].str.lower() ==
|
| 139 |
image_name.lower()]['phone'].values[0],
|