海思开发板——YOLOv3仿真调试(3)

1.打开sample_simulator

 

 2.打开srcmain.c文件,修改如下

int main(int argc, char* argv[])
{
    /*set stderr &stdout buffer to NULL to flush print info immediately*/
    setbuf(stderr, NULL);
    setbuf(stdout, NULL);

    /*Classificacion*/
    /*SvpSampleCnnClfLenet();
    SvpSampleCnnClfAlexnet();
    SvpSampleCnnClfVgg16();
    SvpSampleCnnClfGooglenet();
    SvpSampleCnnClfResnet50();
    SvpSampleCnnClfSqueezenet();*/

    /*Detection*/
    /*SvpSampleRoiDetFasterRCNNAlexnet();
    SvpSampleRoiDetFasterRCNNVGG16();
    SvpSampleRoiDetFasterRCNNResnet18();
    SvpSampleRoiDetFasterRCNNResnet34();
    SvpSampleRoiDetFasterRCNNPvanet();
    SvpSampleRoiDetFasterRCNNDoubleRoi();
    SvpSampleRoiDetRFCNResnet50();
    SvpSampleCnnDetYoloV1();
    SvpSampleCnnDetYoloV2();*/
    SvpSampleCnnDetYoloV3();
    //SvpSampleCnnDetSSD();

    /*Segmentation*/
    //SvpSampleCnnFcnSegnet();

    /*LSTM*/
    //SvpSampleRecurrentLSTMFC();
    //SvpSampleRecurrentLSTMRelu();

    //printf("press any key to exit ... 
");
    //getchar();

    return 0;
}

3.打开SvpSampleDetectionOneSeg.cpp

对yolov3路径进行修改。

const HI_CHAR *g_paszPicList_d[][SVP_NNIE_MAX_INPUT_NUM] = {
    { "../../data/detection/yolov1/image_test_list.txt" },
    { "../../data/detection/yolov2/image_test_list.txt" },
    { "../../data/detection/yolov3/imageList.txt" },
    { "../../data/detection/ssd/image_test_list.txt"    }
};

#ifndef USE_FUNC_SIM /* inst wk */
const HI_CHAR *g_paszModelName_d[] = {
    "../../data/detection/yolov1/inst/inst_yolov1_inst.wk",
    "../../data/detection/yolov2/inst/inst_yolov2_inst.wk",
    "../../data/detection/yolov3/inst/yolov3_inst.wk",
    "../../data/detection/ssd/inst/inst_ssd_inst.wk"
};
#else /* func wk */
const HI_CHAR *g_paszModelName_d[] = {
    "../../data/detection/yolov1/inst/inst_yolov1_func.wk",
    "../../data/detection/yolov2/inst/inst_yolov2_func.wk",
    "../../data/detection/yolov3/inst/yolov3_func.wk",
    "../../data/detection/ssd/inst/inst_ssd_func.wk"
};
#endif

4.打开includeSvpSampleYolo.h

不修改这部分会报error grid number!错误

/* YOLO V3 */
#define SVP_SAMPLE_YOLOV3_SRC_WIDTH                (416)//
#define SVP_SAMPLE_YOLOV3_SRC_HEIGHT               (416)

#define SVP_SAMPLE_YOLOV3_GRIDNUM_CONV_82          (13)//a = 608÷32 //参数值为图片大小除以32
#define SVP_SAMPLE_YOLOV3_GRIDNUM_CONV_94          (26)//b = a*2  //参数值为上一行参数乘2
#define SVP_SAMPLE_YOLOV3_GRIDNUM_CONV_106         (52)//c = b*2  //值为上一行参数乘以2
#define SVP_SAMPLE_YOLOV3_CHANNLENUM               (24)//值为  3x(5+ClassNum)
#define SVP_SAMPLE_YOLOV3_PARAMNUM                 (8)//值为  (5+ClassNum)
#define SVP_SAMPLE_YOLOV3_BOXNUM                   (3)
#define SVP_SAMPLE_YOLOV3_CLASSNUM                 (3)//ClassNum
#define SVP_SAMPLE_YOLOV3_MAX_BOX_NUM_PER_SCALE    (10)

5.编译

 

 选择relese版本,编译完成后,点击上图绿色运行按钮即可;

编译失败的话,可以选择

 右键Run As -> 1 Local C/C++ Application

 6.完成

原文地址:https://www.cnblogs.com/thunder-wu/p/14150599.html