This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728的opencv SVM问题

Other Parts Discussed in Thread: AM5728

我用的am5728, 自带的opencv是3.1.0版本,支持ml模块,但是调用haveSVM返回0,请问怎么开启SVM支持功能?

  • 我重新编译了一下ti的opencv3.1.0,加入了编译选项opencl_svm,然后运行时提示svminit 返回错误CL_INVALID_VALUE, AM5728的dsp不支持SVM吗?
  • 请关注下面的帖子,要到下周才有回复了。
    e2e.ti.com/.../774567
  • 不清楚在自己交叉编译opencv加入OPENCL选项的时候是不是一样的
  • My source code is from git://git.ti.com/opencv/tiopencv.git . I open the compiled option "WITH_OPENCL_SVM ".
    NOTICE:
    In file included from /media/gtguo/911001D492D4A8AF/ti/tiopencv/modules/core/src/ocl.cpp:1479:0:
    /media/gtguo/911001D492D4A8AF/ti/tiopencv/modules/core/include/opencv2/core/opencl/runtime/opencl_svm_hsa_extension.hpp:78:3: error: expected initializer before 'CL_EXT_SUFFIX__VERSION_1_2'
    ) CL_EXT_SUFFIX__VERSION_1_2;

    WHY?
  • root@embest-am57xx:~# ./OPENCV_CANNY
    haveSVM = 1
    haveOPENCL = 1
    Error on line 2632 (ocl.cpp): CL_DEVICE_SVM_CAPABILITIES via clGetDeviceInfo failed: -30
    sh: -c: line 0: syntax error near unexpected token `('
    sh: -c: line 0: `clocl -d -I. -D RADIUSX=2 -D LSIZE0=16 -D LSIZE1=16 -D CN=1 -D BORDER_REFLECT_101 -D NO_EXTRA_EXTRAPOLATION -D NO_BOR'
    /tmp/openclt58qQy.cl:59:21: error: array is too large (1207959696 elements)
    /tmp/openclt58qQy.cl:72:19: error: array is too large (1140850756 elements)
    OpenCL program build log: -D WITH_SOBEL -D cn=1 -D TYPE=uchar -D convert_floatN=convert_float -D floatN=float -D GRP_SIZEX=32 -D GRP_S2
    /tmp/openclt58qQy.cl:59:21: error: array is too large (1207959696 elements)
    /tmp/openclt58qQy.cl:72:19: error: array is too large (1140850756 elements)
  • Current OpenCL device:
    Type = TI_DSP
    Name = TI Multicore C66 DSP
    Version = OpenCL 1.1 TI => Is it support OPENCL_SVM ?
    Compute units = 2
  • 你用的SDK是什么版本?

  • 完整的OPENCV使用教程请参考这个链接:www.ti.com/.../PROCESSOR-SDK-AM57X
  • I have used PLSDK 5.2 filesystem to test today, it was not OK stilly !

    test.cpp:

    #include <iostream>
    #include <opencv2/opencv.hpp>
    #include <opencv2/core/ocl.hpp>
    #include <unistd.h>
    using namespace std;
    using namespace cv;
    using namespace cv::ml;

    int main()
    {
    int result = 0;
    float response;
    UMat inMat;

    cout<<"haveOpenCL:";
    cout<<cv::ocl::haveOpenCL()<<endl;
    cout<<"useOpenCL:";
    cout<<cv::ocl::useOpenCL()<<endl;
    cout<<"haveSVM:";
    cout<<cv::ocl::haveSVM()<<endl;

    Ptr<SVM> svm = Algorithm::load<SVM>("model.xml");
    char buffer[40];
    for(int i=0;i<100;i++){
    memset(buffer,0,sizeof(buffer));
    sprintf(buffer,"./data/test_image/0/%d.jpg",i+400);
    imread(buffer).copyTo(inMat);
    UMat p = inMat.reshape(1, 1);
    p.convertTo(p, CV_32FC1);
    if(i==99){//while 1
    i=0;
    response = svm->predict(p);
    }
    if (response == 0)
    {
    result++;
    }
    }
    cout<<result<<endl;
    return 0;
    }

    root@am57xx-evm:/opt# ./TEST_SVM

    haveOpenCL:1

    useOpenCL:1

    haveSVM:0

    top to check cpu used:
    TEST_SVM used 94% CPU, it didn't used DSP by opencl.
    1144 root 20 0 267156 18644 15720 R 94.1 1.0 0:15.68 TEST_SVM
  • 这里有opencl的使用指南和示例代码:downloads.ti.com/.../intro.html
x 出现错误。请重试或与管理员联系。