You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
frommmpose.apisimportinference_topdown, init_modelfrommmpose.utilsimportregister_all_modulesimportcv2importtorchfrompytorch_nndctimportInspectorimporttorchvision.transformsastransformsfrommmpose.structuresimportPoseDataSampleimportnumpyasnpfrommmengine.registryimportinit_default_scopefrommmengine.datasetimportCompose, pseudo_collateregister_all_modules()
config_file='models/td-hm_hrnet-w48_8xb32-210e_coco-256x192.py'checkpoint_file='models/td-hm_hrnet-w48_8xb32-210e_coco-256x192-0e67c616_20220913.pth'model=init_model(config_file, checkpoint_file, device='cuda:0') # or device='cuda:0'img=cv2.imread("data/sample_input/Screenshot.png")
scope=model.cfg.get('default_scope', 'mmpose')
ifscopeisnotNone:
init_default_scope(scope)
pipeline=Compose(model.cfg.test_dataloader.dataset.pipeline)
h, w=img.shape[:2]
bboxes=np.array([[0, 0, w, h]], dtype=np.float32)
data_list= []
forbboxinbboxes:
ifisinstance(img, str):
data_info=dict(img_path=img)
else:
data_info=dict(img=img)
data_info['bbox'] =bbox[None] # shape (1, 4)data_info['bbox_score'] =np.ones(1, dtype=np.float32) # shape (1,)data_info.update(model.dataset_meta)
data_list.append(pipeline(data_info))
batch=pseudo_collate(data_list)
# Check if the model is a PyTorch modelifisinstance(model, torch.nn.Module):
print("This is a PyTorch model.")
else:
print("This is NOT a PyTorch model.")
# Specify a target name or fingerprint you want to deploy ontarget="DPUCZDX8G_ISA1_B4096"# Initialize inspector with targetinspector=Inspector(target)
device=torch.device("cuda"iftorch.cuda.is_available() else"cpu")
inspector.inspect(model, batch, device=device, output_dir="inspect", image_format="png")
From this I get the following error:
[VAIQ_NOTE]: Loading NNDCT kernels...
Loads checkpoint by local backend from path: models/td-hm_hrnet-w48_8xb32-210e_coco-256x192-0e67c616_20220913.pth
This is a PyTorch model.
[VAIQ_NOTE]: Inspector is on.
[VAIQ_NOTE]: =>Start to inspect model...
Traceback (most recent call last):
File "rtmpose_model_inspection.py", line 51, in<module>
inspector.inspect(model, batch, device=device, output_dir="inspect", image_format="png")
File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.7/site-packages/pytorch_nndct/apis.py", line 196, in inspect
self._inspector_impl.inspect(module, input_args, device, output_dir, verbose_level)
File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.7/site-packages/pytorch_nndct/hardware_v3/inspector.py", line 52, in inspect
dev_graph, deploy_graphs = prepare_deployable_graph(copied_model, input_args, device, output_dir)
File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.7/site-packages/pytorch_nndct/hardware_v3/utils.py", line 25, in prepare_deployable_graph
module, input_args = to_device(module, input_args, device)
File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.7/site-packages/pytorch_nndct/utils/module_util.py", line 382, in to_device
_, inp = to_device(None, input_args[i], device)
File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.7/site-packages/pytorch_nndct/utils/module_util.py", line 382, in to_device
_, inp = to_device(None, input_args[i], device)
File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.7/site-packages/pytorch_nndct/utils/module_util.py", line 382, in to_device
_, inp = to_device(None, input_args[i], device)
[Previous line repeated 990 more times]
File "/opt/vitis_ai/conda/envs/vitis-ai-pytorch/lib/python3.7/site-packages/pytorch_nndct/utils/module_util.py", line 376, in to_device
if isinstance(input_args, torch.Tensor):
RecursionError: maximum recursion depth exceeded while calling a Python object
Has anyone experienced this before? What could be causing this?
The text was updated successfully, but these errors were encountered:
System: WSL Ubuntu 20.04
Vitis Version: 3.0
I am running the following code:
From this I get the following error:
Has anyone experienced this before? What could be causing this?
The text was updated successfully, but these errors were encountered: