性能优化7,去掉人脸画框

This commit is contained in:
sladro 2026-01-14 13:40:34 +08:00
parent 86f1f63656
commit d6b2f32ed7
2 changed files with 13 additions and 12 deletions

View File

@ -130,6 +130,7 @@
"draw_bbox": true,
"draw_text": true,
"draw_face_det": false,
"draw_face_bbox": false,
"line_width": 2,
"font_scale": 1,
"labels": []
@ -222,18 +223,15 @@
"id": "alarm_face_cam1",
"type": "alarm",
"role": "sink",
"enable": true,
"enable": false,
"eval_fps": 5,
"labels": [],
"rules": [],
"face_rules": [
{ "name": "unknown_face", "type": "unknown", "cooldown_ms": 5000, "min_sim": 0.0 },
{ "name": "known_person", "type": "person", "cooldown_ms": 5000, "min_sim": 0.5 }
],
"face_rules": [],
"actions": {
"log": { "enable": true, "level": "info" },
"log": { "enable": false, "level": "info" },
"snapshot": {
"enable": true,
"enable": false,
"format": "jpg",
"quality": 85,
"upload": {
@ -403,7 +401,7 @@
"endpoint": "http://10.0.0.5:9000",
"bucket": "test",
"region": "us-east-1",
"access_key": "alarm_face_cam1",
"access_key": "your-access-key",
"secret_key": "your-secret-key"
}
},

View File

@ -350,6 +350,7 @@ public:
draw_bbox_ = config.ValueOr<bool>("draw_bbox", true);
draw_text_ = config.ValueOr<bool>("draw_text", true);
draw_face_det_ = config.ValueOr<bool>("draw_face_det", draw_face_det_);
draw_face_bbox_ = config.ValueOr<bool>("draw_face_bbox", draw_face_bbox_);
line_width_ = config.ValueOr<int>("line_width", 2);
font_scale_ = config.ValueOr<int>("font_scale", 1);
use_rga_bbox_ = config.ValueOr<bool>("use_rga_bbox", use_rga_bbox_);
@ -385,6 +386,7 @@ public:
LogInfo(std::string("[osd] start id=") + id_ + " draw_bbox=" + (draw_bbox_ ? "true" : "false") +
" draw_text=" + (draw_text_ ? "true" : "false") +
" draw_face_det=" + (draw_face_det_ ? "true" : "false") +
" draw_face_bbox=" + (draw_face_bbox_ ? "true" : "false") +
" use_rga_bbox=" + (use_rga_bbox_ ? "true" : "false"));
#if !defined(RK3588_ENABLE_RGA)
if (use_rga_bbox_ && draw_bbox_) {
@ -664,7 +666,7 @@ private:
uint8_t* data = frame->planes[0].data ? frame->planes[0].data : frame->data;
PixelFormat fmt = frame->format;
const bool want_rga_bbox = use_rga_bbox_ && draw_bbox_;
const bool want_rga_bbox = use_rga_bbox_ && draw_face_bbox_;
bool rga_bbox_ok = false;
#if defined(RK3588_ENABLE_RGA)
@ -728,7 +730,7 @@ private:
return;
}
const bool do_cpu_bbox = draw_bbox_ && !use_rga_bbox_;
const bool do_cpu_bbox = draw_face_bbox_ && !use_rga_bbox_;
const bool do_cpu_text = draw_text_;
if ((do_cpu_bbox || do_cpu_text) && frame->dma_fd >= 0) {
DmaSyncStartFd(frame->dma_fd);
@ -769,7 +771,7 @@ private:
uint8_t* data = frame->planes[0].data ? frame->planes[0].data : frame->data;
PixelFormat fmt = frame->format;
const bool want_rga_bbox = use_rga_bbox_ && draw_bbox_;
const bool want_rga_bbox = use_rga_bbox_ && draw_face_bbox_;
bool rga_bbox_ok = false;
#if defined(RK3588_ENABLE_RGA)
@ -833,7 +835,7 @@ private:
return;
}
const bool do_cpu_bbox = draw_bbox_ && !use_rga_bbox_;
const bool do_cpu_bbox = draw_face_bbox_ && !use_rga_bbox_;
const bool do_cpu_text = draw_text_;
if ((do_cpu_bbox || do_cpu_text) && frame->dma_fd >= 0) {
DmaSyncStartFd(frame->dma_fd);
@ -867,6 +869,7 @@ private:
bool draw_bbox_ = true;
bool draw_text_ = true;
bool draw_face_det_ = true;
bool draw_face_bbox_ = true;
bool use_rga_bbox_ = true;
int line_width_ = 2;
int font_scale_ = 1;