ShixuanAn commited on
Commit
4953151
1 Parent(s): 5f31bbe

Update RDD_2020.py

Browse files
Files changed (1) hide show
  1. RDD_2020.py +4 -3
RDD_2020.py CHANGED
@@ -9,6 +9,7 @@ import datasets
9
  import logging
10
  import xml.etree.ElementTree as ET
11
  import os
 
12
 
13
  # TODO: Add BibTeX citation
14
  # Find for instance the citation on arxiv or on the dataset repo/website
@@ -56,7 +57,7 @@ class RDD2020_Dataset(datasets.GeneratorBasedBuilder):
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,7 +140,7 @@ class RDD2020_Dataset(datasets.GeneratorBasedBuilder):
139
  image_id = f"{image_file.split('.')[0]}"
140
 
141
  image_path = os.path.join(images_dir, image_file)
142
- # img = Image.open(image_path)
143
 
144
  if annotations_dir:
145
  annotation_file = image_id + '.xml'
@@ -168,8 +169,8 @@ class RDD2020_Dataset(datasets.GeneratorBasedBuilder):
168
  "image_id": image_id,
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
  }
 
9
  import logging
10
  import xml.etree.ElementTree as ET
11
  import os
12
+ from PIL import Image
13
 
14
  # TODO: Add BibTeX citation
15
  # Find for instance the citation on arxiv or on the dataset repo/website
 
57
  "height": datasets.Value("int32"),
58
  "depth": datasets.Value("int32"),
59
  }),
60
+ "image": datasets.Value("string"),
61
  "image_path": datasets.Value("string"),
62
  #"pics_array": datasets.Array3D(shape=(None, None, 3), dtype="uint8"),
63
  "crack_type": datasets.Sequence(datasets.Value("string")),
 
140
  image_id = f"{image_file.split('.')[0]}"
141
 
142
  image_path = os.path.join(images_dir, image_file)
143
+ img = Image.open(image_path)
144
 
145
  if annotations_dir:
146
  annotation_file = image_id + '.xml'
 
169
  "image_id": image_id,
170
  "country": country_dir,
171
  "type": split,
172
+ "image": img,
173
  "image_path": image_path,
 
174
  "crack_type": crack_type,
175
  "crack_coordinates": crack_coordinates,
176
  }