Portenta H7 + Vision Shield Sampling Error with Edge Impulse

Question/Issue:
Sampling Failed. Received snapshot is not a RAW or JPEG image. For RAW expected 76800 or 230400 values, but got 12.

It seems that at least two others have posted about this with no solid answers. Cannot proceed with project without having the H7 with Vision Shield camera working.

Problem happens on both Edge Impulse and Arduino ML Tools.

Context/Use case:
When trying to acquire data within Edge Impulse.

Steps Taken:

  1. Followed all instructions, step by step from EI documentation at: Arduino Portenta H7 | Edge Impulse Documentation
  2. Tried to collect data, received error message.

Expected Outcome:
Expected the camera to capture images and/or video.

Actual Outcome:
Entering snapshot stream mode…
[SER] Snapshot stream error: ERR: Failed to get snapshot (-1)
[WS ] Incoming sampling request {
path: ‘/api/training/data’,
label: ‘H_T1’,
length: 60000,
interval: 0,
hmacKey: ‘1cfff7ae7423a3ab71dc6810c25c5e79’,
sensor: ‘Camera (320x240)’
}
[SER] Taking snapshot…
[SER] Reading 0% complete…
[WS ] Failed to sample data Error: Received snapshot is not a RAW or JPEG image. For RAW expected 76800 or 230400 values, but got 12
at SerialDevice.sampleRequest (C:\Users\servi\AppData\Roaming\npm\node_modules\edge-impulse-cli\build\cli\daemon.js:324:23)
at async WebSocket. (C:\Users\servi\AppData\Roaming\npm\node_modules\edge-impulse-cli\build\shared\daemon\remote-mgmt-service.js:175:21)

Reproducibility:

  • [x ] Always
  • [ ] Sometimes
  • [ ] Rarely

Environment:

  • Arduino IDE 2.3.3
  • **OS Version: Windows 11 Pro
  • Edge Impulse Version (Firmware): Latest version as of 10-10-2024
  • **Edge Impulse CLI Version: 1.27.1
    Logs/Attachments:
    Entering snapshot stream mode…
    [SER] Snapshot stream error: ERR: Failed to get snapshot (-1)
    [WS ] Incoming sampling request {
    path: ‘/api/training/data’,
    label: ‘H_T1’,
    length: 60000,
    interval: 0,
    hmacKey: ‘1cfff7ae7423a3ab71dc6810c25c5e79’,
    sensor: ‘Camera (320x240)’
    }
    [SER] Taking snapshot…
    [SER] Reading 0% complete…
    [WS ] Failed to sample data Error: Received snapshot is not a RAW or JPEG image. For RAW expected 76800 or 230400 values, but got 12
    at SerialDevice.sampleRequest (C:\Users\servi\AppData\Roaming\npm\node_modules\edge-impulse-cli\build\cli\daemon.js:324:23)
    at async WebSocket. (C:\Users\servi\AppData\Roaming\npm\node_modules\edge-impulse-cli\build\shared\daemon\remote-mgmt-service.js:175:21)
    H7_Sampling_Err

Solved:

Edge Impulse firmware defaults to the HM01B0 camera. In my instance the Portenta Vision Shield is equipped with HM0360 camera.

Download latest Edge Impulse firmware for Arduino Portenta H7

Modify ei_camera.h in src/sensors/ with correct camera in use (himax.h for HM01B0 or hm0360.h for HM0360).

#include "hm0360.h"

Modify ei_camera.cpp in src/sensors/ with correct camera in use (HM01B0 or HM0360).

HM0360 himax;

If you receive a build error: “/src/xx directory not found” modify boards.local.txt in the Arduino Mbed Portenta directory, for instance: /Users/servi/Library/Arduino15/packages/arduino/hardware/mbed_portenta/4.1.5 by adding the missing directories. In my instance:

-I{build.source.path}/src/firmware-sdk/

Build and flash. Connect device to Edge Impulse.

1 Like