robin-maillot commited on
Commit
7020e34
·
1 Parent(s): b772000

fix(demo & tools): path issues of Windows system (#1100)

Browse files
demo/MegEngine/python/demo.py CHANGED
@@ -182,7 +182,7 @@ def imageflow_demo(predictor, vis_folder, current_time, args):
182
  )
183
  os.makedirs(save_folder, exist_ok=True)
184
  if args.demo == "video":
185
- save_path = os.path.join(save_folder, args.path.split("/")[-1])
186
  else:
187
  save_path = os.path.join(save_folder, "camera.mp4")
188
  logger.info(f"video save_path is {save_path}")
 
182
  )
183
  os.makedirs(save_folder, exist_ok=True)
184
  if args.demo == "video":
185
+ save_path = os.path.join(save_folder, os.path.basename(args.path))
186
  else:
187
  save_path = os.path.join(save_folder, "camera.mp4")
188
  logger.info(f"video save_path is {save_path}")
demo/ONNXRuntime/onnx_inference.py CHANGED
@@ -88,5 +88,5 @@ if __name__ == '__main__':
88
  conf=args.score_thr, class_names=COCO_CLASSES)
89
 
90
  mkdir(args.output_dir)
91
- output_path = os.path.join(args.output_dir, args.image_path.split("/")[-1])
92
  cv2.imwrite(output_path, origin_img)
 
88
  conf=args.score_thr, class_names=COCO_CLASSES)
89
 
90
  mkdir(args.output_dir)
91
+ output_path = os.path.join(args.output_dir, os.path.basename(args.image_path))
92
  cv2.imwrite(output_path, origin_img)
demo/OpenVINO/python/openvino_inference.py CHANGED
@@ -148,7 +148,7 @@ def main():
148
  conf=args.score_thr, class_names=COCO_CLASSES)
149
 
150
  mkdir(args.output_dir)
151
- output_path = os.path.join(args.output_dir, args.input.split("/")[-1])
152
  cv2.imwrite(output_path, origin_img)
153
 
154
 
 
148
  conf=args.score_thr, class_names=COCO_CLASSES)
149
 
150
  mkdir(args.output_dir)
151
+ output_path = os.path.join(args.output_dir, os.path.basename(args.input))
152
  cv2.imwrite(output_path, origin_img)
153
 
154
 
tools/demo.py CHANGED
@@ -216,7 +216,7 @@ def imageflow_demo(predictor, vis_folder, current_time, args):
216
  )
217
  os.makedirs(save_folder, exist_ok=True)
218
  if args.demo == "video":
219
- save_path = os.path.join(save_folder, args.path.split("/")[-1])
220
  else:
221
  save_path = os.path.join(save_folder, "camera.mp4")
222
  logger.info(f"video save_path is {save_path}")
 
216
  )
217
  os.makedirs(save_folder, exist_ok=True)
218
  if args.demo == "video":
219
+ save_path = os.path.join(save_folder, os.path.basename(args.path))
220
  else:
221
  save_path = os.path.join(save_folder, "camera.mp4")
222
  logger.info(f"video save_path is {save_path}")
yolox/data/datasets/coco.py CHANGED
@@ -93,7 +93,7 @@ class COCODataset(Dataset):
93
  )
94
  max_h = self.img_size[0]
95
  max_w = self.img_size[1]
96
- cache_file = self.data_dir + "/img_resized_cache_" + self.name + ".array"
97
  if not os.path.exists(cache_file):
98
  logger.info(
99
  "Caching images for the first time. This might take about 20 minutes for COCO"
 
93
  )
94
  max_h = self.img_size[0]
95
  max_w = self.img_size[1]
96
+ cache_file = os.path.join(self.data_dir, f"img_resized_cache_{self.name}.array")
97
  if not os.path.exists(cache_file):
98
  logger.info(
99
  "Caching images for the first time. This might take about 20 minutes for COCO"
yolox/data/datasets/voc.py CHANGED
@@ -149,7 +149,7 @@ class VOCDetection(Dataset):
149
  )
150
  max_h = self.img_size[0]
151
  max_w = self.img_size[1]
152
- cache_file = self.root + "/img_resized_cache_" + self.name + ".array"
153
  if not os.path.exists(cache_file):
154
  logger.info(
155
  "Caching images for the first time. This might take about 3 minutes for VOC"
 
149
  )
150
  max_h = self.img_size[0]
151
  max_w = self.img_size[1]
152
+ cache_file = os.path.join(self.root, f"img_resized_cache_{self.name}.array")
153
  if not os.path.exists(cache_file):
154
  logger.info(
155
  "Caching images for the first time. This might take about 3 minutes for VOC"