shikunl commited on
Commit
82b5fea
β€’
1 Parent(s): bf8ebbc

Fix resolution

Browse files
prismer/experts/model_bank.py CHANGED
@@ -40,7 +40,7 @@ def load_expert_model(task=None):
40
  cfg = setup_cfg(args)
41
  model = DefaultPredictor(cfg).model
42
  transform = transforms.Compose([
43
- transforms.Resize(size=479, max_size=480)
44
  ])
45
 
46
  elif task == 'seg_ade':
@@ -60,7 +60,7 @@ def load_expert_model(task=None):
60
  cfg = setup_cfg(args)
61
  model = DefaultPredictor(cfg).model
62
  transform = transforms.Compose([
63
- transforms.Resize(size=479, max_size=480)
64
  ])
65
 
66
  elif task == 'obj_detection':
@@ -81,7 +81,7 @@ def load_expert_model(task=None):
81
  cfg = setup_cfg(args)
82
  model = DefaultPredictor(cfg).model
83
  transform = transforms.Compose([
84
- transforms.Resize(size=479, max_size=480)
85
  ])
86
 
87
  elif task == 'ocr_detection':
 
40
  cfg = setup_cfg(args)
41
  model = DefaultPredictor(cfg).model
42
  transform = transforms.Compose([
43
+ transforms.Resize([480, 480])
44
  ])
45
 
46
  elif task == 'seg_ade':
 
60
  cfg = setup_cfg(args)
61
  model = DefaultPredictor(cfg).model
62
  transform = transforms.Compose([
63
+ transforms.Resize([480, 480])
64
  ])
65
 
66
  elif task == 'obj_detection':
 
81
  cfg = setup_cfg(args)
82
  model = DefaultPredictor(cfg).model
83
  transform = transforms.Compose([
84
+ transforms.Resize([480, 480])
85
  ])
86
 
87
  elif task == 'ocr_detection':
prismer_model.py CHANGED
@@ -63,12 +63,10 @@ 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
  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]
 
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]