Skip to main content
Associate
May 28, 2024
Question

Why is oneclass_result always 0(Nanoedge ai studio)

  • May 28, 2024
  • 8 replies
  • 3244 views

I compiled a 1C library using nanoedge ai studio and verified the sample successfully using the emulator. I also successfully added it to my Keil project, but the result was always 0 when I ran it.

My code:

Error_code = neai_oneclass(input_user_buffer, &oneclass_result);

onecclasss_result is always 0, regardless of the data. Why?

8 replies

Julian E.
Technical Moderator
May 28, 2024

Hello

 

Here is the documentation about the neai_oneclass function:

https://wiki.st.com/stm32mcu/wiki/AI:NanoEdge_AI_Library_for_1-class_classification_(1CC)

JulianE_0-1716904330972.png

As you can see, if it returns 0, it means that the library predicts that the signal is not an outlier. So, if your library output only 0, it means that the library is classifying all the signal as not an outlier.

 

1-class classification is a type of project made to help user without anomalies, but in practice, it is very hard to get a good model without any example of anomalies.

In certain use case, 1-class classification model can be of some help and detect some anomalies, but in other it is not helpful and cannot make the difference between normal or abnormal signals.

 

If you have abnormal data, please do an anomaly detection or N-class classification project. 

If you don't have abnormal data, please try to obtain some, and if it is not possible, there might be no solution for you.

 

Best regards,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
haiyishwAuthor
Associate
May 30, 2024

thanks.

Why is status "regular using the emulator, but status is "outlier" using the liberay in the keil

Julian E.
Technical Moderator
May 30, 2024

Hello, 

 

Indeed, in NanoEdge AI Studio, in the emulator step, the "classes" are regular and abnormal, and it should be outlier.

In the emulator that you can download, it is regular or outlier

In the library it is 0 or 1, 0 being regular and 1 outlier.

 

We will change abnormal to outlier in the NanoEdge AI Studio emulator.

Thank you for the remark.

 

Best regards,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
haiyishwAuthor
Associate
May 31, 2024

Okay, so when will the new version be released

Julian E.
Technical Moderator
May 31, 2024

Hello,

 

Our updates are scheduled on a quarterly basis, so you can expect the next one around the summer.

 

Best regards,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
haiyishwAuthor
Associate
June 25, 2024

Has the new version(v4.5.0) been fixed?

Julian E.
Technical Moderator
June 25, 2024

Hello,

 

If I understood your previous remark correctly, yes it has been fixed. In any case, it is a naming issue, the 1 class classification libraries return 0 or 1.

Please let me know if you have any other remark concerning this matter or any other one in NanoEdge AI Studio.

 

Best regards,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
haiyishwAuthor
Associate
June 26, 2024

I mean:

I gave the function an all-zero data set in the keil project, but the function returned 0. But the emulator of the ZIP package returns 1, why?

Julian E.
Technical Moderator
June 26, 2024

Hello,

 

Thank you for the clarification.

Can you send me your project (if you don't want to share the data, please send the emulator and your library).

To export a project in NanoEdge AI Studio, on the main page, select your project > click the 3 dots and click Export Project:

JulianE_0-1719406870365.png

 

Thank you

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
haiyishwAuthor
Associate
June 28, 2024

How do I send project to you? 

Julian E.
Technical Moderator
June 28, 2024

Hello,

 

To export a project in NanoEdge AI Studio, on the main page, select your project > click the 3 dots and click Export Project:

JulianE_0-1719567451246.png

 

You can then attach the obtained .zip file to a message here.

I also sent you a private message if you don't want to attach your project in this thread.

 

Have a good day,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.