Add reverse workspace filter option
This commit is contained in:
@@ -658,19 +658,31 @@ int print_object_detect_result(rknn_app_context_t *rknn, object_detect_result_li
|
||||
int low_top = group->results[i].box.top;
|
||||
int low_right = group->results[i].box.right;
|
||||
int low_bottom = group->results[i].box.bottom;
|
||||
if (group->results[i].prop >= LOW_CONF_SNAPSHOT_MIN && is_point_in_workspace(low_left, low_top, low_right, low_bottom))
|
||||
bool low_in_workspace = is_point_in_workspace(low_left, low_top, low_right, low_bottom);
|
||||
bool low_pass_workspace = ReverseWorkspace ? !low_in_workspace : low_in_workspace;
|
||||
if (group->results[i].prop >= LOW_CONF_SNAPSHOT_MIN && low_pass_workspace)
|
||||
{
|
||||
detect_log_line("%s ts=%ld camera=%s weak_present frame=%lld result=%2d code=%d box=(%3d %3d %3d %3d) prop=%f thresh=%f label=%s",
|
||||
detect_log_line("%s ts=%ld camera=%s weak_present frame=%lld result=%2d code=%d box=(%3d %3d %3d %3d) prop=%f thresh=%f label=%s workspace_mode=%s in_workspace=%d",
|
||||
now_text, now_ts, CameraID ? CameraID : "", frame_seq, i,
|
||||
codes[group->results[i].cls_id], low_left, low_top, low_right, low_bottom,
|
||||
group->results[i].prop, conf_threshold, label);
|
||||
group->results[i].prop, conf_threshold, label,
|
||||
workspace_filter_mode(), low_in_workspace ? 1 : 0);
|
||||
}
|
||||
else if (group->results[i].prop >= LOW_CONF_SNAPSHOT_MIN)
|
||||
{
|
||||
detect_log_line("%s ts=%ld camera=%s filtered_workspace frame=%lld result=%2d code=%d box=(%3d %3d %3d %3d) prop=%f label=%s workspace_mode=%s in_workspace=%d",
|
||||
now_text, now_ts, CameraID ? CameraID : "", frame_seq, i,
|
||||
codes[group->results[i].cls_id], low_left, low_top, low_right, low_bottom,
|
||||
group->results[i].prop, label,
|
||||
workspace_filter_mode(), low_in_workspace ? 1 : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
detect_log_line("%s ts=%ld camera=%s filtered_low_conf frame=%lld result=%2d code=%d box=(%3d %3d %3d %3d) prop=%f min=%f label=%s",
|
||||
detect_log_line("%s ts=%ld camera=%s filtered_low_conf frame=%lld result=%2d code=%d box=(%3d %3d %3d %3d) prop=%f min=%f label=%s workspace_mode=%s in_workspace=%d",
|
||||
now_text, now_ts, CameraID ? CameraID : "", frame_seq, i,
|
||||
codes[group->results[i].cls_id], low_left, low_top, low_right, low_bottom,
|
||||
group->results[i].prop, LOW_CONF_SNAPSHOT_MIN, label);
|
||||
group->results[i].prop, LOW_CONF_SNAPSHOT_MIN, label,
|
||||
workspace_filter_mode(), low_in_workspace ? 1 : 0);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
@@ -679,16 +691,19 @@ int print_object_detect_result(rknn_app_context_t *rknn, object_detect_result_li
|
||||
int top = group->results[i].box.top;
|
||||
int right = group->results[i].box.right;
|
||||
int bottom = group->results[i].box.bottom;
|
||||
bool in_workspace = is_point_in_workspace(left, top, right, bottom);
|
||||
bool pass_workspace = ReverseWorkspace ? !in_workspace : in_workspace;
|
||||
|
||||
if (!is_point_in_workspace(left, top, right, bottom))
|
||||
if (!pass_workspace)
|
||||
{
|
||||
printf("not in ");
|
||||
printf(ReverseWorkspace ? "excluded " : "not in ");
|
||||
if (should_log_detail)
|
||||
{
|
||||
detect_log_line("%s ts=%ld camera=%s filtered_workspace frame=%lld result=%2d code=%d box=(%3d %3d %3d %3d) prop=%f label=%s",
|
||||
detect_log_line("%s ts=%ld camera=%s filtered_workspace frame=%lld result=%2d code=%d box=(%3d %3d %3d %3d) prop=%f label=%s workspace_mode=%s in_workspace=%d",
|
||||
now_text, now_ts, CameraID ? CameraID : "", frame_seq, i,
|
||||
codes[group->results[i].cls_id], left, top, right, bottom,
|
||||
group->results[i].prop, label);
|
||||
group->results[i].prop, label,
|
||||
workspace_filter_mode(), in_workspace ? 1 : 0);
|
||||
}
|
||||
printf("result %2d: (%3d %3d %3d %3d) %f, %s\n", i, left, top, right, bottom, group->results[i].prop, label);
|
||||
continue;
|
||||
@@ -696,13 +711,14 @@ int print_object_detect_result(rknn_app_context_t *rknn, object_detect_result_li
|
||||
|
||||
if (group->results[i].prop >= conf_threshold)
|
||||
{
|
||||
printf("in ");
|
||||
printf(ReverseWorkspace ? "outside " : "in ");
|
||||
if (should_log_detail)
|
||||
{
|
||||
detect_log_line("%s ts=%ld camera=%s strong_present frame=%lld result=%2d code=%d box=(%3d %3d %3d %3d) prop=%f thresh=%f label=%s",
|
||||
detect_log_line("%s ts=%ld camera=%s strong_present frame=%lld result=%2d code=%d box=(%3d %3d %3d %3d) prop=%f thresh=%f label=%s workspace_mode=%s in_workspace=%d",
|
||||
now_text, now_ts, CameraID ? CameraID : "", frame_seq, i,
|
||||
codes[group->results[i].cls_id], left, top, right, bottom,
|
||||
group->results[i].prop, conf_threshold, label);
|
||||
group->results[i].prop, conf_threshold, label,
|
||||
workspace_filter_mode(), in_workspace ? 1 : 0);
|
||||
}
|
||||
append_upload_box(¤t_objects[group->results[i].cls_id], left, top, right, bottom, group->results[i].prop, label);
|
||||
current_objects[group->results[i].cls_id].number += 1;
|
||||
|
||||
Reference in New Issue
Block a user