vkashko commited on
Commit
e3e9ba3
·
1 Parent(s): e516451
Files changed (2) hide show
  1. README.md +9 -9
  2. dogs-video-object-tracking-dataset.py +13 -11
README.md CHANGED
@@ -45,10 +45,10 @@ dataset_info:
45
  dtype: string
46
  splits:
47
  - name: train
48
- num_bytes: 25910
49
  num_examples: 52
50
- download_size: 313334253
51
- dataset_size: 25910
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: 28900
89
  num_examples: 58
90
- download_size: 67368145
91
- dataset_size: 28900
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: 24416
129
  num_examples: 49
130
- download_size: 148418007
131
- dataset_size: 24416
132
  ---
133
 
134
  # Dogs Video Object Tracking Dataset
 
45
  dtype: string
46
  splits:
47
  - name: train
48
+ num_bytes: 18266
49
  num_examples: 52
50
+ download_size: 474311303
51
+ dataset_size: 18266
52
  - config_name: video_02
53
  features:
54
  - name: id
 
85
  dtype: string
86
  splits:
87
  - name: train
88
+ num_bytes: 20374
89
  num_examples: 58
90
+ download_size: 101046098
91
+ dataset_size: 20374
92
  - config_name: video_03
93
  features:
94
  - name: id
 
125
  dtype: string
126
  splits:
127
  - name: train
128
+ num_bytes: 17213
129
  num_examples: 49
130
+ download_size: 224796300
131
+ dataset_size: 17213
132
  ---
133
 
134
  # Dogs Video Object Tracking Dataset
dogs-video-object-tracking-dataset.py CHANGED
@@ -79,14 +79,16 @@ class DogsVideoObjectTrackingDataset(datasets.GeneratorBasedBuilder):
79
  )
80
 
81
  def _split_generators(self, dl_manager):
82
- data = dl_manager.download_and_extract(f"{_DATA}{self.config.name}.zip")
 
83
  annotations = dl_manager.download(f"{_DATA}{self.config.name}.xml")
84
- data = dl_manager.iter_files(data)
85
  return [
86
  datasets.SplitGenerator(
87
  name=datasets.Split.TRAIN,
88
  gen_kwargs={
89
- "data": data,
 
90
  "annotations": annotations,
91
  },
92
  ),
@@ -152,14 +154,14 @@ class DogsVideoObjectTrackingDataset(datasets.GeneratorBasedBuilder):
152
 
153
  return shape_data
154
 
155
- def _generate_examples(self, data, annotations):
156
  tree = ET.parse(annotations)
157
  root = tree.getroot()
158
 
159
- for idx, image_path in enumerate(data):
160
- if "images" in image_path:
161
- i = image_path.split("_")[-1][:2]
162
- image_name = image_path.split("/")[3]
163
  img = self.extract_shapes_from_tracks(root, image_name, i)
164
 
165
  image_id = img.get("id")
@@ -168,8 +170,8 @@ class DogsVideoObjectTrackingDataset(datasets.GeneratorBasedBuilder):
168
 
169
  yield idx, {
170
  "id": image_id,
171
- "name": image_path,
172
- "image": image_path,
173
- "mask": f"{image_path.replace('images', 'boxes')}",
174
  "shapes": shapes,
175
  }
 
79
  )
80
 
81
  def _split_generators(self, dl_manager):
82
+ images = dl_manager.download_and_extract(f"{_DATA}{self.config.name}.zip")
83
+ masks = dl_manager.download_and_extract(f"{_DATA}{self.config.name}_masks.zip")
84
  annotations = dl_manager.download(f"{_DATA}{self.config.name}.xml")
85
+ images = dl_manager.iter_files(images)
86
  return [
87
  datasets.SplitGenerator(
88
  name=datasets.Split.TRAIN,
89
  gen_kwargs={
90
+ "images": images,
91
+ "masks": masks,
92
  "annotations": annotations,
93
  },
94
  ),
 
154
 
155
  return shape_data
156
 
157
+ def _generate_examples(self, images, masks, annotations):
158
  tree = ET.parse(annotations)
159
  root = tree.getroot()
160
 
161
+ for idx, (image, mask) in enumerate(zip(images, masks)):
162
+ if "images" in image:
163
+ i = image.split("_")[-1][:2]
164
+ image_name = image.split("/")[3]
165
  img = self.extract_shapes_from_tracks(root, image_name, i)
166
 
167
  image_id = img.get("id")
 
170
 
171
  yield idx, {
172
  "id": image_id,
173
+ "name": image,
174
+ "image": image,
175
+ "mask": mask,
176
  "shapes": shapes,
177
  }