mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Merge pull request #490 from openmv/clean_fbfree
Remove extra fb_free calls.
This commit is contained in:
commit
c5d686cf03
@ -190,7 +190,6 @@ static void calculate_To(float Ta, float *To)
|
|||||||
// To[i] = sqrtf(sqrtf((v_ir_comp/((alpha_comp_ij*(1-(ks4*273.15f)))+sx))+Ta4))-273.15f;
|
// To[i] = sqrtf(sqrtf((v_ir_comp/((alpha_comp_ij*(1-(ks4*273.15f)))+sx))+Ta4))-273.15f;
|
||||||
To[i] = sqrtf(sqrtf((v_ir_comp/alpha_comp_ij)+Tak4))-273.15f;
|
To[i] = sqrtf(sqrtf((v_ir_comp/alpha_comp_ij)+Tak4))-273.15f;
|
||||||
}
|
}
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +337,6 @@ mp_obj_t py_fir_init(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
|
|||||||
b_cp = ((int8_t)eeprom[CAL_BCP]) /
|
b_cp = ((int8_t)eeprom[CAL_BCP]) /
|
||||||
powf(2,b_i_scale+(3-ADC_resolution));
|
powf(2,b_i_scale+(3-ADC_resolution));
|
||||||
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
@ -374,7 +372,6 @@ mp_obj_t py_fir_init(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
|
|||||||
|
|
||||||
PY_ASSERT_TRUE_MSG(error == 0, "Failed to init the MLX90640!");
|
PY_ASSERT_TRUE_MSG(error == 0, "Failed to init the MLX90640!");
|
||||||
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
@ -452,7 +449,6 @@ mp_obj_t py_fir_read_ta()
|
|||||||
PY_ASSERT_TRUE_MSG(MLX90640_GetFrameData(MLX90640_ADDR, data) >= 0,
|
PY_ASSERT_TRUE_MSG(MLX90640_GetFrameData(MLX90640_ADDR, data) >= 0,
|
||||||
"Failed to read the MLX90640 sensor data!");
|
"Failed to read the MLX90640 sensor data!");
|
||||||
mp_obj_t result = mp_obj_new_float(MLX90640_GetTa(data, (paramsMLX90640 *) alpha_ij));
|
mp_obj_t result = mp_obj_new_float(MLX90640_GetTa(data, (paramsMLX90640 *) alpha_ij));
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -503,8 +499,6 @@ mp_obj_t py_fir_read_ir()
|
|||||||
mp_obj_list_append(tuple[1], mp_obj_new_float(To[i]));
|
mp_obj_list_append(tuple[1], mp_obj_new_float(To[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_free();
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return mp_obj_new_tuple(4, tuple);
|
return mp_obj_new_tuple(4, tuple);
|
||||||
}
|
}
|
||||||
@ -542,8 +536,6 @@ mp_obj_t py_fir_read_ir()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_free();
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return mp_obj_new_tuple(4, tuple);
|
return mp_obj_new_tuple(4, tuple);
|
||||||
}
|
}
|
||||||
@ -581,7 +573,6 @@ mp_obj_t py_fir_read_ir()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return mp_obj_new_tuple(4, tuple);
|
return mp_obj_new_tuple(4, tuple);
|
||||||
}
|
}
|
||||||
@ -725,7 +716,6 @@ mp_obj_t py_fir_draw_ir(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -790,7 +790,6 @@ static mp_obj_t py_image_to_bitmap(uint n_args, const mp_obj_t *args, mp_map_t *
|
|||||||
memcpy(IMAGE_COMPUTE_BINARY_PIXEL_ROW_PTR(&out, y),
|
memcpy(IMAGE_COMPUTE_BINARY_PIXEL_ROW_PTR(&out, y),
|
||||||
out_row_ptr, IMAGE_BINARY_LINE_LEN_BYTES(&out));
|
out_row_ptr, IMAGE_BINARY_LINE_LEN_BYTES(&out));
|
||||||
}
|
}
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -826,7 +825,6 @@ static mp_obj_t py_image_to_bitmap(uint n_args, const mp_obj_t *args, mp_map_t *
|
|||||||
memcpy(IMAGE_COMPUTE_BINARY_PIXEL_ROW_PTR(&out, y),
|
memcpy(IMAGE_COMPUTE_BINARY_PIXEL_ROW_PTR(&out, y),
|
||||||
out_row_ptr, IMAGE_BINARY_LINE_LEN_BYTES(&out));
|
out_row_ptr, IMAGE_BINARY_LINE_LEN_BYTES(&out));
|
||||||
}
|
}
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -896,7 +894,6 @@ static mp_obj_t py_image_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1000,7 +997,6 @@ static mp_obj_t py_image_to_rgb565(uint n_args, const mp_obj_t *args, mp_map_t *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1041,7 +1037,6 @@ static mp_obj_t py_image_to_rgb565(uint n_args, const mp_obj_t *args, mp_map_t *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1150,7 +1145,6 @@ static mp_obj_t py_image_to_rainbow(uint n_args, const mp_obj_t *args, mp_map_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1191,7 +1185,6 @@ static mp_obj_t py_image_to_rainbow(uint n_args, const mp_obj_t *args, mp_map_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1256,7 +1249,6 @@ static mp_obj_t py_image_compress(uint n_args, const mp_obj_t *args, mp_map_t *k
|
|||||||
PY_ASSERT_TRUE_MSG(out.bpp <= image_size(arg_img), "Can't compress in place!");
|
PY_ASSERT_TRUE_MSG(out.bpp <= image_size(arg_img), "Can't compress in place!");
|
||||||
memcpy(arg_img->data, out.data, out.bpp);
|
memcpy(arg_img->data, out.data, out.bpp);
|
||||||
arg_img->bpp = out.bpp;
|
arg_img->bpp = out.bpp;
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
|
|
||||||
if (MAIN_FB()->pixels == arg_img->data) {
|
if (MAIN_FB()->pixels == arg_img->data) {
|
||||||
@ -1314,7 +1306,6 @@ static mp_obj_t py_image_compress_for_ide(uint n_args, const mp_obj_t *args, mp_
|
|||||||
|
|
||||||
out.bpp = (((out.bpp * 8) + 5) / 6) + 2;
|
out.bpp = (((out.bpp * 8) + 5) / 6) + 2;
|
||||||
arg_img->bpp = out.bpp;
|
arg_img->bpp = out.bpp;
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
|
|
||||||
if (MAIN_FB()->pixels == arg_img->data) {
|
if (MAIN_FB()->pixels == arg_img->data) {
|
||||||
@ -1339,7 +1330,6 @@ static mp_obj_t py_image_compressed(uint n_args, const mp_obj_t *args, mp_map_t
|
|||||||
uint8_t *temp = xalloc(out.bpp);
|
uint8_t *temp = xalloc(out.bpp);
|
||||||
memcpy(temp, out.data, out.bpp);
|
memcpy(temp, out.data, out.bpp);
|
||||||
out.data = temp;
|
out.data = temp;
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
|
|
||||||
return py_image_from_struct(&out);
|
return py_image_from_struct(&out);
|
||||||
@ -1393,7 +1383,6 @@ static mp_obj_t py_image_compressed_for_ide(uint n_args, const mp_obj_t *args, m
|
|||||||
|
|
||||||
out.bpp = (((out.bpp * 8) + 5) / 6) + 2;
|
out.bpp = (((out.bpp * 8) + 5) / 6) + 2;
|
||||||
out.data = temp;
|
out.data = temp;
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
|
|
||||||
return py_image_from_struct(&out);
|
return py_image_from_struct(&out);
|
||||||
@ -1523,7 +1512,6 @@ static mp_obj_t py_image_copy_int(uint n_args, const mp_obj_t *args, mp_map_t *k
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (in_place) {
|
if (in_place) {
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1953,7 +1941,6 @@ STATIC mp_obj_t py_image_mask_rectangle(uint n_args, const mp_obj_t *args, mp_ma
|
|||||||
imlib_draw_rectangle(&temp, arg_rx, arg_ry, arg_rw, arg_rh, -1, 0, true);
|
imlib_draw_rectangle(&temp, arg_rx, arg_ry, arg_rw, arg_rh, -1, 0, true);
|
||||||
imlib_zero(arg_img, &temp, true);
|
imlib_zero(arg_img, &temp, true);
|
||||||
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return args[0];
|
return args[0];
|
||||||
}
|
}
|
||||||
@ -1988,7 +1975,6 @@ STATIC mp_obj_t py_image_mask_circle(uint n_args, const mp_obj_t *args, mp_map_t
|
|||||||
imlib_draw_circle(&temp, arg_cx, arg_cy, arg_cr, -1, 0, true);
|
imlib_draw_circle(&temp, arg_cx, arg_cy, arg_cr, -1, 0, true);
|
||||||
imlib_zero(arg_img, &temp, true);
|
imlib_zero(arg_img, &temp, true);
|
||||||
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return args[0];
|
return args[0];
|
||||||
}
|
}
|
||||||
@ -2029,7 +2015,6 @@ STATIC mp_obj_t py_image_mask_ellipse(uint n_args, const mp_obj_t *args, mp_map_
|
|||||||
imlib_draw_ellipse(&temp, arg_cx, arg_cy, arg_rx, arg_ry, arg_r, -1, 0, true);
|
imlib_draw_ellipse(&temp, arg_cx, arg_cy, arg_rx, arg_ry, arg_r, -1, 0, true);
|
||||||
imlib_zero(arg_img, &temp, true);
|
imlib_zero(arg_img, &temp, true);
|
||||||
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return args[0];
|
return args[0];
|
||||||
}
|
}
|
||||||
@ -2856,7 +2841,6 @@ STATIC mp_obj_t py_image_morph(uint n_args, const mp_obj_t *args, mp_map_t *kw_a
|
|||||||
py_helper_keyword_to_image_mutable_mask(n_args, args, 8, kw_args);
|
py_helper_keyword_to_image_mutable_mask(n_args, args, 8, kw_args);
|
||||||
|
|
||||||
imlib_morph(arg_img, arg_ksize, arg_krn, arg_mul, arg_add, arg_threshold, arg_offset, arg_invert, arg_msk);
|
imlib_morph(arg_img, arg_ksize, arg_krn, arg_mul, arg_add, arg_threshold, arg_offset, arg_invert, arg_msk);
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return args[0];
|
return args[0];
|
||||||
}
|
}
|
||||||
@ -2913,8 +2897,6 @@ STATIC mp_obj_t py_image_gaussian(uint n_args, const mp_obj_t *args, mp_map_t *k
|
|||||||
py_helper_keyword_to_image_mutable_mask(n_args, args, 8, kw_args);
|
py_helper_keyword_to_image_mutable_mask(n_args, args, 8, kw_args);
|
||||||
|
|
||||||
imlib_morph(arg_img, arg_ksize, arg_krn, arg_mul, arg_add, arg_threshold, arg_offset, arg_invert, arg_msk);
|
imlib_morph(arg_img, arg_ksize, arg_krn, arg_mul, arg_add, arg_threshold, arg_offset, arg_invert, arg_msk);
|
||||||
fb_free();
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return args[0];
|
return args[0];
|
||||||
}
|
}
|
||||||
@ -2973,8 +2955,6 @@ STATIC mp_obj_t py_image_laplacian(uint n_args, const mp_obj_t *args, mp_map_t *
|
|||||||
py_helper_keyword_to_image_mutable_mask(n_args, args, 8, kw_args);
|
py_helper_keyword_to_image_mutable_mask(n_args, args, 8, kw_args);
|
||||||
|
|
||||||
imlib_morph(arg_img, arg_ksize, arg_krn, arg_mul, arg_add, arg_threshold, arg_offset, arg_invert, arg_msk);
|
imlib_morph(arg_img, arg_ksize, arg_krn, arg_mul, arg_add, arg_threshold, arg_offset, arg_invert, arg_msk);
|
||||||
fb_free();
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return args[0];
|
return args[0];
|
||||||
}
|
}
|
||||||
@ -3765,9 +3745,6 @@ mp_obj_t py_histogram_get_percentile(mp_obj_t self_in, mp_obj_t percentile)
|
|||||||
|
|
||||||
percentile_t p;
|
percentile_t p;
|
||||||
imlib_get_percentile(&p, ((py_histogram_obj_t *) self_in)->bpp, &hist, mp_obj_get_float(percentile));
|
imlib_get_percentile(&p, ((py_histogram_obj_t *) self_in)->bpp, &hist, mp_obj_get_float(percentile));
|
||||||
if (hist.BBinCount) fb_free();
|
|
||||||
if (hist.ABinCount) fb_free();
|
|
||||||
if (hist.LBinCount) fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
|
|
||||||
py_percentile_obj_t *o = m_new_obj(py_percentile_obj_t);
|
py_percentile_obj_t *o = m_new_obj(py_percentile_obj_t);
|
||||||
@ -3806,9 +3783,6 @@ mp_obj_t py_histogram_get_threshold(mp_obj_t self_in)
|
|||||||
|
|
||||||
threshold_t t;
|
threshold_t t;
|
||||||
imlib_get_threshold(&t, ((py_histogram_obj_t *) self_in)->bpp, &hist);
|
imlib_get_threshold(&t, ((py_histogram_obj_t *) self_in)->bpp, &hist);
|
||||||
if (hist.BBinCount) fb_free();
|
|
||||||
if (hist.ABinCount) fb_free();
|
|
||||||
if (hist.LBinCount) fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
|
|
||||||
py_threshold_obj_t *o = m_new_obj(py_threshold_obj_t);
|
py_threshold_obj_t *o = m_new_obj(py_threshold_obj_t);
|
||||||
@ -3847,9 +3821,6 @@ mp_obj_t py_histogram_get_statistics(mp_obj_t self_in)
|
|||||||
|
|
||||||
statistics_t stats;
|
statistics_t stats;
|
||||||
imlib_get_statistics(&stats, ((py_histogram_obj_t *) self_in)->bpp, &hist);
|
imlib_get_statistics(&stats, ((py_histogram_obj_t *) self_in)->bpp, &hist);
|
||||||
if (hist.BBinCount) fb_free();
|
|
||||||
if (hist.ABinCount) fb_free();
|
|
||||||
if (hist.LBinCount) fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
|
|
||||||
py_statistics_obj_t *o = m_new_obj(py_statistics_obj_t);
|
py_statistics_obj_t *o = m_new_obj(py_statistics_obj_t);
|
||||||
@ -4009,9 +3980,6 @@ static mp_obj_t py_image_get_histogram(uint n_args, const mp_obj_t *args, mp_map
|
|||||||
((mp_obj_list_t *) o->BBins)->items[i] = mp_obj_new_float(hist.BBins[i]);
|
((mp_obj_list_t *) o->BBins)->items[i] = mp_obj_new_float(hist.BBins[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hist.BBinCount) fb_free();
|
|
||||||
if (hist.ABinCount) fb_free();
|
|
||||||
if (hist.LBinCount) fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
@ -4095,9 +4063,6 @@ static mp_obj_t py_image_get_statistics(uint n_args, const mp_obj_t *args, mp_ma
|
|||||||
|
|
||||||
statistics_t stats;
|
statistics_t stats;
|
||||||
imlib_get_statistics(&stats, arg_img->bpp, &hist);
|
imlib_get_statistics(&stats, arg_img->bpp, &hist);
|
||||||
if (hist.BBinCount) fb_free();
|
|
||||||
if (hist.ABinCount) fb_free();
|
|
||||||
if (hist.LBinCount) fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
|
|
||||||
py_statistics_obj_t *o = m_new_obj(py_statistics_obj_t);
|
py_statistics_obj_t *o = m_new_obj(py_statistics_obj_t);
|
||||||
@ -7417,7 +7382,6 @@ static mp_obj_t py_image_match_descriptor(uint n_args, const mp_obj_t *args, mp_
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Free match list
|
// Free match list
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
|
|
||||||
if (filter_outliers == true) {
|
if (filter_outliers == true) {
|
||||||
|
|||||||
@ -338,8 +338,6 @@ static mp_obj_t py_lcd_display(uint n_args, const mp_obj_t *args, mp_map_t *kw_a
|
|||||||
for (int i=0; i<b_pad; i++) {
|
for (int i=0; i<b_pad; i++) {
|
||||||
lcd_write_data(width*2, zero);
|
lcd_write_data(width*2, zero);
|
||||||
}
|
}
|
||||||
fb_free();
|
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
@ -358,7 +356,6 @@ static mp_obj_t py_lcd_clear()
|
|||||||
for (int i=0; i<height; i++) {
|
for (int i=0; i<height; i++) {
|
||||||
lcd_write_data(width*2, zero);
|
lcd_write_data(width*2, zero);
|
||||||
}
|
}
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,8 +41,6 @@ STATIC mp_obj_t py_net_forward(uint n_args, const mp_obj_t *args, mp_map_t *kw_a
|
|||||||
bool dry_run = py_helper_keyword_int(n_args, args, 4, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_dry_run), false);
|
bool dry_run = py_helper_keyword_int(n_args, args, 4, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_dry_run), false);
|
||||||
|
|
||||||
mp_obj_t output_list = mp_obj_new_list(0, NULL);
|
mp_obj_t output_list = mp_obj_new_list(0, NULL);
|
||||||
fb_alloc_mark();
|
|
||||||
|
|
||||||
if (dry_run == false) {
|
if (dry_run == false) {
|
||||||
nn_run_network(net, img, &roi, softmax);
|
nn_run_network(net, img, &roi, softmax);
|
||||||
} else {
|
} else {
|
||||||
@ -52,8 +50,6 @@ 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++) {
|
for (int i=0; i<net->output_size; i++) {
|
||||||
mp_obj_list_append(output_list, mp_obj_new_float(((float) (net->output_data[i] + 128)) / 255));
|
mp_obj_list_append(output_list, mp_obj_new_float(((float) (net->output_data[i] + 128)) / 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_alloc_free_till_mark();
|
|
||||||
return output_list;
|
return output_list;
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_net_forward_obj, 2, py_net_forward);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_net_forward_obj, 2, py_net_forward);
|
||||||
@ -184,8 +180,6 @@ STATIC mp_obj_t py_net_search(uint n_args, const mp_obj_t *args, mp_map_t *kw_ar
|
|||||||
list_t out;
|
list_t out;
|
||||||
list_init(&out, sizeof(py_nn_class_obj_list_lnk_data_t));
|
list_init(&out, sizeof(py_nn_class_obj_list_lnk_data_t));
|
||||||
|
|
||||||
fb_alloc_mark();
|
|
||||||
|
|
||||||
for (float scale = 1; scale >= arg_min_scale; scale *= arg_scale_mul) {
|
for (float scale = 1; scale >= arg_min_scale; scale *= arg_scale_mul) {
|
||||||
// Either provide a subtle offset to center multiple detection windows or center the only detection window.
|
// Either provide a subtle offset to center multiple detection windows or center the only detection window.
|
||||||
for (int y = roi.y + ((arg_y_overlap != -1) ? (fmodf(roi.h, (roi.h * scale)) / 2) : ((roi.h - (roi.h * scale)) / 2));
|
for (int y = roi.y + ((arg_y_overlap != -1) ? (fmodf(roi.h, (roi.h * scale)) / 2) : ((roi.h - (roi.h * scale)) / 2));
|
||||||
@ -261,8 +255,6 @@ STATIC mp_obj_t py_net_search(uint n_args, const mp_obj_t *args, mp_map_t *kw_ar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_alloc_free_till_mark();
|
|
||||||
|
|
||||||
// Merge all overlapping and same detections and average them.
|
// Merge all overlapping and same detections and average them.
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|||||||
@ -586,7 +586,6 @@ static mp_obj_t py_tv_display(uint n_args, const mp_obj_t *args, mp_map_t *kw_ar
|
|||||||
CS_PIN_WRITE(true);
|
CS_PIN_WRITE(true);
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
fb_free();
|
|
||||||
fb_alloc_free_till_mark();
|
fb_alloc_free_till_mark();
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user