0

Hello I'm currently working on yolov5 with openvino using c++, I got this error

Unhandled exception thrown: write access violation. blob_data was 0x11102E62ECB8182

the type of blob_data is float* and also had this message in the output

Exception thrown at 0x00007FFF03654ED9 in ylov5_openvino.exe: Microsoft C++ exception: InferenceEngine::NotImplemented at memory location 0x000000BF095FBEC0

I used try{} catch{} but it didn't solve my issue! any help please ? Here's my code :

  bool Detector::init(string xml_path,double cof_threshold,double nms_area_threshold){
    _xml_path = xml_path;
    _cof_threshold = cof_threshold;
    _nms_area_threshold = nms_area_threshold;
    Core ie;
    auto cnnNetwork = ie.ReadNetwork(_xml_path); 

    InputsDataMap inputInfo(cnnNetwork.getInputsInfo());
    InputInfo::Ptr& input = inputInfo.begin()->second;
    _input_name = inputInfo.begin()->first;
    input->setPrecision(Precision::FP32);
    input->getInputData()->setLayout(Layout::NCHW);
    ICNNNetwork::InputShapes inputShapes = cnnNetwork.getInputShapes();
    SizeVector& inSizeVector = inputShapes.begin()->second;
    cnnNetwork.reshape(inputShapes);

    _outputinfo = OutputsDataMap(cnnNetwork.getOutputsInfo());
    for (auto &output : _outputinfo) {
        output.second->setPrecision(Precision::FP32);
    }

    //_network =  ie.LoadNetwork(cnnNetwork, "GPU");
    _network =  ie.LoadNetwork(cnnNetwork, "CPU");
    return true;
}


bool Detector::uninit(){
    return true;
}


bool Detector::process_frame(Mat& inframe,vector<Object>& detected_objects){
    if(inframe.empty()){
        cout << "Invalid picture input" << endl;
        return false;
    }
    resize(inframe,inframe,Size(640,640));
    cvtColor(inframe,inframe,COLOR_BGR2RGB);
    size_t img_size = 640*640;
    //InferRequest  infer_request = _network.CreateInferRequest();
    InferenceEngine::InferRequest infer_request = _network.CreateInferRequest();
    //InferRequest::Ptr infer_request = _network.CreateInferRequestPtr();
    Blob::Ptr frameBlob = infer_request.GetBlob(_input_name);
    InferenceEngine::LockedMemory<void> blobMapped = InferenceEngine::as<InferenceEngine::MemoryBlob>(frameBlob)->wmap();
    float* blob_data = blobMapped.as<float*>();
    //nchw
    for(size_t row =0;row<640;row++){
        for(size_t col=0;col<640;col++){
            for(size_t ch =0;ch<3;ch++){
               blob_data[img_size*ch + row*640 + col] =  float (inframe.at<Vec3b>(row,col)[ch])/255.0f;
            }
        }
    }

Thanks in advance.

1 Answers1

0

This inquiry is similar to this GitHub thread: #7248

Your problem seems like whether you didn't install something properly or you didn't run the setupvars script before running an inference.

There are also possibilities whether layer/topology is not supported in your Yolov5 model.

Rommel_Intel
  • 1,369
  • 1
  • 4
  • 8