增加类别计数
This commit is contained in:
parent
c17df2e460
commit
fad554632e
2
readme
2
readme
@ -1,4 +1,4 @@
|
|||||||
conda create -n aienv2 python=3.10
|
conda create -n test_sahi python=3.10
|
||||||
激活环境
|
激活环境
|
||||||
|
|
||||||
conda create -n yolo_trt_10 python=3.10 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ --override-channels
|
conda create -n yolo_trt_10 python=3.10 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ --override-channels
|
||||||
|
|||||||
@ -3317,6 +3317,9 @@ async def send_frame_to_s3_mq(loop,upload_executor,task_id, mqtt, mqtt_topic, ca
|
|||||||
para = {
|
para = {
|
||||||
"category": 3
|
"category": 3
|
||||||
}
|
}
|
||||||
|
local_track_id_list=[]
|
||||||
|
local_key_id_list=[]
|
||||||
|
local_key_count_list = []
|
||||||
target_location_back = [] # 本地缓存,用作位置重复计算
|
target_location_back = [] # 本地缓存,用作位置重复计算
|
||||||
current_time_second = int(time.time())
|
current_time_second = int(time.time())
|
||||||
repeat_time_count = 0
|
repeat_time_count = 0
|
||||||
@ -3390,6 +3393,17 @@ async def send_frame_to_s3_mq(loop,upload_executor,task_id, mqtt, mqtt_topic, ca
|
|||||||
track_id = item["track_id"]
|
track_id = item["track_id"]
|
||||||
new_track_id = item["new_track_id"]
|
new_track_id = item["new_track_id"]
|
||||||
|
|
||||||
|
if track_id not in local_track_id_list:
|
||||||
|
local_track_id_list.append(track_id)
|
||||||
|
|
||||||
|
if cls_id in local_key_id_list:
|
||||||
|
first_index = local_key_id_list.index(cls_id) # 获取 key_id 的第一个下标
|
||||||
|
local_key_count_list[first_index]=local_key_count_list[first_index]+1
|
||||||
|
else:
|
||||||
|
local_key_id_list.append(cls_id)
|
||||||
|
local_key_count_list.append(1)
|
||||||
|
|
||||||
|
|
||||||
# should_report = True
|
# should_report = True
|
||||||
|
|
||||||
# # 如果这个track_id已经上报过,检查是否超过上报间隔
|
# # 如果这个track_id已经上报过,检查是否超过上报间隔
|
||||||
@ -3472,6 +3486,16 @@ async def send_frame_to_s3_mq(loop,upload_executor,task_id, mqtt, mqtt_topic, ca
|
|||||||
model_cls = model_para.get("model_cls_index", {})
|
model_cls = model_para.get("model_cls_index", {})
|
||||||
list_func_id = model_para.get("model_list_func_id", -11)
|
list_func_id = model_para.get("model_list_func_id", -11)
|
||||||
func_id = model_para.get("func_id", [])
|
func_id = model_para.get("func_id", [])
|
||||||
|
count_message=[]
|
||||||
|
for k,v in chinese_label.items():
|
||||||
|
if int(k) in local_key_id_list:
|
||||||
|
k_index=local_key_id_list.index(int(k))
|
||||||
|
clss_count=local_key_count_list[k_index]
|
||||||
|
count_message.append({
|
||||||
|
"cls_index":k_index,
|
||||||
|
"cls_name":v,
|
||||||
|
"count":clss_count
|
||||||
|
})
|
||||||
|
|
||||||
# 获取DRC消息(同步操作,放到线程池)
|
# 获取DRC消息(同步操作,放到线程池)
|
||||||
local_drc_message = await loop.run_in_executor(upload_executor, get_local_drc_message)
|
local_drc_message = await loop.run_in_executor(upload_executor, get_local_drc_message)
|
||||||
@ -3535,6 +3559,7 @@ async def send_frame_to_s3_mq(loop,upload_executor,task_id, mqtt, mqtt_topic, ca
|
|||||||
"longitude": cam_longitude,
|
"longitude": cam_longitude,
|
||||||
"latitude": cam_latitude
|
"latitude": cam_latitude
|
||||||
},
|
},
|
||||||
|
"count_message":count_message,
|
||||||
"des_location":des_location_result
|
"des_location":des_location_result
|
||||||
}
|
}
|
||||||
await event_queue.put({
|
await event_queue.put({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user