mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Make both networks output the same value types.
Both CIFAR and LENET work still. The smile network... I couldn;t really get to work before or afterwards. I noticed the Haar one has trouble finding my face. Maybe fix via using the contrast settings of the previous Haar scripts?
This commit is contained in:
parent
9a61a73711
commit
f49576a679
@ -22,7 +22,7 @@ while(True):
|
||||
img = sensor.snapshot() # Take a picture and return the image.
|
||||
out = net.forward(img)
|
||||
max_idx = out.index(max(out))
|
||||
score = int(((out[max_idx]+128)/255)*100)
|
||||
score = int(out[max_idx]*100)
|
||||
if (score < 70):
|
||||
score_str = "??:??%"
|
||||
else:
|
||||
|
||||
@ -32,6 +32,6 @@ while (True):
|
||||
r = [r[0], r[1]+10, int(r[2]*1.1), int(r[2]*1.1)]
|
||||
img.draw_rectangle(r)
|
||||
out = net.forward(img, roi=r, softmax=True)
|
||||
img.draw_string(r[0], r[1], ':)' if (out[0]/127 > 0.8) else ':(', color=(255), scale=2)
|
||||
img.draw_string(r[0], r[1], ':)' if (out[0] > 0.8) else ':(', color=(255), scale=2)
|
||||
|
||||
print(clock.fps())
|
||||
|
||||
@ -20,7 +20,7 @@ while(True):
|
||||
img = sensor.snapshot() # Take a picture and return the image.
|
||||
out = net.forward(img.copy().binary([(150, 255)], invert=True))
|
||||
max_idx = out.index(max(out))
|
||||
score = int(((out[max_idx]+128)/255)*100)
|
||||
score = int(out[max_idx]*100)
|
||||
if (score < 70):
|
||||
score_str = "??:??%"
|
||||
else:
|
||||
|
||||
@ -50,7 +50,7 @@ STATIC mp_obj_t py_net_forward(uint n_args, const mp_obj_t *args, mp_map_t *kw_a
|
||||
}
|
||||
|
||||
for (int i=0; i<net->output_size; i++) {
|
||||
mp_obj_list_append(output_list, mp_obj_new_int(net->output_data[i]));
|
||||
mp_obj_list_append(output_list, mp_obj_new_float(((float) (net->output_data[i] + 128)) / 255));
|
||||
}
|
||||
|
||||
fb_alloc_free_till_mark();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user