Update Superimposed-Masked-Dataset.py
Browse files
Superimposed-Masked-Dataset.py
CHANGED
|
@@ -86,12 +86,11 @@ class SMD(datasets.GeneratorBasedBuilder):
|
|
| 86 |
label = IMAGENET2012_CLASSES[synset_id]
|
| 87 |
|
| 88 |
mask_file_path = path.replace("_occluded.png", "_mask.npy")
|
| 89 |
-
segmentation_mask = mask_files.get(mask_file_path
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
idx += 1
|
|
|
|
| 86 |
label = IMAGENET2012_CLASSES[synset_id]
|
| 87 |
|
| 88 |
mask_file_path = path.replace("_occluded.png", "_mask.npy")
|
| 89 |
+
segmentation_mask = mask_files.get(mask_file_path)
|
| 90 |
+
ex = {
|
| 91 |
+
"image": {"path": path, "bytes": file.read()},
|
| 92 |
+
"label": label,
|
| 93 |
+
"segmentation": segmentation_mask.tolist() # Convert numpy array to list
|
| 94 |
+
}
|
| 95 |
+
yield idx, ex
|
| 96 |
+
idx += 1
|
|
|