獲取源碼包。
可以使用以下兩種方式下載,請選擇其中一種進行源碼準備。
# 開發環境,非root用戶命令行中執行以下命令下載源碼倉。
cd ${HOME}
git clone https://gitee.com/ascend/samples.git
git checkout v0.5.0
# 1. samples倉右上角選擇 【克隆/下載】 下拉框并選擇 【下載ZIP】。
# 2. 將ZIP包上傳到開發環境中的普通用戶家目錄中,【例如:${HOME}/ascend-samples-master.zip】。
# 3. 開發環境中,執行以下命令,解壓zip包。
cd ${HOME}
unzip ascend-samples-master.zip
模型轉換。
# 為了方便下載,在這里直接給出原始模型下載及模型轉換命令,可以直接拷貝執行。也可以參照上表在modelzoo中下載并手工轉換,以了解更多細節。
cd $HOME/samples/cplusplus/contrib/gesturedetection/model
wget https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/gesturedetection/pose_iter_440000.caffemodel
wget https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/gesturedetection/pose_deploy.prototxt
wget https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/gesturedetection/insert_op.cfg
wget https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/gesturedetection/stgcn_fps30_sta_ho_ki4.pb
atc --input_shape="input_features:1,2,30,14" --input_format=NCHW --output="./stgcn_fps30_sta_ho_ki4" --soc_version=Ascend310 --framework=3 --model=./stgcn_fps30_sta_ho_ki4.pb
atc --input_shape="data:1,3,128,128" --weight="./pose_iter_440000.caffemodel" --input_format=NCHW --output="./pose_deploy" --soc_version=Ascend310 --insert_op_conf=./insert_op.cfg --framework=0 --model=./pose_deploy.prototxt
執行以下命令,執行編譯腳本,開始樣例編譯。
cd $HOME/samples/cplusplus/contrib/gesturedetection/scripts
bash sample_build.sh
執行以下命令,將開發環境的 gesturedetection 目錄上傳到運行環境中,例如 /home/HwHiAiUser,并以HwHiAiUser(運行用戶)登錄運行環境(Host)。
# 【xxx.xxx.xxx.xxx】為運行環境ip,200DK在USB連接時一般為192.168.1.2,300(ai1s)為對應的公網ip。
scp -r $HOME/samples/cplusplus/contrib/gesturedetection/ HwHiAiUser@xxx.xxx.xxx.xxx:/home/HwHiAiUser
ssh HwHiAiUser@xxx.xxx.xxx.xxx
cd $HOME/samples/cplusplus/contrib/gesturedetection/scripts
bash sample_run.sh
運行完成后,會在運行環境的命令行中打印出推理結果。
請參考常見問題定位對遇到的錯誤進行排查。如果wiki中不包含,請在samples倉提issue反饋。