shikunl commited on
Commit
bf8ebbc
1 Parent(s): 31d8bef

Fix parallization

Browse files
Files changed (1) hide show
  1. prismer_model.py +4 -2
prismer_model.py CHANGED
@@ -63,10 +63,12 @@ def run_experts(image_path: str) -> tuple[str | None, ...]:
63
  out_path = image_dir / 'image.jpg'
64
  cv2.imwrite(out_path.as_posix(), cv2.imread(image_path))
65
 
66
- expert_names = ['edge', 'normal', 'objdet', 'ocrdet', 'segmentation']
67
  run_expert('depth')
68
  with concurrent.futures.ProcessPoolExecutor() as executor:
69
- executor.map(run_expert, expert_names)
 
 
 
70
 
71
  keys = ['depth', 'edge', 'normal', 'seg_coco', 'obj_detection', 'ocr_detection']
72
  results = [pathlib.Path('prismer/helpers/labels') / key / 'helpers/images/image.png' for key in keys]
 
63
  out_path = image_dir / 'image.jpg'
64
  cv2.imwrite(out_path.as_posix(), cv2.imread(image_path))
65
 
 
66
  run_expert('depth')
67
  with concurrent.futures.ProcessPoolExecutor() as executor:
68
+ executor.map(run_expert, ['edge', 'normal', 'objdet'])
69
+
70
+ with concurrent.futures.ProcessPoolExecutor() as executor:
71
+ executor.map(run_expert, ['ocrdet', 'segmentation'])
72
 
73
  keys = ['depth', 'edge', 'normal', 'seg_coco', 'obj_detection', 'ocr_detection']
74
  results = [pathlib.Path('prismer/helpers/labels') / key / 'helpers/images/image.png' for key in keys]