支持反向的上报,首先,再model.txt里面类别设置为!mouse等(在类别前面加一个英文的感叹号,表示非),然后yolov5正常上报,数字(比如,现在上报的是0个),rk1808-tool在收到消息之后,会查看前面是否有感叹号,如果有,表示在个数为0的时候,持续10秒钟,就上报;否则,就是在个数不为0,且持续10秒钟之后上报。
This commit is contained in:
@@ -94,9 +94,20 @@ void convert_a_frame(MppFrame frame)
|
|||||||
// lock acquired, should create thread and use pose_body
|
// lock acquired, should create thread and use pose_body
|
||||||
|
|
||||||
if (!should_do_judge_according_time()) {
|
if (!should_do_judge_according_time()) {
|
||||||
|
if (inited_after_out_of_time_gap == 0) {
|
||||||
|
inited_after_out_of_time_gap = 1;
|
||||||
|
for (int i = 0; i < OBJ_CLASS_MAX; i++) {
|
||||||
|
pre_change_objects[i] = -1;
|
||||||
|
pre_change_frames[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
pthread_mutex_unlock(&frame_mutex);
|
pthread_mutex_unlock(&frame_mutex);
|
||||||
free(out);
|
free(out);
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
if (inited_after_out_of_time_gap == 1) {
|
||||||
|
inited_after_out_of_time_gap = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pthread_t pose_body_handler;
|
pthread_t pose_body_handler;
|
||||||
pthread_create(&pose_body_handler, NULL, pose_body_thread, (void *)out);
|
pthread_create(&pose_body_handler, NULL, pose_body_thread, (void *)out);
|
||||||
|
|||||||
+7
-1
@@ -33,6 +33,8 @@ int codes[OBJ_MAX_CLASS_NUM];
|
|||||||
int OBJ_CLASS_REAL_NUM = 0;
|
int OBJ_CLASS_REAL_NUM = 0;
|
||||||
int PROP_BOX_SIZE = 0;
|
int PROP_BOX_SIZE = 0;
|
||||||
|
|
||||||
|
int inited_after_out_of_time_gap = 0;
|
||||||
|
|
||||||
const int anchor[3][6] = {{10, 13, 16, 30, 33, 23},
|
const int anchor[3][6] = {{10, 13, 16, 30, 33, 23},
|
||||||
{30, 61, 62, 45, 59, 119},
|
{30, 61, 62, 45, 59, 119},
|
||||||
{116, 90, 156, 198, 373, 326}};
|
{116, 90, 156, 198, 373, 326}};
|
||||||
@@ -610,10 +612,14 @@ int post_process(rknn_app_context_t *app_ctx, void *outputs, letterbox_t *letter
|
|||||||
|
|
||||||
int init_post_process()
|
int init_post_process()
|
||||||
{
|
{
|
||||||
|
|
||||||
char txt_path[128];
|
char txt_path[128];
|
||||||
snprintf(txt_path, 127, "%s/%s.txt", MODELDIR, global_model);
|
snprintf(txt_path, 127, "%s/%s.txt", MODELDIR, global_model);
|
||||||
|
|
||||||
|
for (int i = 0; i < OBJ_CLASS_MAX; i++) {
|
||||||
|
pre_change_objects[i] = -1;
|
||||||
|
pre_change_frames[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
ret = loadLabelName(txt_path, labels);
|
ret = loadLabelName(txt_path, labels);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
extern int OBJ_CLASS_REAL_NUM;
|
extern int OBJ_CLASS_REAL_NUM;
|
||||||
extern int PROP_BOX_SIZE;
|
extern int PROP_BOX_SIZE;
|
||||||
|
|
||||||
|
// 当刚从time_gap离开,需要重置一下帧数等信息,从而再下次进入区间,表现正常
|
||||||
|
extern int inited_after_out_of_time_gap;
|
||||||
|
|
||||||
extern char *labels[OBJ_MAX_CLASS_NUM];
|
extern char *labels[OBJ_MAX_CLASS_NUM];
|
||||||
extern int codes[OBJ_MAX_CLASS_NUM];
|
extern int codes[OBJ_MAX_CLASS_NUM];
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
void *upload_info(void *arg);
|
void *upload_info(void *arg);
|
||||||
|
|
||||||
// #define LABEL_NALE_TXT_PATH "./model/coco_80_labels_list.txt"
|
// #define LABEL_NALE_TXT_PATH "./model/coco_80_labels_list.txt"
|
||||||
static int pre_change_frames[OBJ_CLASS_MAX] = {0};
|
int pre_change_frames[OBJ_CLASS_MAX];
|
||||||
// static int last_objects[OBJ_NUMB_MAX_SIZE] = {0};
|
// static int last_objects[OBJ_NUMB_MAX_SIZE] = {0};
|
||||||
static int pre_change_objects[OBJ_CLASS_MAX] = {0};
|
int pre_change_objects[OBJ_CLASS_MAX];
|
||||||
static int size_of_last_objects = 0;
|
static int size_of_last_objects = 0;
|
||||||
static int size_of_pre_changed = 0;
|
static int size_of_pre_changed = 0;
|
||||||
|
|
||||||
@@ -32,6 +32,7 @@ int UploadPort = 0;
|
|||||||
|
|
||||||
static char is_uploading = 0;
|
static char is_uploading = 0;
|
||||||
|
|
||||||
|
|
||||||
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
// rknn_t *rk = NULL;
|
// rknn_t *rk = NULL;
|
||||||
char *global_model = NULL;
|
char *global_model = NULL;
|
||||||
@@ -110,6 +111,10 @@ int print_object_detect_result(rknn_app_context_t *rknn, object_detect_result_li
|
|||||||
|
|
||||||
int current_objects[OBJ_CLASS_MAX] = {0};
|
int current_objects[OBJ_CLASS_MAX] = {0};
|
||||||
char need_upload = 0;
|
char need_upload = 0;
|
||||||
|
for (int i = 0; i < OBJ_CLASS_REAL_NUM; i++) {
|
||||||
|
need_upload_info[i] = -1;
|
||||||
|
current_objects[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < group->count; i++)
|
for (int i = 0; i < group->count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ extern char *CameraID;
|
|||||||
extern int TypeID;
|
extern int TypeID;
|
||||||
extern int UploadPort;
|
extern int UploadPort;
|
||||||
|
|
||||||
|
|
||||||
|
extern int pre_change_frames[OBJ_CLASS_MAX];
|
||||||
|
// static int last_objects[OBJ_NUMB_MAX_SIZE] = {0};
|
||||||
|
extern int pre_change_objects[OBJ_CLASS_MAX];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
typedef struct _BOX_RECT
|
typedef struct _BOX_RECT
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -225,7 +225,7 @@ time_period_t* get_time_period_from_string(char *str) {
|
|||||||
}
|
}
|
||||||
printf("rest = \"%s\"", rest);
|
printf("rest = \"%s\"", rest);
|
||||||
if (strlen(rest) == 0) {
|
if (strlen(rest) == 0) {
|
||||||
token = "23:59:59";
|
token = (char*)"23:59:59";
|
||||||
} else {
|
} else {
|
||||||
token = rest;
|
token = rest;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user