Failure in run inference on esp32

I am working on 2 image detection work.

  1. visual emotion detection (happy,anger,Fear).
  2. Mask detection for Covid-19 Pandemic (A man wareing mask or not).

I am using esp32 AI-Thinker Cam arduino board.

When I Run inference, the inference output always (success : false.) . I can give you some screenshot of my failure .

Please help me to overcome this problem.

#TIA

Are you able to check the serial console output?
It might be useful, maybe unable to allocate the tensorflow arena?
Run the sketch keeping the usb wire connected to your PC and check the Serial console, easy if you are using arduino IDE.

Hello @edge7

thank you for your reply.
Yes I always open serial console when doing the works.

the serial console give the output like the screenshots.

It can help you to understand the bug.

#TIA

Hi @charles13,

Could you enable the run_classifier debug flag?

EI_IMPULSE_ERROR res = run_classifier(&signal, &result, true /* debug */);

Aurelien

Hello @aurel

Thank you for reply.

yes my app_httpd.cpp file has this run_classifire debug line.

But till it give output { success: false}.

Can you set the last argument to true and retry?

EI_IMPULSE_ERROR res = run_classifier(&signal, &result, true /* debug */);

Hello @aurel

thanks again For reply.

yes I set the last argument true and try, but I got same outputs, even on changing resolutions.

Hello @charles13,

Could you try again with the latest changes we made on this repository and tell us if it works for you?

We have changed mostly this function that was causing many issues:

size_t out_len = EI_CLASSIFIER_INPUT_WIDTH * EI_CLASSIFIER_INPUT_HEIGHT;
int raw_feature_get_data(size_t offset, size_t out_len, float *signal_ptr)
{
  size_t pixel_ix = offset * 3;
  size_t bytes_left = out_len;
  size_t out_ptr_ix = 0;

  // read byte for byte
  while (bytes_left != 0) {
    // grab the values and convert to r/g/b
    uint8_t r, g, b;
    r = ei_buf[pixel_ix];
    g = ei_buf[pixel_ix + 1];
    b = ei_buf[pixel_ix + 2];

    // then convert to out_ptr format
    float pixel_f = (r << 16) + (g << 8) + b;
    signal_ptr[out_ptr_ix] = pixel_f;

    // and go to the next pixel
    out_ptr_ix++;
    pixel_ix += 3;
    bytes_left--;
  }
  return 0;
}

Here is what I have:

Regards,

Louis