How is the image resizing done in edgeimpulse studio and how can we replicate it on ESP32S3

Question/Issue:
I trained a classification model on 600 X 600 images on edgeimpulse. The input for the model is 160 X 160. This model was then deployed on an ESP32S3 board. The image processing pipeline on device includes cropping the captured SVGA image to 600 X 600 and then resizing to 160 X 160 using bilinear interpolation. However, the classification result is fairly different on device compared to when the same 600 X 600 jpeg image is uploaded to the edgeimpulse studio. For example in one case for the same image,
Edgeimpulse result:
Class1: 0.80
Class2: 0.20
On device:
Class1: 0.17
Class2: 0.83

Uploading the device resized 160 X 160 image to edgeimpulse studio confirms this and shows the same on device classification ie,
Class1: 0.17
Class2: 0.83

Is there a way to reduce this discrepancy? This only happens in images with very subtle differences (anomalies). With other images with bigger differences, the classification is fairly consistent in both device and edgeimpulse studio.

Hello @rn766 first of all welcome to the Edge Impulse community!

Let me ask internally how we do image resizing to see how we can help you more!

In the meantime, do you think you can share images from your project so we can understand the differences that you see?

Thanks!

@rn766 Edge Impulse Studio uses the Lanczos3 kernel for resizing. If your ESP32-S3 is using a different method that have subtle differences.

To confirm this, we would like to see examples as mentioned previously.

If you are able to run resizing on device with debug set to true in run_classifier() call. Get the processed features and compare with the ones in the Studio.

I think comparing them we will be able to identify the cause and help you to determine the best way to fix this.

Keep us posted :slight_smile:

1 Like