人脸识别阈值
This commit is contained in:
parent
885497f651
commit
97710370b6
|
@ -74,14 +74,15 @@ class EmployeeCreateUpdateSerializer(CustomModelSerializer):
|
|||
instance.user.save()
|
||||
# 同时去除门禁授权
|
||||
if settings.DAHUA_ENABLED and dhClient:
|
||||
if instance.type == 'employee':
|
||||
# 如果是正式员工或相关方且有门禁权限:
|
||||
if instance.type in ['employee', 'remployee'] and instance.third_info.get('dh_face_card', None):
|
||||
start_time = None
|
||||
end_time = None
|
||||
if instance.job_state == 20 and old_job_state == 10: # 离职
|
||||
now = datetime.now()
|
||||
start_time = now
|
||||
end_time = now + timedelta(minutes=60)
|
||||
elif instance.job_state == 10 and old_job_state == 20: # 重新在职
|
||||
elif instance.job_state == 10 and old_job_state == 20 and instance.type == 'employee': # 正式员工重新在职
|
||||
now = datetime.now()
|
||||
start_time = now
|
||||
end_time = now + timedelta(days=7300)
|
||||
|
|
|
@ -258,7 +258,7 @@ class DhClient:
|
|||
}
|
||||
self.request(**dhapis['face_bind'], json=json_data)
|
||||
|
||||
def face_deploy(self):
|
||||
def face_deploy(self, minSim: int = 90):
|
||||
|
||||
params = {
|
||||
"id": "001001001",
|
||||
|
@ -271,8 +271,8 @@ class DhClient:
|
|||
_, res = self.request(**dhapis['dev_tree'], params=params)
|
||||
for i in json.loads(res):
|
||||
json_data = {
|
||||
"minSimilarity": "80",
|
||||
"dpMinSimilarity": 80,
|
||||
"minSimilarity": str(minSim),
|
||||
"dpMinSimilarity": minSim,
|
||||
"surveyType": ["1"],
|
||||
"groups": str(settings.DAHUA_FACEGROUPID_1),
|
||||
"chnId": i['id']
|
||||
|
|
|
@ -396,5 +396,5 @@ class DhCommonViewSet(CreateModelMixin, CustomGenericViewSet):
|
|||
|
||||
人脸库同步到所有智能设备
|
||||
"""
|
||||
dhClient.face_deploy()
|
||||
dhClient.face_deploy(request.data.get('minSim', 90))
|
||||
return Response()
|
||||
|
|
Loading…
Reference in New Issue