$ docker pull ghcr.io/pinto0309/mmaction2onnxexpenv:latest
$ git clone https://github.com/open-mmlab/mmaction2.git && cd mmaction2
$ git checkout 6ea00d23d66fd491bbf19317b4677bf6f396d26f
$ mkdir -p data
$ docker run --rm -it --gpus all --shm-size 10gb \
-v `pwd`:/home/user/workdir \
ghcr.io/pinto0309/mmaction2onnxexpenv:latest
$ git clone https://github.com/PINTO0309/mmaction2-onnx-export-env.git && cd mmaction2-onnx-export-env
$ git clone https://github.com/open-mmlab/mmaction2.git && cd mmaction2
$ git checkout 6ea00d23d66fd491bbf19317b4677bf6f396d26f
$ mkdir -p data
$ mv docker/Dockerfile docker/Dockerfile_org
$ cp ../Dockerfile docker/Dockerfile
$ docker build -t mmaction2onnxexpenv -f docker/Dockerfile .
$ docker run --rm -it --gpus all --shm-size 10gb \
-v `pwd`:/home/user/workdir \
ghcr.io/pinto0309/mmaction2onnxexpenv:latest
- Recognizers
- TSN: $batch $clip $channel $height $width 1 1 3 224 224
- I3D: $batch $clip $channel $time $height $width 1 1 3 32 224 224
$ python tools/deployment/pytorch2onnx.py \
${CONFIG_FILE} \
${CHECKPOINT_FILE} \
--shape ${SHAPE} \
--verify \
--output-file ${OUTPUT_FILE} \
--opset-version 11
========================================
- Localizers
- BSN etc: Default 1 1 3 224 224
$ python tools/deployment/pytorch2onnx.py \
${CONFIG_FILE} \
${CHECKPOINT_FILE} \
--shape ${SHAPE} \
--verify \
--output-file ${OUTPUT_FILE} \
--is-localizer \
--opset-version 11
# PoseC3D - FineGYM/NTU60/NTU120
## config
wget https://github.com/open-mmlab/mmaction2/raw/master/configs/skeleton/posec3d/slowonly_r50_u48_240e_gym_keypoint.py
wget https://github.com/open-mmlab/mmaction2/raw/master/configs/skeleton/posec3d/slowonly_r50_u48_240e_gym_limb.py
wget https://github.com/open-mmlab/mmaction2/raw/master/configs/skeleton/posec3d/slowonly_r50_u48_240e_ntu60_xsub_keypoint.py
wget https://github.com/open-mmlab/mmaction2/raw/master/configs/skeleton/posec3d/slowonly_r50_u48_240e_ntu60_xsub_limb.py
wget https://github.com/open-mmlab/mmaction2/raw/master/configs/skeleton/posec3d/slowonly_r50_u48_240e_ntu120_xsub_keypoint.py
wget https://github.com/open-mmlab/mmaction2/raw/master/configs/skeleton/posec3d/slowonly_r50_u48_240e_ntu120_xsub_limb.py
## checkpoint
wget https://download.openmmlab.com/mmaction/skeleton/posec3d/slowonly_r50_u48_240e_gym_keypoint/slowonly_r50_u48_240e_gym_keypoint-b07a98a0.pth -O slowonly_r50_u48_240e_gym_keypoint.pth
wget https://download.openmmlab.com/mmaction/skeleton/posec3d/slowonly_r50_u48_240e_gym_limb/slowonly_r50_u48_240e_gym_limb-c0d7b482.pth -O slowonly_r50_u48_240e_gym_limb.pth
wget https://download.openmmlab.com/mmaction/skeleton/posec3d/slowonly_r50_u48_240e_ntu60_xsub_keypoint/slowonly_r50_u48_240e_ntu60_xsub_keypoint-f3adabf1.pth -O slowonly_r50_u48_240e_ntu60_xsub_keypoint.pth
wget https://download.openmmlab.com/mmaction/skeleton/posec3d/slowonly_r50_u48_240e_ntu60_xsub_limb/slowonly_r50_u48_240e_ntu60_xsub_limb-1d69006a.pth -O slowonly_r50_u48_240e_ntu60_xsub_limb.pth
wget https://download.openmmlab.com/mmaction/skeleton/posec3d/slowonly_r50_u48_240e_ntu120_xsub_keypoint/slowonly_r50_u48_240e_ntu120_xsub_keypoint-6736b03f.pth -O slowonly_r50_u48_240e_ntu120_xsub_keypoint.pth
wget https://download.openmmlab.com/mmaction/skeleton/posec3d/slowonly_r50_u48_240e_ntu120_xsub_limb/slowonly_r50_u48_240e_ntu120_xsub_limb-803c2317.pth -O slowonly_r50_u48_240e_ntu120_xsub_limb.pth
KEYPOINTS=17 \
&& FRAMES=30 \
&& H=64 \
&& W=64 \
&& BATCH=1 \
&& CLIP=2
MODEL=slowonly_r50_u48_240e_gym_keypoint \
&& python tools/deployment/pytorch2onnx.py \
${MODEL}.py \
${MODEL}.pth \
--shape ${BATCH} ${CLIP} ${KEYPOINTS} ${FRAMES} ${H} ${W} \
--verify \
--output-file ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx \
--opset-version 11 \
--softmax \
&& onnxsim ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx
MODEL=slowonly_r50_u48_240e_gym_limb \
&& python tools/deployment/pytorch2onnx.py \
${MODEL}.py \
${MODEL}.pth \
--shape ${BATCH} ${CLIP} ${KEYPOINTS} ${FRAMES} ${H} ${W} \
--verify \
--output-file ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx \
--opset-version 11 \
--softmax \
&& onnxsim ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx
MODEL=slowonly_r50_u48_240e_ntu60_xsub_keypoint \
&& python tools/deployment/pytorch2onnx.py \
${MODEL}.py \
${MODEL}.pth \
--shape ${BATCH} ${CLIP} ${KEYPOINTS} ${FRAMES} ${H} ${W} \
--verify \
--output-file ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx \
--opset-version 11 \
--softmax \
&& onnxsim ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx
MODEL=slowonly_r50_u48_240e_ntu60_xsub_limb \
&& python tools/deployment/pytorch2onnx.py \
${MODEL}.py \
${MODEL}.pth \
--shape ${BATCH} ${CLIP} ${KEYPOINTS} ${FRAMES} ${H} ${W} \
--verify \
--output-file ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx \
--opset-version 11 \
--softmax \
&& onnxsim ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx
MODEL=slowonly_r50_u48_240e_ntu120_xsub_keypoint \
&& python tools/deployment/pytorch2onnx.py \
${MODEL}.py \
${MODEL}.pth \
--shape ${BATCH} ${CLIP} ${KEYPOINTS} ${FRAMES} ${H} ${W} \
--verify \
--output-file ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx \
--opset-version 11 \
--softmax \
&& onnxsim ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx
MODEL=slowonly_r50_u48_240e_ntu120_xsub_limb \
&& python tools/deployment/pytorch2onnx.py \
${MODEL}.py \
${MODEL}.pth \
--shape ${BATCH} ${CLIP} ${KEYPOINTS} ${FRAMES} ${H} ${W} \
--verify \
--output-file ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx \
--opset-version 11 \
--softmax \
&& onnxsim ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx ${MODEL}_${BATCH}x${CLIP}x${KEYPOINTS}x${FRAMES}x${H}x${W}.onnx
- Spatio Temporal Action Detection Models
- Action Localization Models
- Action Recognition Models
- Skeleton-based Action Recognition Models