I want to create a sketch that recognizes my own image (correct and incorrect images) in real time with the sense arduino IDE.

Asked 1 years ago, Updated 1 years ago, 427 views

A Sony NNC window version learns its own image (Razpie V2) 80×80, datesets positive and negative images in 120 sheets and 90 sheets, respectively, and obtains a learning result accuracy=1 in 28×28 size, and stores model.nnb in SD.Before doing this, after saving the learned model.nnb of the NNCct project example number_recognition.sdcprj to the SD card, we tried the sketch example of the Presence arduino IDE, and the recognition of the numbers was reproduced. I changed the code as below, but
...
Image size is 28x28 even multiple positive □ angular
#define DNN_IMG_W28
#define DNN_IMG_H28
# define CAM_IMG_W320
#define CAM_IMG_H240
# define CAM_CLIP_X 40
# define CAM_CLIP_Y0
# define CAM_CLIP_W 224
# define CAM_CLIP_H224
...
static uint8_t const label [2] = {"positve_20pg, negative_20pg"};
...
if(index<1){
gStrResult=String(label[index])+String(":")+String(output[index]);
} else {
gStrResult=String("?:")+String(output[index]);
}
...

in the above three locations When written, the bottom line display is
71: Flashing at 0.00 with the same number, changing the input image does not change,

I tried the above three places, but the results were the same.
Perhaps other things that need to be changed are
There are two labels, posi and nega, so I think the above is fine, but
Where and how do we fix it?
If the result of the evaluation is posi, it is 0.9900 or more, and if it is nega, it is 0.001 or less, so I think this evaluation is necessary, but I don't know how to write the code, so
Could you tell me if you have any other examples of the two types of sketches you want to judge (e.g., a sketch that identifies apples and oranges)?

spresense arduino

2022-09-30 22:02

1 Answers

The console string "71:0.00" first 71 is displayed because there is not enough memory available for the label string.The probability output of the second half is not known from this content.

In the first place, the definition of the string is strange.

static uint8_t constlabel[2]={"positve_20pg, negative_20pg"};

Perhaps you want to put out two strings: "positive_20pg" and "negative_20pg", but you need to have enough memory for each string. Since "positive_20pg" is 13 characters and "negative_20pg" is 13 characters, you should consider null termination and have 14 characters arranged.Also, since it is a string, char is more appropriate than uint8_t.

static char constlabel[2][14]={"positive_20pg", "negative_20pg"};

Verify that you can print this with the following code:

static char constlabel[2][14]={"positive_20pg", "negative_20pg"};

void setup() {

  Serial.begin (115200);

  Serial.println(label[0]);
  Serial.println(label[1]);
  
}

void loop(){}

If you don't know what this means, learn about C language memory arrays.This is the basis of the basics of C and C++ languages, so you must first understand it before you can handle the microcomputer board.

"Also, it's a snake's foot, but

 if(index<1){
gStrResult=String(label[index])+String(":")+String(output[index]);
}

If so, only positive_20pg is displayed, is that okay?If that's the case, I don't think you need to go out of your way to define a label.


2022-09-30 22:02

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.