목차
안녕하세요 윤도현입니다. 이번 글에서는 DeepStream을 이용하여 Multi-stream Pose Estimation app을 제작해보겠습니다.
관련글
[1] [MLOps] Deepstream 1 - 기본개념
[2][MLOps] Deepstream 2 - 환경세팅(with docker)
1. 환경 설정
- Deepstream SDK 설치: 이전 글을 참조해주세요.
2. github clone
cd $DEEPSTREAM_DIR/sources/apps/sample_apps
git clone https://github.com/NVIDIA-AI-IOT/deepstream_pose_estimation.git
3. HRNet-pose-estimation 모델 준비
3.1 HRNet Pytorch model 준비
저는 공식 repo에서 pytorch model file을 다운받았습니다.
wget https://github.com/HRNet/HRNet-Human-Pose-Estimation/releases/download/v1.0/hrnet_w32-36af842e.pth
3.2 다운받은 Pytorch model을 onnx로 변환
import torch
import torch.onnx
import numpy as np
# 1. 네 HRNet PyTorch 모델 불러오기
from models.pose_hrnet import get_pose_net
from config import cfg
from config import update_config
update_config(cfg, 'experiments/hrnet_w32.yaml')
model = get_pose_net(cfg, is_train=False)
# 2. 모델에 pretrained weight 로드
checkpoint = torch.load('hrnet_w32-36af842e.pth', map_location='cpu')
model.load_state_dict(checkpoint)
model.eval()
# 3. 더미 입력 생성 (B, C, H, W)
dummy_input = torch.randn(1, 3, 256, 192) # HRNet 기본 input size
# 4. ONNX 변환
torch.onnx.export(model, dummy_input, "hrnet_pose_estimation.onnx",
input_names=["input"],
output_names=["heatmaps"],
dynamic_axes={
'input': {0: 'batch_size'},
'heatmaps': {0: 'batch_size'}
},
opset_version=11)
reference
[1] Building a Real-time Redaction App Using NVIDIA DeepStream, Part 1: Training
[2] Building a Real-time Redaction App Using NVIDIA DeepStream, Part 2: Deployment
[3] https://github.com/NVIDIA-AI-IOT/deepstream_pose_estimation?tab=readme-ov-file
'기본기 > MLOps' 카테고리의 다른 글
[MLOps] DeepStream 2 - 환경세팅(with docker) (0) | 2025.03.26 |
---|---|
[MLOps] Deepstream 1 - 기본개념 (0) | 2025.03.26 |
[MLOps] Airflow 3 - 실습(ML 모델 학습/실험 자동화) (0) | 2025.03.25 |
[MLOps] Airflow 2 - 환경세팅(with docker) (0) | 2025.03.25 |
[MLOps] Airflow 1 - 기본개념 (0) | 2025.03.25 |