How to print a label from a model of a Neural network?

I have a Numaker-PFM-M487 device and it contains the Bin file. The Bin file contains the weights and labels as ‘cat, dog, etc’ of a Neural network.
Now, how to print one label in the Bin file by this processing.
I made it like this code but it only shows the number, not the label.
Please help me, Many thanks.

void keyPressed(){
  int i = 0, new_b = 0;
  String all = "";
  int temp;
  PImage myImage = loadImage("image0.png");
  myImage.loadPixels();
  for(i=0;i<10;i++){
      float b = blue(myImage.pixels[i]);          
      new_b = (int)b;
      all = all + new_b + ",";
  }
  myPort.write(all); //send String type data to board
  println(all);
  delay(1000);

Please post a complete sketch rather than a snippet

Here is it.
import processing.serial.;
Serial myPort;
int SIZE = 3072;
PImage img;
void setup(){
size(32, 32);
img = loadImage(“image3.png”);
image(img, 0, 0);
printArray(Serial.list());
myPort = new Serial(this, Serial.list()[1], 9600);
}
void draw() {
image(img, 0, 0);
}
void keyPressed(){
int i = 0, new_b = 0, index=0;
String all = “”;
int temp;
PImage myImage = loadImage(“image1.png”);
myImage.loadPixels();
for(i=0;i<3072;i++){
float b = blue(myImage.pixels
); *

  • new_b = (int)b;*
  • all = all + new_b + “,”;*
  • }*
  • myPort.write(all); //send String type data to board*
  • println(all);*
  • delay(1000);*
  • while((temp = myPort.read()) > 0){*
  • if(index % 32 == 0){ *
  • println();*
  • index = 0;*
  • }*
  • print((char)temp);//recieve labels from M487 board*
  • print(" "); *
  • index++;*
  • }*
    }

That looks like a Processing sketch

This is the Arduino forum

so, please help me! the index of labels in cifar10 is set up from 0 to 9. it corresponds to the labels from cat to the airplane to the truck. I don't know how to get these values to get out the labels for each image, the image is load from my PC.

Can you confirm that what you posted is Processing code ?

yes. that code is processing code

babatnvn:
yes. that code is processing code

As I said before, this is an Arduino forum. You may get lucky and find someone who can help with Processing but you would probably be better off seeking help in a Processing forum

ok. Thanks you so much!

I don't have any experiments with this work. Could you give me some of your ideas?

Could you give me some of your ideas?

The best idea would be for you to ask the question in a Processing forum

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.