main.cpp 992 Bytes
Newer Older
Your Name's avatar
Your Name committed
1
2
3
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
shizhm's avatar
shizhm committed
4
5
6
7
8
9
#include <SimpleLog.h>
#include <Filesystem.h>
#include <VLPR.h>
#include <fstream>

int main()
Your Name's avatar
Your Name committed
10
{
shizhm's avatar
shizhm committed
11
    // 创建PaddleOCR车牌识别
liucong's avatar
liucong committed
12
13
14
    migraphxSamples::VLPR vlpr;
    migraphxSamples::InitializationParameterOfDB initParamOfDB; 
    migraphxSamples::InitializationParameterOfSVTR initParamOfSVTR;
shizhm's avatar
shizhm committed
15
16
17
    vlpr.Initialize(initParamOfDB, initParamOfSVTR);

    // 读取测试图片
liucong's avatar
liucong committed
18
    cv:: Mat Image=cv::imread("../Resource/Images/vlpr.jpg", 1);
shizhm's avatar
shizhm committed
19
20
21
22

    // 推理
    std::vector<std::string> recTexts;
    std::vector<float> recTextScores;
liucong's avatar
liucong committed
23
    double time1 = cv::getTickCount();
shizhm's avatar
shizhm committed
24
    vlpr.Infer(Image, recTexts, recTextScores); 
liucong's avatar
liucong committed
25
26
    double time2 = cv::getTickCount();
    double elapsedTime = (time2 - time1)*1000 / cv::getTickFrequency();
shizhm's avatar
shizhm committed
27
28
29
30
    LOG_INFO(stdout, "inference time:%f ms\n", elapsedTime);

    // 打印结果
    for (int i = 0; i < recTexts.size(); i++) 
Your Name's avatar
Your Name committed
31
    {
shizhm's avatar
shizhm committed
32
        printf("VLPR Result:%s\n", recTexts[i].c_str());
Your Name's avatar
Your Name committed
33
34
    }
}