爱购彩

  • <tr id='e6R7w9'><strong id='e6R7w9'></strong><small id='e6R7w9'></small><button id='e6R7w9'></button><li id='e6R7w9'><noscript id='e6R7w9'><big id='e6R7w9'></big><dt id='e6R7w9'></dt></noscript></li></tr><ol id='e6R7w9'><option id='e6R7w9'><table id='e6R7w9'><blockquote id='e6R7w9'><tbody id='e6R7w9'></tbody></blockquote></table></option></ol><u id='e6R7w9'></u><kbd id='e6R7w9'><kbd id='e6R7w9'></kbd></kbd>

    <code id='e6R7w9'><strong id='e6R7w9'></strong></code>

    <fieldset id='e6R7w9'></fieldset>
          <span id='e6R7w9'></span>

              <ins id='e6R7w9'></ins>
              <acronym id='e6R7w9'><em id='e6R7w9'></em><td id='e6R7w9'><div id='e6R7w9'></div></td></acronym><address id='e6R7w9'><big id='e6R7w9'><big id='e6R7w9'></big><legend id='e6R7w9'></legend></big></address>

              <i id='e6R7w9'><div id='e6R7w9'><ins id='e6R7w9'></ins></div></i>
              <i id='e6R7w9'></i>
            1. <dl id='e6R7w9'></dl>
              1. <blockquote id='e6R7w9'><q id='e6R7w9'><noscript id='e6R7w9'></noscript><dt id='e6R7w9'></dt></q></blockquote><noframes id='e6R7w9'><i id='e6R7w9'></i>

                Atlas200用Presenter Server做推『理结果显示

                Atlas200用Presenter Server做推理结果显示

                Atlas200用Presenter Server做推理结果显示

                Atlas200  用 Presenter Server 做推理结果显示

                200DK有两个摄像头的接口,早在两年前,张小白就在早期CANN版本中试过摄像头:

                 

                当然也要注意里面的坑,比如说接口中排线的◤方向等等。

                我们下面看看,在CANN 5.0.4 alpha005的版本对摄像头的】支持如何:

                1、在200DK上执行ascend camera例程

                根据:https://gitee.com/ascend/samples/tree/v0.6.0
                /cplusplus/level1_single_api/5_200dk_peripheral/ascendcamera

                cd samples/cplusplus/level1_single_api/5_200dk_peripheral/ascendcamera

                mkdir -p build/intermediates/host

                cd build/intermediates/host

                cmake ../../../src -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_SKIP_RPATH=TRUE

                make

                cd $HOME/samples/cplusplus/level1_single_api/5_200dk_peripheral/ascendcamera/out

                mkdir output

                摄像头1:

                ./main -i -c 1 -o ./output/filename.jpg --overwrite

                摄像头0:

                ./main -i -c 0 -o ./output/filename0.jpg --overwrite

                从宿主机将结果文件拷贝回来:

                mkdir camera

                cd camera

                scp HwHiAiUser@192.168.1.2:~/samples/cplusplus
                /level1_single_api/5_200dk_peripheral/ascendcamera/out/output/*.jpg .

                打开看看:


                说明这两个摄像头拍照都没(太大的)问题。(尽管这个带夜视的廉@ 价摄像头是一如既往的发红。。)

                2、在200DK上执行face_detection_camera例程

                根据 https://gitee.com/ascend/samples/tree/v0.6.0/cplusplus
                /level2_simple_inference/2_object_detection/face_detection_camera

                执行以◆下脚本下载caffe模型,并转换为om模型:

                cd ${HOME}/samples/cplusplus/level2_simple_inference/2_object_detection/face_detection_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_detection_camera/insert_op.cfg

                atc --output_type=FP32 --input_shape="data:1,3,300,300" --weight=./face_detection_fp32.caffemodel --input_format=NCHW --output=./face_detection --soc_version=Ascend310 --insert_op_conf=./insert_op.cfg --framework=0 --save_original_model=false --model=./face_detection.prototxt

                编译:

                cd ~/samples/cplusplus/level2_simple_inference/2_object_detection/face_detection_camera/scripts

                bash ./sample_build.sh

                运行:

                bash sample_run.sh

                具体报错如下:

                HwHiAiUser@davinci-mini:~/samples/cplusplus/level2_simple_inference/2_object_detection/face_detection_camera/scripts$ bash sample_run.sh

                [INFO] The sample starts to run

                Current environment valid ip list:

                       127.0.0.1

                       192.168.199.204

                Please choose one to show the presenter in browser:192.168.199.204

                [INFO]  Acl init ok

                [INFO]  Open device 0 ok

                [INFO]  Use default context currently

                content_type config string:1

                [INFO]  dvpp init resource ok

                [INFO]  Load model ../model/face_detection.om success

                [INFO]  Create model description success

                [INFO]  Create model(../model/face_detection.om) output success

                [INFO]  Init model ../model/face_detection.om success

                [INFO]  No specified carmera id, use camera0

                [ERROR]  Set camera fps failed

                [ERROR]  Set camera0 property failed

                [ERROR]  Open camera failed

                [2022-04-23 18:24:44][LIBMEDIA_ERROR] CloseCamera failed!!! Camera[0] is not opened

                [ERROR]  Close camera 0 failed

                [INFO]  Unload model ../model/face_detection.om success

                [INFO]  destroy context ok

                [INFO]  Reset device 0 ok

                [INFO]  Finalize acl ok

                [INFO] The program runs successfully, Please visit http://192.168.199.204:7007 for display server!

                Enter any command to stop the application:

                 kill existing project process: kill -9 3147.

                /home/HwHiAiUser/Ascend/thirdpart/aarch64/common/sample_common.sh: line 40: kill: (3147) - No such process

                ERROR: kill project process failed.

                经过专家↑指点,是目前摄像头相关底层代码的fps设置有误:

                当然,专家的指点只是一个方向,代码具体的实现张小白仔细看了一下,face_detection_camera 调用的是acllite。

                首先,main.cpp调用了 ~/samples/cplusplus/common/acllite/src/AclLiteVideoProc.cpp:

                然后,位于 /home/HwHiAiUser/samples/cplusplus/common/acllite/src 的 AclLiteVideoProc.cpp 调用了CameraCapture:

                由于不知道它调了哪个,所以两边都加了个日志。

                最后在 ./samples/cplusplus/common/acllite/src/CameraCapture.cpp 的 SetProperty设置属性:

                张小白对于代码逻辑都没⊙改,只是加了几行日志。

                然后

                cd ~/samples/cplusplus/common/acllite

                make


                make install

                再回到工程目录:

                cd ~/samples/cplusplus/level2_simple_inference/2_object_detection/face_detection_camera/scripts

                bash sample_build.sh

                bash sample_run.sh

                此时,代码正在运ㄨ行,浏览器打开 192.168.199.204:7007

                出现了Presenter Server的页面,点击person可以打开:


                可以看到,视频中的人脸可以被成功▓识别。

                (未完待续)

                 

                 

                 

                订阅快讯

                通过卐快讯订阅,您将及时收到我们的信息更新通知。