Skip to content

Commit

Permalink
fix(demo & tools): path issues of Windows system (Megvii-BaseDetectio…
Browse files Browse the repository at this point in the history
…n#1100)

fix(demo & tools): path issues of Windows system
robin-maillot authored Jan 27, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 856bf0f commit 6b49fd2
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
@@ -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}")
2 changes: 1 addition & 1 deletion demo/ONNXRuntime/onnx_inference.py
Original file line number Diff line number Diff line change
@@ -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
@@ -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)


2 changes: 1 addition & 1 deletion tools/demo.py
Original file line number Diff line number Diff line change
@@ -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}")
2 changes: 1 addition & 1 deletion yolox/data/datasets/coco.py
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion yolox/data/datasets/voc.py
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 6b49fd2

Please sign in to comment.