Skip to content

Commit 6054f76

Browse files
authored
Update recognize.cc
1 parent 2656816 commit 6054f76

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

arc_design_contest/2021/HUST_SmartMeter/src/recognize.cc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ void tflm_ini(const tflite::Model *model,
55
tflite::MicroInterpreter *interpreter,
66
uint8_t *tensor_arena,
77
int kTensorArenaSize,
8-
tflite::ErrorReporter *error_reporter){
8+
tflite::ErrorReporter *error_reporter)
9+
{
910
/*设置日志记录*/
1011
static tflite::MicroErrorReporter micro_error_reporter;
1112
error_reporter = &micro_error_reporter;
@@ -56,7 +57,8 @@ void tflm_ini(const tflite::Model *model,
5657
EMBARC_PRINTF(" INPUT TENSOR DIMS OK! ");
5758
};
5859

59-
void run_model(tflite::MicroInterpreter *interpreter, TfLiteTensor *model_output, tflite::ErrorReporter *error_reporter) {
60+
void run_model(tflite::MicroInterpreter *interpreter, TfLiteTensor *model_output, tflite::ErrorReporter *error_reporter)
61+
{
6062
/*运行模型*/
6163
TfLiteStatus invoke_status = interpreter->Invoke();
6264
if (invoke_status != kTfLiteOk) {
@@ -66,7 +68,8 @@ void run_model(tflite::MicroInterpreter *interpreter, TfLiteTensor *model_output
6668
model_output = interpreter->output(0);
6769
};
6870

69-
bool is_event(sample_data_node data[], uint32_t winlength, sample_data_node_ptr frontdata){
71+
bool is_event(sample_data_node data[], uint32_t winlength, sample_data_node_ptr frontdata)
72+
{
7073
/*事件检测算法实现*/
7174
//判断窗口中心两个点有效电流之差是否过阈值;
7275
int32_t diff=0;
@@ -82,8 +85,9 @@ bool is_event(sample_data_node data[], uint32_t winlength, sample_data_node_ptr
8285
return false;
8386
}
8487

85-
uint16_t recognize(uint16_t app_state,tflite::MicroInterpreter *interpreter, TfLiteTensor *model_output, tflite::ErrorReporter *error_reporter){
86-
run_model(interpreter,model_output,error_reporter);
88+
uint16_t recognize(uint16_t app_state,tflite::MicroInterpreter *interpreter, TfLiteTensor *model_output, tflite::ErrorReporter *error_reporter)
89+
{
90+
run_model(interpreter,model_output,error_reporter);
8791
uint16_t state = 0;
8892
uint8_t index = 0;
8993
float max = 0.0;

0 commit comments

Comments
 (0)