vkashko commited on
Commit
04c3a0b
·
1 Parent(s): 0fe91f6
Files changed (2) hide show
  1. README.md +6 -6
  2. dogs-video-object-tracking-dataset.py +15 -18
README.md CHANGED
@@ -45,10 +45,10 @@ dataset_info:
45
  dtype: string
46
  splits:
47
  - name: train
48
- num_bytes: 34542
49
  num_examples: 52
50
  download_size: 313334253
51
- dataset_size: 34542
52
  - config_name: video_02
53
  features:
54
  - name: id
@@ -85,10 +85,10 @@ dataset_info:
85
  dtype: string
86
  splits:
87
  - name: train
88
- num_bytes: 38528
89
  num_examples: 58
90
  download_size: 67368145
91
- dataset_size: 38528
92
  - config_name: video_03
93
  features:
94
  - name: id
@@ -125,10 +125,10 @@ dataset_info:
125
  dtype: string
126
  splits:
127
  - name: train
128
- num_bytes: 32550
129
  num_examples: 49
130
  download_size: 148418007
131
- dataset_size: 32550
132
  ---
133
 
134
  # Dogs Video Object Tracking Dataset
 
45
  dtype: string
46
  splits:
47
  - name: train
48
+ num_bytes: 18890
49
  num_examples: 52
50
  download_size: 313334253
51
+ dataset_size: 18890
52
  - config_name: video_02
53
  features:
54
  - name: id
 
85
  dtype: string
86
  splits:
87
  - name: train
88
+ num_bytes: 21070
89
  num_examples: 58
90
  download_size: 67368145
91
+ dataset_size: 21070
92
  - config_name: video_03
93
  features:
94
  - name: id
 
125
  dtype: string
126
  splits:
127
  - name: train
128
+ num_bytes: 17801
129
  num_examples: 49
130
  download_size: 148418007
131
+ dataset_size: 17801
132
  ---
133
 
134
  # Dogs Video Object Tracking Dataset
dogs-video-object-tracking-dataset.py CHANGED
@@ -81,7 +81,7 @@ class DogsVideoObjectTrackingDataset(datasets.GeneratorBasedBuilder):
81
  def _split_generators(self, dl_manager):
82
  images = dl_manager.download_and_extract(f"{_DATA}{self.config.name}.zip")
83
  annotations = dl_manager.download(f"{_DATA}{self.config.name}.xml")
84
- images = dl_manager.iter_files(images)
85
  return [
86
  datasets.SplitGenerator(
87
  name=datasets.Split.TRAIN,
@@ -156,20 +156,17 @@ class DogsVideoObjectTrackingDataset(datasets.GeneratorBasedBuilder):
156
  tree = ET.parse(annotations)
157
  root = tree.getroot()
158
 
159
- for idx, image in enumerate(images):
160
- if "images" in image:
161
- i = image.split("_")[-1][:2]
162
- image_name = image.split("/")[3]
163
- img = self.extract_shapes_from_tracks(root, image_name, i)
164
-
165
- image_id = img.get("id")
166
- name = img.get("name")
167
- shapes = [self.parse_shape(shape) for shape in img]
168
-
169
- yield idx, {
170
- "id": image_id,
171
- "name": image,
172
- "image": image,
173
- "mask": image,
174
- "shapes": shapes,
175
- }
 
81
  def _split_generators(self, dl_manager):
82
  images = dl_manager.download_and_extract(f"{_DATA}{self.config.name}.zip")
83
  annotations = dl_manager.download(f"{_DATA}{self.config.name}.xml")
84
+ # images = dl_manager.iter_files(images)
85
  return [
86
  datasets.SplitGenerator(
87
  name=datasets.Split.TRAIN,
 
156
  tree = ET.parse(annotations)
157
  root = tree.getroot()
158
 
159
+ for idx, file in enumerate(sorted(os.listdir(f"{images}/images"))):
160
+ img = self.extract_shapes_from_tracks(root, file, idx)
161
+
162
+ image_id = img.get("id")
163
+ name = img.get("name")
164
+ shapes = [self.parse_shape(shape) for shape in img]
165
+
166
+ yield idx, {
167
+ "id": image_id,
168
+ "name": name,
169
+ "image": f"{images}/images/{file}",
170
+ "mask": f"{images}/masks/{file}",
171
+ "shapes": shapes,
172
+ }