Update dataset/datasets.py
Browse files- dataset/datasets.py +6 -6
dataset/datasets.py
CHANGED
|
@@ -21,12 +21,12 @@ class TrainDataset(torch.utils.data.Dataset):
|
|
| 21 |
|
| 22 |
def __getitem__(self, idx):
|
| 23 |
image_name = self.data[idx]
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
|
| 31 |
if self.mults_amount > 1:
|
| 32 |
mult_number = np.random.choice(range(self.mults_amount))
|
|
|
|
| 21 |
|
| 22 |
def __getitem__(self, idx):
|
| 23 |
image_name = self.data[idx]
|
| 24 |
+
|
| 25 |
+
try:
|
| 26 |
+
color_img = plt.imread(os.path.join(self.data_path, 'color', image_name))
|
| 27 |
+
except SyntaxError:
|
| 28 |
+
print(f"Archivo {image_name} no es un PNG v谩lido. Saltando...")
|
| 29 |
+
return None # O alguna otra acci贸n que prefieras
|
| 30 |
|
| 31 |
if self.mults_amount > 1:
|
| 32 |
mult_number = np.random.choice(range(self.mults_amount))
|