日韩专区一区,亚洲va综合va国产va中文,黄色精品国产,欧美黑人一级视频

開發案例

開發案例

開發案例

人臉識別樣例

功能:通過攝像頭對視頻中的人臉信息進行預測,與已注冊的人臉進行比對,預測出最可能的用戶。
樣例輸入:攝像頭。
樣例輸出:presenter界面展現推理結果。

前置條件

請檢查以下條件要求是否滿足,如不滿足請按照備注進行相應處理。如果CANN版本升級,請同步檢查第三方依賴是否需要重新安裝(5.0.4及以上版本第三方依賴和5.0.4以下版本有差異,需要重新安裝)。

條件 要求 備注
CANN版本 >=5.0.4 請參考CANN樣例倉介紹中的安裝步驟完成CANN安裝,如果CANN低于要求版本請根據版本說明切換samples倉到對應CANN版本
硬件要求 Atlas200DK 攝像頭樣例僅在Atlas200D測試及運行,產品說明請參考硬件平臺
第三方依賴 presentagent,ffmpeg+acllite 請參考第三方依賴安裝指導(C++樣例)完成對應安裝

樣例準備

  1. 獲取源碼包。
    可以使用以下兩種方式下載,請選擇其中一種進行源碼準備。

    • 命令行方式下載(下載時間較長,但步驟簡單)。
      # 開發環境,非root用戶命令行中執行以下命令下載源碼倉。    
      cd ${HOME}     
      git clone https://gitee.com/ascend/samples.git
       
      注:如果需要切換到其它tag版本,以v0.5.0為例,可執行以下命令。
      git checkout v0.5.0
       
    • 壓縮包方式下載(下載時間較短,但步驟稍微復雜)。
      注:如果需要下載其它版本代碼,請先請根據前置條件說明進行samples倉分支切換。
       # 1. samples倉右上角選擇 【克隆/下載】 下拉框并選擇 【下載ZIP】。    
       # 2. 將ZIP包上傳到開發環境中的普通用戶家目錄中,【例如:${HOME}/ascend-samples-master.zip】。     
       # 3. 開發環境中,執行以下命令,解壓zip包。     
       cd ${HOME}    
       unzip ascend-samples-master.zip
       
  2. 獲取此應用中所需要的原始網絡模型。

    模型名稱 模型說明 模型下載路徑
    face_detection 人臉檢測網絡模型。是基于Caffe的Resnet10-SSD300模型轉換后的網絡模型。 請參考https://gitee.com/ascend/ModelZoo-TensorFlow/tree/master/TensorFlow/contrib/cv/facedetection/ATC_resnet10-SSD_caffe_AE目錄中README.md下載原始模型章節下載模型和權重文件。
    vanillacnn 人臉特征點標記網絡模型。是基于Caffe的VanillaCNN模型轉換后的網絡模型。 請參考https://gitee.com/ascend/ModelZoo-TensorFlow/tree/master/TensorFlow/contrib/cv/vanillacnn/ATC_vanillacnn_caffe_AE目錄中README.md下載原始模型章節下載模型和權重文件。
    sphereface 特征向量獲取網絡模型。是基于Caffe的SphereFace模型轉換后的網絡模型。 請參考https://gitee.com/ascend/ModelZoo-TensorFlow/tree/master/TensorFlow/contrib/cv/sphereface/ATC_sphereface_caffe_AE目錄中README.md下載原始模型章節下載模型和權重文件。
    # 為了方便下載,在這里直接給出原始模型下載及模型轉換命令,可以直接拷貝執行。也可以參照上表在modelzoo中下載并手工轉換,以了解更多細節。     
    cd ${HOME}/samples/cplusplus/level2_simple_inference/n_performance/1_multi_process_thread/face_recognition_camera/model
    wget https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/facedection/face_detection_fp32.caffemodel
    wget https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/facedection/face_detection.prototxt
    wget https://c7xcode.obs.cn-north-4.myhuaweicloud.com/models/face_recognition_camera/face_detection_insert_op.cfg
    atc --model=./face_detection.prototxt --weight=./face_detection_fp32.caffemodel --framework=0 --output=./face_detection --soc_version=Ascend310 --insert_op_conf=./face_detection_insert_op.cfg --input_shape="data:1,3,300,300" --input_format=NCHW 
    wget https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/vanillacnn/vanillacnn.caffemodel
    wget https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/vanillacnn/vanilla_deploy.prototxt
    atc --model=./vanilla_deploy.prototxt --weight=./vanillacnn.caffemodel --framework=0 --output=./vanillacnn --soc_version=Ascend310 --input_shape="data:4,3,40,40" --input_format=NCHW
    wget https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/sphereface/sphereface.caffemodel
    wget https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/sphereface/sphereface.prototxt
    wget https://c7xcode.obs.cn-north-4.myhuaweicloud.com/models/face_recognition_camera/sphereface_insert_op.cfg
    atc --model=./sphereface.prototxt --weight=./sphereface.caffemodel --framework=0 --output=./sphereface --soc_version=Ascend310 --insert_op_conf=./sphereface_insert_op.cfg --input_shape="data:8,3,112,96" --input_format=NCHW
     

樣例部署

執行以下命令,執行編譯腳本,開始樣例編譯。

cd ${HOME}/samples/cplusplus/level2_simple_inference/n_performance/1_multi_process_thread/face_recognition_camera/scripts    
bash sample_build.sh
 

樣例運行

注:開發環境與運行環境合一部署,請跳過步驟1,直接執行步驟2即可。

  1. 執行以下命令,將開發環境的 face_recognition_camera 目錄上傳到運行環境中,例如 /home/HwHiAiUser,并以HwHiAiUser(運行用戶)登錄運行環境(Host)。

    # 【xxx.xxx.xxx.xxx】為運行環境ip,200DK在USB連接時一般為192.168.1.2,300(ai1s)為對應的公網ip。
    scp -r ${HOME}/samples/cplusplus/level2_simple_inference/n_performance/1_multi_process_thread/face_recognition_camera HwHiAiUser@xxx.xxx.xxx.xxx:/home/HwHiAiUser    
    ssh HwHiAiUser@xxx.xxx.xxx.xxx     
    cd ${HOME}/face_recognition_camera/scripts
     
  2. 執行運行腳本,開始樣例運行。

    bash sample_run.sh
     

查看結果

  1. 打開presentserver網頁界面(打開啟動Presenter Server服務時提示的URL即可)。
  2. 等待Presenter Agent傳輸數據給服務端,單擊“Refresh“刷新,當有數據時相應的Channel 的Status變成綠色。
  3. 單擊右側對應的View Name鏈接,查看結果。

常見錯誤

請參考常見問題定位對遇到的錯誤進行排查。如果wiki中不包含,請在samples倉提issue反饋。

訂閱快訊

通過快訊訂閱,您將及時收到我們的信息更新通知。