chanelcolgate commited on
Commit
d2b51c2
1 Parent(s): 325e195

modified: yenthienviet.py

Browse files
Files changed (1) hide show
  1. yenthienviet.py +8 -6
yenthienviet.py CHANGED
@@ -1,12 +1,10 @@
1
  import json
 
2
  from pathlib import Path
3
- from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
4
 
5
  import datasets
6
- from datasets.data_files import DataFilesDict
7
  from datasets.download.download_manager import ArchiveIterable, DownloadManager
8
- from datasets.features import Features
9
- from datasets.info import DatasetInfo
10
 
11
  # Typing
12
  _TYPING_BOX = Tuple[float, float, float, float]
@@ -191,10 +189,14 @@ class COCOThienviet(datasets.GeneratorBasedBuilder):
191
  coco_annotation = COCOHelper(annotation_path, images_dir)
192
 
193
  for image_path, f in images:
194
- annotations = coco_annotation.get_annotations(image_path)
 
 
195
  ret = {
196
  "image": {"path": image_path, "bytes": f.read()},
197
- "image_id": coco_annotation.get_image_id(image_path),
 
 
198
  "objects": [
199
  {
200
  "id": annot["id"],
 
1
  import json
2
+ import os
3
  from pathlib import Path
4
+ from typing import Any, Dict, Iterator, List, Tuple, Union
5
 
6
  import datasets
 
7
  from datasets.download.download_manager import ArchiveIterable, DownloadManager
 
 
8
 
9
  # Typing
10
  _TYPING_BOX = Tuple[float, float, float, float]
 
189
  coco_annotation = COCOHelper(annotation_path, images_dir)
190
 
191
  for image_path, f in images:
192
+ annotations = coco_annotation.get_annotations(
193
+ os.path.normpath(image_path)
194
+ )
195
  ret = {
196
  "image": {"path": image_path, "bytes": f.read()},
197
+ "image_id": coco_annotation.get_image_id(
198
+ os.path.normpath(image_path)
199
+ ),
200
  "objects": [
201
  {
202
  "id": annot["id"],