DsL commited on
Commit
ad47715
·
1 Parent(s): 246efff

delete dataset.py

Browse files
Files changed (1) hide show
  1. Causal3D_Dataset.py +5 -0
Causal3D_Dataset.py CHANGED
@@ -106,6 +106,11 @@ class Causal3dDataset(datasets.GeneratorBasedBuilder):
106
  fname = row["imgs"] if "imgs" in row else str(idx)
107
  image_name = images[idx].split("/")[-1].split(".")[0] if images else ""
108
  record_img_path = next((key for key in image_files if image_name in key), None)
 
 
 
 
 
109
  yield idx, {
110
  "image": image_files[record_img_path] if record_img_path else None,
111
  "file_name": fname,
 
106
  fname = row["imgs"] if "imgs" in row else str(idx)
107
  image_name = images[idx].split("/")[-1].split(".")[0] if images else ""
108
  record_img_path = next((key for key in image_files if image_name in key), None)
109
+ # raise error if the path does not exist
110
+ # check the path existance
111
+ if not os.path.exists(image_files[record_img_path]) if record_img_path else None:
112
+ raise FileNotFoundError(f"Image file not found: {image_files[record_img_path]}")
113
+
114
  yield idx, {
115
  "image": image_files[record_img_path] if record_img_path else None,
116
  "file_name": fname,