# How to classify socks using a Raspberry Pi, Edge Impulse, and balena

**URL:** <https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077>\
**Category:** Project help\
**Created:** [December 30, 2020, 12:59pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077 "2020-12-30T12:59:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![stratosb](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@stratosb](https://forums.balena.io/u/stratosb)\
**Post date:** [December 30, 2020, 12:59pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/1 "2020-12-30T12:59:25Z")

</div>

Hello,  
I am following this guide: [Edge Impulse and Balena](https://www.balena.io/blog/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/?utm_source=Balena+Users+%28Newsletter%29&utm_campaign=975f18cf0d-EMAIL_CAMPAIGN_2020_10_13_04_22&utm_medium=email&utm_term=0_1c73cb7379-975f18cf0d-293827645) in order to classify socks using a Raspberry Pi 3, Edge Impulse and Balena.

I have trained the model using three labels: **pair** , **unpair** and **unknown** and deployed the [EdgeImpulse balenaCam project](https://github.com/edgeimpulse/balena-cam-tinyml) to the rpi 3 with balena.

It is deployed and works as expected.  
Actually if I go to the local ip, I can see the live stream of the camera.

However the problem is that I see the default labels of the github project: **flipflops, running, sneakers and unknown** instead of my own: **pair, unpair and unknown** : ![image](https://global.discourse-cdn.com/balena/original/2X/6/6ed07c05c59f0381ee5fdb82f473c44f79092a71.png)  
Why are the default labels not overriden?  
How can I fix this?  
Thank you for your time

Stratos

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [December 30, 2020, 1:04pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/4 "2020-12-30T13:04:36Z")

</div>

Hello @stratosb first of all thanks for writing at the blogpost.

Actually another user of this library complained yesterday about this and Edge Impulse is working on trying to solve the problem.

Could you please confirm that you changed the EI API KEY and PROJECT ID?

---

<div class="post-metadata">

**Author:** ![stratosb](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@stratosb](https://forums.balena.io/u/stratosb)\
**Post date:** [December 30, 2020, 1:07pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/6 "2020-12-30T13:07:47Z")

</div>

Thank you for your reply @mpous .

I do confirm that I have changed both device service variables.

 ![Untitled](https://global.discourse-cdn.com/balena/original/2X/8/834c6732068addd2bc6cad7bcc1b12d0096832ba.png)

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [December 30, 2020, 1:11pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/7 "2020-12-30T13:11:40Z")

</div>

Trying the project myself to see where is the bug!

Actually this code updates automatically the Edge Impulse project from your account [https://github.com/edgeimpulse/balena-cam-tinyml/blob/master/edgeimpulse-inference/app/downloadWasm.sh](https://github.com/edgeimpulse/balena-cam-tinyml/blob/master/edgeimpulse-inference/app/downloadWasm.sh)

---

<div class="post-metadata">

**Author:** ![stratosb](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@stratosb](https://forums.balena.io/u/stratosb)\
**Post date:** [December 30, 2020, 1:13pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/8 "2020-12-30T13:13:45Z")

</div>

From the Edge Impulse Dashboard, I created a new API KEY today and named it **balena**.

 ![Untitled2](https://global.discourse-cdn.com/balena/original/2X/3/3f67efe721ed511969d773b82665053c0a4fa829.png)

I used this one for the device service variable, and not the one with name **stratosb-project-1-key**

Is this ok?

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [December 30, 2020, 1:14pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/9 "2020-12-30T13:14:36Z")

</div>

Yes! i used to do the same! Testing here 🙂

---

<div class="post-metadata">

**Author:** ![arijit](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/arijit/32/4427_2.png) [@arijit](https://forums.balena.io/u/arijit)\
**Post date:** [January 2, 2021, 4:22pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/15 "2021-01-02T16:22:55Z")

</div>

Hey @stratosb I am facing the same problem too!  
As per the latest updates from @mpous and some other people at Edge Impulse can you confirm that you have first build the model and exported as a .wasm file from the deployment tab in Edge Impulse studio and then started running it in the balena dashboard ?  
Also did you get any errors while compiling…because I too got one error in the deployment tab.

---

<div class="post-metadata">

**Author:** ![stratosb](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@stratosb](https://forums.balena.io/u/stratosb)\
**Post date:** [January 2, 2021, 6:46pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/16 "2021-01-02T18:46:28Z")

</div>

Hi @arijit,  
Thank you for your reply.  
Yes I first built the model and exported the .wasm file.  
However according to the [guide](https://www.balena.io/blog/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/), we won’t need this file since the project automatically downloads the model once it’s on the balenaCloud using our Edge Impulse `API KEY` and `PROJECT ID`.  
What error did you get while compiling at the Edge Impulse dashboard or the Balena dashboard?

---

<div class="post-metadata">

**Author:** ![arijit](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/arijit/32/4427_2.png) [@arijit](https://forums.balena.io/u/arijit)\
**Post date:** [January 3, 2021, 12:03pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/17 "2021-01-03T12:03:22Z")

</div>

Hello @stratosb!  
Well I do know that the blog post doesn’t says so. Did you get any errors while compiling and exporting the .wasm library from the Edge Impulse studio ?  
Thanks

---

<div class="post-metadata">

**Author:** ![stratosb](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@stratosb](https://forums.balena.io/u/stratosb)\
**Post date:** [January 3, 2021, 2:32pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/18 "2021-01-03T14:32:26Z")

</div>

Hi @arijit, although the .wasm library is exported, the build output returns the following error:

Job started  
Compiling WASM library…  
mkdir -p build/  
emcc -DTF\_LITE\_DISABLE\_X86\_NEON -std=c++11 -I. -Isource -Iedge-impulse-sdk/ -Iedge-impulse-sdk/utensor -Iedge-impulse-sdk/utensor/src -Iedge-impulse-sdk/utensor/src/uTensor -Iedge-impulse-sdk/utensor/src/uTensor/core -Iedge-impulse-sdk/utensor/src/uTensor/loaders -Iedge-impulse-sdk/utensor/src/uTensor/ops -Iedge-impulse-sdk/utensor/src/uTensor/util -Iedge-impulse-sdk/tensorflow -Iedge-impulse-sdk/third\_party -Iedge-impulse-sdk/third\_party/flatbuffers -Iedge-impulse-sdk/third\_party/flatbuffers/include -Iedge-impulse-sdk/third\_party/flatbuffers/include/flatbuffers -Iedge-impulse-sdk/third\_party/gemmlowp/ -Iedge-impulse-sdk/third\_party/gemmlowp/fixedpoint -Iedge-impulse-sdk/third\_party/gemmlowp/internal -Iedge-impulse-sdk/third\_party/ruy -Imodel-parameters -Itflite-model -Iedge-impulse-sdk/anomaly -Iedge-impulse-sdk/classifier -Iedge-impulse-sdk/dsp -Iedge-impulse-sdk/dsp/kissfft -Iedge-impulse-sdk/porting -O3 -s WASM=1 -s ASSERTIONS=1 -s ALLOW\_MEMORY\_GROWTH=1 -s TOTAL\_MEMORY=128MB --bind tflite-model/\*.cpp emcc\_binding.cpp /app/libsdk.o -o build/edge-impulse-standalone.js  
tflite-model/trained\_model\_compiled.cpp:5991:72: warning: format specifies type ‘unsigned int’ but the argument has type ‘size\_t’ (aka ‘unsigned long’) [-Wformat]  
printf(“ERR: Failed to allocate persistent buffer of size %u\n”, bytes);  
~~^~~~~  
%zu  
1 warning generated.  
Compiling WASM library OK  
Job completed

Did you get the same warning?

---

<div class="post-metadata">

**Author:** ![arijit](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/arijit/32/4427_2.png) [@arijit](https://forums.balena.io/u/arijit)\
**Post date:** [January 3, 2021, 4:00pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/19 "2021-01-03T16:00:31Z")

</div>

Yup I’m getting the exact same error! I guess there might be some problem with the Edge Impulse server.

---

<div class="post-metadata">

**Author:** ![stratosb](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@stratosb](https://forums.balena.io/u/stratosb)\
**Post date:** [January 3, 2021, 4:26pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/20 "2021-01-03T16:26:35Z")

</div>

Actually, I have opened an issue about this on EdgeImpulse: [EdgeImpulse forum](https://forum.edgeimpulse.com/t/error-while-deploying-the-edgeimpulse-ml-model/1090)

---

<div class="post-metadata">

**Author:** ![stratosb](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@stratosb](https://forums.balena.io/u/stratosb)\
**Post date:** [January 7, 2021, 12:49pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/22 "2021-01-07T12:49:03Z")

</div>

Hi @mpous,  
what is the feedback from your testing?  
Can I try it again?  
Has it been fixed?  
Thank you

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [January 7, 2021, 1:45pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/23 "2021-01-07T13:45:15Z")

</div>

Hello @stratosb apologizes! i was off the last days!

Could you please confirm me if you are using the Raspberry Pi 3 32bit or 64bit balenaOS?

---

<div class="post-metadata">

**Author:** ![stratosb](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@stratosb](https://forums.balena.io/u/stratosb)\
**Post date:** [January 7, 2021, 1:49pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/24 "2021-01-07T13:49:29Z")

</div>

No worries Marc,  
I am using the Raspberry Pi 3 32bit and **balenaOS 2.58.3+rev1**.  
Thank you.

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [January 7, 2021, 1:50pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/25 "2021-01-07T13:50:59Z")

</div>

Could you please try with a new app on 64bits?

---

<div class="post-metadata">

**Author:** ![stratosb](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@stratosb](https://forums.balena.io/u/stratosb)\
**Post date:** [January 7, 2021, 1:54pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/26 "2021-01-07T13:54:32Z")

</div>

You mean balenaOS 64-bit?  
This means that **balenaOS 2.58.3+rev1** is 32-bit?

Which version is balenaOS 64-bit and how can I differentiate it from its 32-bit version?  
Can balenaOS 64-bit run on Raspberry Pi 3 32bit?

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [January 7, 2021, 1:55pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/27 "2021-01-07T13:55:41Z")

</div>

I mean this ![Captura de Pantalla 2021-01-07 a les 14.55.29](https://global.discourse-cdn.com/balena/original/2X/c/c0c0eafc2aef0fa4faedf300fadebcf743cb88bf.png)

---

<div class="post-metadata">

**Author:** ![mpous](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mpous/32/4742_2.png) [@mpous](https://forums.balena.io/u/mpous)\
**Post date:** [January 7, 2021, 1:57pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/28 "2021-01-07T13:57:42Z")

</div>

To answer your previous question, the balenaOS 64 bits can run 32 bits containers, that’s ok. Not the other way round.

I’m asking this because it used to work with Raspberry Pi 4 (it’s only 64 bits) and it’s weird why it doesn’t work on 32 bits.

Last day we talked i tried with 2 pi 3 i have on my desk but the sd cards had issues and i failed to test. I will try again!

---

<div class="post-metadata">

**Author:** ![stratosb](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@stratosb](https://forums.balena.io/u/stratosb)\
**Post date:** [January 7, 2021, 1:58pm UTC](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077/29 "2021-01-07T13:58:01Z")

</div>

Ok I will try it and let you know.  
Thank you for your support.

[Next page](https://forums.balena.io/t/how-to-classify-socks-using-a-raspberry-pi-edge-impulse-and-balena/230077.md?page=2)
