Skip to content

Commit f088d2d

Browse files
author
mayong
committed
update files.
1 parent f43c032 commit f088d2d

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

dark2yolo.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ class YOLO2COCO:
2222
def __init__(self,genconfig_data):
2323
self.src_data=genconfig_data
2424
self.src=Path(self.src_data).parent
25-
self.dst=Path(self.src) / "coco"
25+
self.dst=Path(self.src) / "coco_dataset"
2626
self.coco_train="train2017"
27-
self.coco_valid="valid2017"
27+
self.coco_valid="val2017"
28+
self.coco_images="images"
2829
self.coco_annotation="annotations"
2930
self.coco_train_json=Path(self.dst)/Path(self.coco_annotation) / f'instances_{self.coco_train}.json'
3031
self.coco_valid_json=Path(self.dst)/Path(self.coco_annotation) / f'instances_{self.coco_valid}.json'
@@ -45,12 +46,15 @@ def __init__(self,genconfig_data):
4546
if not Path(self.dst).is_dir():
4647
Path(self.dst).mkdir()
4748

48-
if not (Path(self.dst )/ self.coco_train).is_dir():
49-
( Path(self.dst)/self.coco_train).mkdir()
49+
if not Path(self.dst/ self.coco_images).is_dir():
50+
Path(self.dst/self.coco_images).mkdir()
51+
52+
if not (Path(self.dst )/self.coco_images/ self.coco_train).is_dir():
53+
( Path(self.dst)/self.coco_images/self.coco_train).mkdir()
5054

5155

52-
if not (Path(self.dst )/ self.coco_valid).is_dir():
53-
( Path(self.dst)/self.coco_valid).mkdir()
56+
if not Path(self.dst /self.coco_images/ self.coco_valid).is_dir():
57+
( Path(self.dst)/self.coco_images/self.coco_valid).mkdir()
5458

5559

5660
if not (Path(self.dst )/ self.coco_annotation).is_dir():
@@ -169,10 +173,10 @@ def generate(self):
169173
self.name_lists=self.get_list(self.names)
170174
self.get_category()
171175

172-
dest_path_train=Path(self.dst)/self.coco_train
176+
dest_path_train=Path(self.dst)/ self.coco_images/self.coco_train
173177
self.gen_dataset(self.train_files,dest_path_train,self.coco_train_json)
174178

175-
dest_path_valid=Path(self.dst)/self.coco_valid
179+
dest_path_valid=Path(self.dst)/self.coco_images/self.coco_valid
176180

177181
self.gen_dataset(self.valid_files,dest_path_valid,self.coco_valid_json)
178182

0 commit comments

Comments
 (0)