From a815e7524f0cf70c7198f9961d1e8ae35d2fbfd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=89=8D=E6=98=8E?= <909355014@qq.com> Date: Mon, 12 Sep 2022 20:23:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=8D=8E=E6=99=BA=E8=83=BD=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E9=9C=80=E5=B8=83=E8=AE=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ecm/service.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/apps/ecm/service.py b/apps/ecm/service.py index ce1167fb..00e561fa 100644 --- a/apps/ecm/service.py +++ b/apps/ecm/service.py @@ -331,7 +331,7 @@ def dispatch_dahua_event(data: dict): event = None global_img_o = dhClient.get_full_pic(data['info']['alarmPicture']) happen_time = timestamp_to_time(int(data['info']['alarmDate'])) - if ec: # 先查看是否有定义该事件种类 + if ec and AlgoChannel.objects.filter(vchannel=vchannel, algo=ec).exists(): # 先查看是否有定义该事件种类并布设 event = Event() event.global_img = save_dahua_pic(global_img_o) event.area = vchannel.area @@ -356,11 +356,10 @@ def dispatch_dahua_event(data: dict): if 'helmet' in ec_codes: # 如果存在安全帽事件 # 尝试以图搜图找到当事人 - res = dhClient.face_search(path=global_img_o) - if res and res[0]: - ep = Employee.objects.filter(id_number=res[0]['identity']).first() - if ep: - obj_cate = 'people' + # res = dhClient.face_search(path=global_img_o) + # if res and res[0]: + # ep = Employee.objects.filter(id_number=res[0]['identity']).first() + obj_cate = 'people' if event is None: # 如果未创建事件 event = Event() event.global_img = save_dahua_pic(global_img_o) @@ -665,11 +664,10 @@ def snap_and_analyse(vchannel: TDevice, algo_codes: list, opl: Opl): if 'helmet' in ec_codes: # 如果存在安全帽事件 # 尝试以图搜图找到当事人 - res = dhClient.face_search(path=global_img_o) - if res and res[0]: - ep = Employee.objects.filter(id_number=res[0]['identity']).first() - if ep: - obj_cate = 'people' + # res = dhClient.face_search(path=global_img_o) + # if res and res[0]: + # ep = Employee.objects.filter(id_number=res[0]['identity']).first() + pass event = Event() event.global_img = save_dahua_pic(global_img_o) event.vchannel = vchannel