aaaaaa

[ WARN:[email protected]] global /home/pi/opencv460/opencv-4.6.0/modules/dnn/src/ocl4dnn/src/ocl4dnn_conv_spatial.cpp (1924) loadTunedConfig OpenCV(ocl4dnn): consider to specify kernel configuration cache directory through OPENCV_OCL4DNN_CONFIG_PATH parameter.
OpenCL program build log: dnn/dummy
Status -43: CL_INVALID_BUILD_OPTIONS
-cl-no-subgroup-ifp
error: unknown OpenCL C option '-cl-no-subgroup-ifp'

sudo cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_ENABLE_NONFREE=YES -D OPENCV_EXTRA_MODULES_PATH=/home/pi/opencv460/opencv_contrib-4.6.0/modules -D WITH_GTK=ON -D CMAKE_VERBOSE_MAKEFILE=ON -D WITH_OPENGL=ON -D WITH_FFMPEG=ON -D FFMPEG_INCLUDE_DIR=/usr/local/include -D FFMPEG_LIBRARY_DIR=/usr/local/lib ..

bool Yolo::readModel(Net& net, string& netPath, bool isCuda = false,bool isNpu = false) {
    try {
        net = readNet(netPath);
        //for (const cv::String& layerName : net.getLayerNames()) {
            //cout << layerName << " ";
        //}
        
    }
    catch (const std::exception&) {
        return false;
    }
    //cuda
    if (isCuda) {
        cout << "GPU" << endl;
        net.setPreferableBackend(cv::dnn::DNN_BACKEND_CUDA);
        net.setPreferableTarget(cv::dnn::DNN_TARGET_CUDA_FP16);
    }
    // NPU
    else if (isNpu) {
        
        // ÉèÖà NPU ºó¶ËºÍÄ¿±ê
        net.setPreferableBackend(cv::dnn::DNN_BACKEND_OPENCV);
        net.setPreferableTarget(cv::dnn::DNN_TARGET_OPENCL);
        cout << "NPU" << endl;
    }
    //cpu
    else {
        cout << "CPU" << endl;
        net.setPreferableBackend(cv::dnn::DNN_BACKEND_DEFAULT);
        net.setPreferableTarget(cv::dnn::DNN_TARGET_CPU);
    }
    
    return true;
}
 

你可能感兴趣的:(1024程序员节)