我正在尝试在 iOS 上的 Tensorflow Lite 中使用 GPU 委托。我的模型的输入和输出为 OpenCV BGR 图像 ([258, 540, 3])。如何在 C++ tensorflow lite 解释器中设置输入和输出?我尝试使用此代码
int input = interpreter->inputs()[0];
float* out = interpreter->typed_tensor<float>(input);
NSData* slicedData = [self inputDataFromCvMat:slicedImage];
uint8_t* in = (uint8_t*) slicedData.bytes;
ProcessInputWithFloatModel(in, out, WIDTH, HEIGHT, CHANNELS);
Run Code Online (Sandbox Code Playgroud)
void ProcessInputWithFloatModel(uint8_t* input, float* buffer, int image_width, int image_height, int image_channels) {
for (int y = 0; y < wanted_input_height; ++y) {
float* out_row = buffer + (y * wanted_input_width * wanted_input_channels);
for (int x = 0; x < …Run Code Online (Sandbox Code Playgroud)