I was running a cpp program, when debugging, there occured the problem "Exception raised at (tensorflow_cc.dll) (in test2.exe): 0xC0000005: An access violation occurred while reading location 0x0000000000000018" at the sentence Status status = NewSession(SessionOptions(), &session)
, I was confused.
The tensorflow_cc.dll is in the same directory as cpp file.
I tried to debug the process, at the sentence tensorflow::Tensor input_tensor(DT_FLOAT, TensorShape({ 1,height,width,depth }))
it shows "No information available, no symbol loaded for tensorflow_cc.dll" information but no error,
and "Exception raised at (tensorflow_cc.dll) (in test2.exe): 0xC0000005: An access violation occurred while reading location 0x0000000000000018" at the sentence Status status = NewSession(SessionOptions(), &session)
int main() {
const std::string model_path = "weight.pb";
const std::string image_path = "image.png";
cv::Mat img = cv::imread(image_path);
if (img.empty())
{
cout << "can't open the image!!" << endl;
}
img.convertTo(img, CV_32FC1);
img = img / 255;
int height = img.rows;
int width = img.cols;
int depth = img.channels();
tensorflow::Tensor input_tensor(DT_FLOAT, TensorShape({ 1,height,width,depth }));
float *p = input_tensor.flat<float>().data();
Mat tempMat(height, width, CV_32FC1, p);
img.convertTo(tempMat, CV_32FC1);
//cout << input_tensor.DebugString() << endl;
Session* session;
Status status = NewSession(SessionOptions(), &session);
... ...
User contributions licensed under CC BY-SA 3.0