mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
Compare commits
2 Commits
189a835999
...
e25ee48874
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e25ee48874 | ||
![]() |
5698c45130 |
@ -234,6 +234,7 @@ int ml_backend_init_model(py_ml_model_obj_t *model) {
|
||||
}
|
||||
|
||||
int ml_backend_run_inference(py_ml_model_obj_t *model) {
|
||||
LL_ATON_RT_RetValues_t ll_aton_rt_ret;
|
||||
ml_backend_state_t *state = (ml_backend_state_t *) model->state;
|
||||
|
||||
// Flush input buffers.
|
||||
@ -242,7 +243,25 @@ int ml_backend_run_inference(py_ml_model_obj_t *model) {
|
||||
SCB_CleanDCache_by_Addr(LL_Buffer_addr_start(buf), LL_Buffer_len(buf));
|
||||
}
|
||||
|
||||
LL_ATON_RT_Main(&state->nn_inst);
|
||||
LL_ATON_RT_RuntimeInit();
|
||||
LL_ATON_RT_Init_Network(&state->nn_inst);
|
||||
|
||||
do {
|
||||
// Execute first/next runtime step
|
||||
ll_aton_rt_ret = LL_ATON_RT_RunEpochBlock(&state->nn_inst);
|
||||
|
||||
// Handle pending events (TinyUSB, OMV Protocol etc..)
|
||||
mp_handle_pending(false);
|
||||
|
||||
// Wait for the next event
|
||||
if (ll_aton_rt_ret == LL_ATON_RT_WFE) {
|
||||
LL_ATON_OSAL_WFE();
|
||||
}
|
||||
} while (ll_aton_rt_ret != LL_ATON_RT_DONE);
|
||||
|
||||
LL_ATON_RT_DeInit_Network(&state->nn_inst);
|
||||
LL_ATON_RT_RuntimeDeInit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include CMSIS_MCU_H
|
||||
|
||||
#include "py/mphal.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "alif_hal.h"
|
||||
#include "omv_boardconfig.h"
|
||||
#include "ethosu_driver.h"
|
||||
@ -150,11 +152,11 @@ uint64_t ethosu_address_remap(uint64_t address, int index) {
|
||||
}
|
||||
|
||||
void ethosu_inference_begin(struct ethosu_driver *drv, void *user_arg) {
|
||||
|
||||
mp_handle_pending(false);
|
||||
}
|
||||
|
||||
void ethosu_inference_end(struct ethosu_driver *drv, void *user_arg) {
|
||||
|
||||
mp_handle_pending(false);
|
||||
}
|
||||
|
||||
void ETHOSU_IRQ_HANDLER(void) {
|
||||
|
Loading…
Reference in New Issue
Block a user