Skip to content

Commit 6f01db3

Browse files
author
LittleMouse
committed
[perf] Optimize yolo information display
1 parent c7ad50b commit 6f01db3

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

ESP32/cpp/src/main.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,9 @@ void setup_vlm(void)
350350
lvgl_port_unlock();
351351
}
352352
m5_module_llm::ApiVlmSetupConfig_t vlm_config;
353-
vlm_config.model = "internvl2.5-1B-364-ax630c";
354-
vlm_work_id = module_llm.vlm.setup(vlm_config, "vlm_setup");
353+
vlm_config.model = "internvl2.5-1B-364-ax630c";
354+
vlm_config.max_token_len = 511;
355+
vlm_work_id = module_llm.vlm.setup(vlm_config, "vlm_setup");
355356
while (vlm_work_id.isEmpty()) vTaskDelay(100);
356357
if (vlm_work_id == "vlm") {
357358
if (lvgl_port_lock()) {
@@ -498,6 +499,7 @@ void menuBackTask(void* pvParameters)
498499
if (!vlm_work_id.isEmpty()) {
499500
module_llm.vlm.exit(vlm_work_id);
500501
vlm_work_id.clear();
502+
lv_textarea_set_text(vllm_output, "");
501503
inference = false;
502504
}
503505
if (!melotts_work_id.isEmpty()) {
@@ -723,6 +725,7 @@ void button_task(void* pvParameters)
723725
if (!vlm_work_id.isEmpty()) {
724726
module_llm.vlm.exit(vlm_work_id);
725727
vlm_work_id.clear();
728+
lv_textarea_set_text(vllm_output, "");
726729
inference = false;
727730
}
728731
if (!melotts_work_id.isEmpty()) {
@@ -756,9 +759,15 @@ void cameraTask(void* pvParameters)
756759

757760
canvas.setTextDatum(bottom_left);
758761

759-
canvas.drawString(yolo_box.class_name.c_str(), yolo_box.x1, yolo_box.y1 - 40);
760-
canvas.drawFloat(yolo_box.confidence, 2, yolo_box.x2, yolo_box.y1 - 40);
762+
char result[50];
763+
strcpy(result, yolo_box.class_name.c_str());
764+
strcat(result, " ");
765+
sprintf(result + strlen(result), "%.2f", yolo_box.confidence);
761766

767+
int y1_pos = yolo_box.y1 - 40;
768+
if (y1_pos < 24) y1_pos = 24;
769+
770+
canvas.drawString(result, yolo_box.x1, y1_pos);
762771
canvas.drawRect(yolo_box.x1, yolo_box.y1 - 40, yolo_box.x2, yolo_box.y2 - 40, ORANGE);
763772

764773
const int pose_lines[][3] = {

0 commit comments

Comments
 (0)