We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from PIL import Image, ImageOps import numpy as np np.set_printoptions(threshold=np.inf) def resize_image(image, _width=32, _height=32): new_image = Image.open(image) new_image = ImageOps.fit(new_image , (_width, _height), Image.ANTIALIAS) new_image_rgb = new_image.convert('RGB') return np.asarray(new_image_rgb).flatten() def print_array_for_c(_array): print("{",end="") for pixel in _array: print(pixel,end=",") print("}") print_array_for_c(resize_image('dog.jpg'))
/* from the dog image conversion */ #define IMG_DATA {255,255, ... ,255,} uint8_t image_data[3 * 32 * 32] = IMG_DATA; q7_t output_data[10]; char const *class_names[10] = {"airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck"}; uint8_t get_max_index(q7_t *array,uint8_t len) { int max = -128; int max_index; for (int i = 0; i < len; i++) { if(max<array[i]) { max = array[i]; max_index = i; } } return max_index; } int main() { printf("start execution, wait for the result...\n"); /* start the execution */ run_nn((q7_t*)image_data,output_data); arm_softmax_q7(output_data, 10, output_data); for (uint8_t i = 0; i < 10; i++) { printf("%d: %d\n", i, output_data[i]); } printf("It is %s.\n",class_names[get_max_index(output_data,sizeof(output_data)/sizeof(output_data[0]))]); return 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I use the code to convert the dog image to an array.
and then input NN
but the Prediction is "Plane", I tried a lot of pictures and the predictions were not correct.
Please help me, thanks.
The text was updated successfully, but these errors were encountered: