1111def visualize_model (model_cfg : Union [str , mmcv .Config ],
1212 deploy_cfg : Union [str , mmcv .Config ],
1313 model : Union [str , Sequence [str ]],
14- img : Union [str , np .ndarray ],
14+ img : Union [str , np .ndarray , Sequence [ str ] ],
1515 device : str ,
1616 backend : Optional [Backend ] = None ,
1717 output_file : Optional [str ] = None ,
@@ -36,7 +36,8 @@ def visualize_model(model_cfg: Union[str, mmcv.Config],
3636 deploy_cfg (str | mmcv.Config): Deployment config file or Config
3737 object.
3838 model (str | list[str], BaseSubtask): Input model or file(s).
39- img (str | np.ndarray): Input image file or numpy array for inference.
39+ img (str | np.ndarray | Sequence[str]): Input image file(s) or numpy
40+ array for inference.
4041 device (str): A string specifying device type.
4142 backend (Backend): Specifying backend type, defaults to `None`.
4243 output_file (str): Output file to save visualized image, defaults to
@@ -74,14 +75,16 @@ def visualize_model(model_cfg: Union[str, mmcv.Config],
7475 # check headless
7576 import tkinter
7677 tkinter .Tk ()
77-
78- task_processor .visualize (
79- image = img ,
80- model = model ,
81- result = result ,
82- output_file = output_file ,
83- window_name = backend .value ,
84- show_result = show_result )
78+ if not isinstance (img , Sequence ):
79+ img = [img ]
80+ for single_img in img :
81+ task_processor .visualize (
82+ image = single_img ,
83+ model = model ,
84+ result = result ,
85+ output_file = output_file ,
86+ window_name = backend .value ,
87+ show_result = show_result )
8588 except Exception as e :
8689 from mmdeploy .utils import get_root_logger
8790 logger = get_root_logger ()
0 commit comments