From 466b7707bf2d5cc46c5c001861c772f7148fedd0 Mon Sep 17 00:00:00 2001 From: LittleMouse Date: Tue, 19 Nov 2024 09:11:30 +0800 Subject: [PATCH] [update] vlm picture inference. --- projects/llm_framework/main_vlm/src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/llm_framework/main_vlm/src/main.cpp b/projects/llm_framework/main_vlm/src/main.cpp index 83596f1..082d2c6 100644 --- a/projects/llm_framework/main_vlm/src/main.cpp +++ b/projects/llm_framework/main_vlm/src/main.cpp @@ -201,6 +201,12 @@ class llm_task { std::string out = lLaMa_->Run(prompt_data_); if (out_callback_) out_callback_(out, true); } else { + if (image_data_.size() > 2 && image_data_[0] == 0xFF && image_data_[1] == 0xD8 && + image_data_[image_data_.size() - 2] == 0xFF && image_data_[image_data_.size() - 1] == 0xD9) { + } else { + SLOGE("Invalid JPEG data."); + return; + } cv::Mat src = cv::imdecode(image_data_, cv::IMREAD_COLOR); image_data_.clear(); lLaMa_->Encode(src, img_embed);