in the sdk version26. ethosu_apps_rpmsg did not show the way to get result from ethosu.
how to do it?
The inference result is in the OFM buffer you pass into the job — ofm in your constructor. expectedOutput is only for the SDK example’s validation path; it is not where the calculated result is returned. The i.MX93 Ethos-U flow writes the completed inference result into the output feature-map buffer and, in the Linux/RPMsg flow, sends the response back to Cortex-A after the OFM is populated .
For your code, the important part is:
InferenceProcess::InferenceJob job(
"job",
networkModel,
ifm,
ofm, // <-- output buffer(s)
expectedOutput, // <-- reference/validation data, not the result
pmuEventConfig,
0,
ðosu_drv,
0,
nullptr,
0,
0,
false);
job.invalidate();
bool failed = inferenceprocess.runJob(job);
job.clean();
if (!failed)
{
// Read result from ofm
}
Conceptually:
Copy
if (!failed)
{
// Output tensor 0
uint8_t *outputData = ofm[0].data();
size_t outputSize = ofm[0].size();
for (size_t i = 0; i < outputSize; i++)
{
PRINTF("ofm[%u] = %d\r\n", i, outputData[i]);
}
}
Depending on the exact SDK type of ofm , the access may be slightly different, but the rule is the same: read from the same ofm buffer that you passed into InferenceJob .
If your model output is quantized, the bytes in ofm are usually int8_t or uint8_t , not final floating-point values. Convert them using the output tensor’s quantization parameters:
float real_value = (quantized_value - zero_point) * scale;
For example, for an int8 output:
int8_t *out = reinterpret_cast
for (size_t i = 0; i < outputSize; i++)
{
float y = (static_cast
PRINTF("out[%u] q=%d real=%f\r\n", i, out[i], y);
}
In the RPMsg case, remember that ethosu_apps_rpmsg is mainly the Cortex-M33 firmware service. It receives the request from Cortex-A, runs the Ethos-U job, writes the result into the OFM buffer, and returns the response over RPMsg . On the Cortex-A/Linux side, the documented API path is to access the OFM buffers, for example inf->getOfmBuffers() .
So:
The output of your calculation is already in ofm ; after a successful runJob(job) , read ofm[0] and interpret/dequantize it according to your model’s output tensor type.