mmdetection 학습모델을 빠른배포를 하고 싶은데, 기존의 onnx 나 tensorrt 가 지원이 안되는것 같다. (at HRNet)
그래서, 위 두가지 시도가 실패하고, mmdeploy를 설치해서 진행해보려고 한다.
참고: mmdeploy 시작하기
https://mmdeploy.readthedocs.io/en/latest/get_started.html#installation
참고: 도커로 설치하기
https://mmdeploy.readthedocs.io/en/latest/01-how-to-build/build_from_docker.html
jmahn@gpusystem:~$ export TAG=openmmlab/mmdeploy:ubuntu20.04-cuda11.3-mmdeploy
jmahn@gpusystem:~$ docker pull $TAG
jmahn@gpusystem:~$ sudo ufw allow 8011
[sudo] password for jmahn:
Rules updated
Rules updated (v6)
jmahn@gpusystem:~$ docker run --gpus all --name mmdeploy_ajm -v /data:/root/project/data -p 8011:8011 -it openmmlab/mmdeploy:ubuntu20.04-cuda11.3-mmdeploy bash
도커파일로 진행하는 설치가 되었는데, 실행에 실패했다. 그래서 아래처럼 다시 진행해본다.
이번에는 실행되는 mmdetection container 에서 가상환경을 만들어서 실행해본다
Method II: Build using scripts
If your target platform is Ubuntu 18.04 or later version, we encourage you to run scripts. For example, the following commands install mmdeploy as well as inference engine - ONNX Runtime.
git clone --recursive -b main https://github.com/open-mmlab/mmdeploy.git
cd mmdeploy
python3 tools/scripts/build_ubuntu_x64_ort.py $(nproc)
export PYTHONPATH=PYTHONPATH
export LD_LIBRARY_PATH=LD_LIBRARY_PATH
위 설정이 모두 끝나면 아래 코드를 실행해보면 에러없이 실행이 된다.
from mmdeploy.apis import torch2onnx
from mmdeploy.backend.sdk.export_info import export2SDK
from mmdeploy.apis.utils import build_task_processor
from mmdeploy.utils import get_input_shape, load_config