小编dav*_* ye的帖子

得到错误"预计arg [0]为uint8但提供了浮点数"运行tensorflow c ++时,谁知道如何修复它?

部分代码如下,

IplImage *pImg = cvLoadImage("img.bmp"? 1); 
IplImage *pImgF = cvCreateImage(cvGetSize(pImg),IPL_DEPTH_32F , 3);

cvConvert(pImg, pImgF);

tensorflow::Tensor input_tensor(tensorflow::DT_FLOAT,
tensorflow::TensorShape({ 1, input_height, input_width, 3 }));
auto input_tensor_mapped = input_tensor.tensor<float, 4>();

float *pSourceRow = (float *)pImgF->imageData;
int x, y, c;
int depth = 3;

for (int y = 0; y < height; ++y) {
    const float* source_row = pSourceRow + (y * width * depth);
    for (int x = 0; x < width; ++x) {
        const float *source_pixel = source_row + (x * depth); …
Run Code Online (Sandbox Code Playgroud)

c++ tensorflow

6
推荐指数
0
解决办法
1106
查看次数

标签 统计

c++ ×1

tensorflow ×1