ShixuanAn commited on
Commit
725c021
1 Parent(s): ce3b9ad

Update RDD_2020.py

Browse files
Files changed (1) hide show
  1. RDD_2020.py +4 -0
RDD_2020.py CHANGED
@@ -56,6 +56,7 @@ class RDD2020_Dataset(datasets.GeneratorBasedBuilder):
56
  "height": datasets.Value("int32"),
57
  "depth": datasets.Value("int32"),
58
  }),
 
59
  "image_path": datasets.Value("string"),
60
  #"pics_array": datasets.Array3D(shape=(None, None, 3), dtype="uint8"),
61
  "crack_type": datasets.Sequence(datasets.Value("string")),
@@ -138,6 +139,8 @@ class RDD2020_Dataset(datasets.GeneratorBasedBuilder):
138
  image_id = f"{image_file.split('.')[0]}"
139
 
140
  image_path = os.path.join(images_dir, image_file)
 
 
141
  if annotations_dir:
142
  annotation_file = image_id + '.xml'
143
  annotation_path = os.path.join(annotations_dir, annotation_file)
@@ -166,6 +169,7 @@ class RDD2020_Dataset(datasets.GeneratorBasedBuilder):
166
  "country": country_dir,
167
  "type": split,
168
  "image_path": image_path,
 
169
  "crack_type": crack_type,
170
  "crack_coordinates": crack_coordinates,
171
  }
 
56
  "height": datasets.Value("int32"),
57
  "depth": datasets.Value("int32"),
58
  }),
59
+ "image": datasets.Value("string"),
60
  "image_path": datasets.Value("string"),
61
  #"pics_array": datasets.Array3D(shape=(None, None, 3), dtype="uint8"),
62
  "crack_type": datasets.Sequence(datasets.Value("string")),
 
139
  image_id = f"{image_file.split('.')[0]}"
140
 
141
  image_path = os.path.join(images_dir, image_file)
142
+
143
+ img = Image.open(image_path)
144
  if annotations_dir:
145
  annotation_file = image_id + '.xml'
146
  annotation_path = os.path.join(annotations_dir, annotation_file)
 
169
  "country": country_dir,
170
  "type": split,
171
  "image_path": image_path,
172
+ 'image' = img
173
  "crack_type": crack_type,
174
  "crack_coordinates": crack_coordinates,
175
  }