Skip to content

Commit

Permalink
fix(demo & tools): path issues of Windows system (#1100)
Browse files Browse the repository at this point in the history
fix(demo & tools): path issues of Windows system
  • Loading branch information
robin-maillot committed Jan 27, 2022
1 parent 856bf0f commit 6b49fd2
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion demo/MegEngine/python/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def imageflow_demo(predictor, vis_folder, current_time, args):
)
os.makedirs(save_folder, exist_ok=True)
if args.demo == "video":
save_path = os.path.join(save_folder, args.path.split("/")[-1])
save_path = os.path.join(save_folder, os.path.basename(args.path))
else:
save_path = os.path.join(save_folder, "camera.mp4")
logger.info(f"video save_path is {save_path}")
Expand Down
2 changes: 1 addition & 1 deletion demo/ONNXRuntime/onnx_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ def make_parser():
conf=args.score_thr, class_names=COCO_CLASSES)

mkdir(args.output_dir)
output_path = os.path.join(args.output_dir, args.image_path.split("/")[-1])
output_path = os.path.join(args.output_dir, os.path.basename(args.image_path))
cv2.imwrite(output_path, origin_img)
2 changes: 1 addition & 1 deletion demo/OpenVINO/python/openvino_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def main():
conf=args.score_thr, class_names=COCO_CLASSES)

mkdir(args.output_dir)
output_path = os.path.join(args.output_dir, args.input.split("/")[-1])
output_path = os.path.join(args.output_dir, os.path.basename(args.input))
cv2.imwrite(output_path, origin_img)


Expand Down
2 changes: 1 addition & 1 deletion tools/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def imageflow_demo(predictor, vis_folder, current_time, args):
)
os.makedirs(save_folder, exist_ok=True)
if args.demo == "video":
save_path = os.path.join(save_folder, args.path.split("/")[-1])
save_path = os.path.join(save_folder, os.path.basename(args.path))
else:
save_path = os.path.join(save_folder, "camera.mp4")
logger.info(f"video save_path is {save_path}")
Expand Down
2 changes: 1 addition & 1 deletion yolox/data/datasets/coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _cache_images(self):
)
max_h = self.img_size[0]
max_w = self.img_size[1]
cache_file = self.data_dir + "/img_resized_cache_" + self.name + ".array"
cache_file = os.path.join(self.data_dir, f"img_resized_cache_{self.name}.array")
if not os.path.exists(cache_file):
logger.info(
"Caching images for the first time. This might take about 20 minutes for COCO"
Expand Down
2 changes: 1 addition & 1 deletion yolox/data/datasets/voc.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _cache_images(self):
)
max_h = self.img_size[0]
max_w = self.img_size[1]
cache_file = self.root + "/img_resized_cache_" + self.name + ".array"
cache_file = os.path.join(self.root, f"img_resized_cache_{self.name}.array")
if not os.path.exists(cache_file):
logger.info(
"Caching images for the first time. This might take about 3 minutes for VOC"
Expand Down

0 comments on commit 6b49fd2

Please sign in to comment.