Open gorkanauta opened 1 year ago
@gorkanauta export_onnx_stdet.py
is used to export spatial-temporal detection models. ST-GCN is not supported now. You may do it by yourself, but we will also release soon. Please stay tuned.
Any advice on how to do it by myself? Thank you!
I did manage to export modifying the script, the exported model in onnx outputs values not normalized between 0 and 1 for each action. This is a sample output for the 5 class classifier I exported:
[array([[ 81.58998, 40.22279, -465.58243, 148.7499 , 194.898 ]], dtype=float32)]
Is this normal? Should I apply a sigmoid afterwards? Or is this an issue?
Branch
main branch (1.x version, such as
v1.0.0
, ordev-1.x
branch)Prerequisite
Environment
OS: Linux 8331746310b5 5.4.0-1104-gcp Python: PyTorch: 2.0.1+cu117 CUDA: 11.7 GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 PyTorch compiling details: sh: 1: python: not found PyTorch built with:
MMCV: 2.0.0 MMEngine: 0.7.3 MMAction2: 1.0.0
Describe the bug
Hello,
I have been trying to export an ST-GCN model trained on skeleton data to ONNX using the export_onnx_stdet.py script found in the MMAction2 repository, but I have encountered an issue.
My model takes in 3D skeleton data where the input shape consists of 51 frames, 17 joints and each joint has x, y, and score components. I am running the script on a GPU ("cuda:0"). The paths to my config file, checkpoint file and the script are as follows:
Config path: /workspaces/mmaction2-sng/configs/skeleton/stgcn/stgcn_8xb16-joint-u100-80e_ntu60-xsub-keypoint-2d.py Checkpoint path: /workspaces/mmaction2-sng/work_dirs/stgcn_8xb16-joint-u100-80e_ntu60-xsub-keypoint-2d/epoch_16.pth Script path: /workspaces/mmaction2-sng/tools/deployment/export_onnx_stdet.py Output file: action_detector.onnx When running the script, I encountered the following error:
AttributeError: 'RecognizerGCN' object has no attribute 'roi_head'
From my understanding, this is because the script was designed for models that use region-based detectors (thus the 'roi_head'), but the ST-GCN model is a graph-based model that doesn't need to detect regions of interest.
Could you please provide some guidance on how to export an ST-GCN model to ONNX using your library? Any help would be greatly appreciated.
Thank you!
Reproduces the problem - command or script
python /workspaces/mmaction2-sng/tools/deployment/export_onnx_stdet.py /workspaces/mmaction2-sng/configs/skeleton/stgcn/stgcn_8xb16-joint-u100-80e_ntu60-xsub-keypoint-2d.py /workspaces/mmaction2-sng/work_dirs/stgcn_8xb16-joint-u100-80e_ntu60-xsub-keypoint-2d/epoch_16.pth --num_frames 51 --shape 17 3 --device cuda:0 --output_file action_detector.onnx
Reproduces the problem - error message
AttributeError: 'RecognizerGCN' object has no attribute 'roi_head'