页面文字修改
This commit is contained in:
parent
22412d0be1
commit
4fa0bb11d1
|
@ -26,6 +26,8 @@ def ai_analyse(codes: list, global_img: str, face_img: str = None, is_dahua_pic:
|
|||
face_img (str): 人脸图片url地址
|
||||
"""
|
||||
results = {} # dict key: 触发的事件标识字符 value: 多个矩形框坐标列表; 有两个图片key值
|
||||
global_img_path = ''
|
||||
face_img_path = ''
|
||||
if is_dahua_pic: # 先保存到本地/主要是现在算法必须得用可访问的远程地址
|
||||
from apps.ecm.service import save_dahua_pic
|
||||
global_img_path = save_dahua_pic(global_img)
|
||||
|
@ -40,9 +42,11 @@ def ai_analyse(codes: list, global_img: str, face_img: str = None, is_dahua_pic:
|
|||
f = getattr(m, func)
|
||||
try:
|
||||
is_happend, res, rectangle_dict = False, None, {}
|
||||
if i == 'helmet': # 如果是安全帽抠图识别
|
||||
if face_img:
|
||||
if i == 'helmet': # 如果是安全帽识别
|
||||
if face_img: # 如果有小图
|
||||
is_happend, res = f(ip=settings.AI_IP, pic_url=face_img)
|
||||
# if is_happend: # 补偿机制: 如果小图识别为未带安全帽,为了保证正确率,再用大图识别一次
|
||||
# is_happend, res = getattr(m, 'helmet2')(ip=settings.AI_IP, pic_url=global_img)
|
||||
else:
|
||||
is_happend, res = getattr(m, 'helmet2')(ip=settings.AI_IP, pic_url=global_img)
|
||||
else:
|
||||
|
@ -53,7 +57,7 @@ def ai_analyse(codes: list, global_img: str, face_img: str = None, is_dahua_pic:
|
|||
qiping_qd = False # 气瓶倾倒未发生
|
||||
rectangle_dict .update({'qiping': []}) # 气瓶倾倒的坐标字典
|
||||
for x in res.FireinfoList:
|
||||
if x.fire == 3 and 'qiping' in codes: # 气瓶倾倒
|
||||
if x.fire == 3: # 气瓶倾倒
|
||||
qiping_qd = True
|
||||
rectangle_dict['qiping'].append([(x.coord.uleft.x, x.coord.uleft.y), (x.coord.lright.x, x.coord.lright.y)]) # 加入矩形框
|
||||
if x.fire == 0:
|
||||
|
@ -66,10 +70,10 @@ def ai_analyse(codes: list, global_img: str, face_img: str = None, is_dahua_pic:
|
|||
results.update({i: rectangle_dict.get(i, [])})
|
||||
except Exception:
|
||||
myLogger.error('算法处理错误', exc_info=True)
|
||||
if is_dahua_pic:
|
||||
if global_img_path:
|
||||
os.remove(settings.BASE_DIR + global_img_path) # 删除临时图片
|
||||
if face_img:
|
||||
os.remove(settings.BASE_DIR + face_img_path)
|
||||
if face_img_path:
|
||||
os.remove(settings.BASE_DIR + face_img_path)
|
||||
return results
|
||||
|
||||
|
||||
|
@ -86,7 +90,7 @@ def ai_analyse_2(codes: list, global_img: str, face_img: str = None, is_dahua_pi
|
|||
from apps.ecm.service import save_dahua_pic
|
||||
global_img_path = save_dahua_pic(global_img)
|
||||
global_img_local = settings.BASE_DIR + global_img_path
|
||||
draw(global_img_local, results)
|
||||
draw(global_img_local, results) # 绘制矩形框
|
||||
results.update({'global_img': global_img_path})
|
||||
return results
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ class BltViewSet(CustomGenericViewSet):
|
|||
area = Area.objects.get(id=data['area'])
|
||||
railId = area.third_info['xx_rail']['id']
|
||||
except Exception:
|
||||
raise ParseError('区域信息不正确')
|
||||
raise ParseError('围栏未绘制')
|
||||
json = {
|
||||
"railId": railId,
|
||||
"type": ""
|
||||
|
|
|
@ -50,7 +50,7 @@ class VisitorCreateSerializer(CustomModelSerializer):
|
|||
phone = serializers.CharField(label="手机号", validators=[check_phone_e])
|
||||
photo = serializers.CharField(label='照片地址', required=True)
|
||||
id_number = serializers.CharField(
|
||||
label="身份证号", validators=[check_id_number_e])
|
||||
label="身份证号", validators=[check_id_number_e], required=True)
|
||||
|
||||
class Meta:
|
||||
model = Visitor
|
||||
|
|
|
@ -29,7 +29,8 @@ class VisitViewSet(CustomModelViewSet):
|
|||
serializer_class = VisitSerializer
|
||||
retrieve_serializer_class = VisitDetailSerializer
|
||||
filterset_fields = ['state', 'create_by', 'purpose']
|
||||
select_related_fields = ['ticket', 'receptionist', 'ticket__workflow', 'ticket__state']
|
||||
select_related_fields = ['ticket', 'receptionist',
|
||||
'ticket__workflow', 'ticket__state']
|
||||
|
||||
def get_queryset(self):
|
||||
user = self.request.user
|
||||
|
@ -58,17 +59,9 @@ class VisitViewSet(CustomModelViewSet):
|
|||
raise ParseError('该项目人员在厂不可删除')
|
||||
return super().destroy(request, *args, **kwargs)
|
||||
|
||||
# @action(methods=['post'], detail=True, permission_classes=[],
|
||||
# serializer_class=Serializer)
|
||||
# @transaction.atomic
|
||||
# def submit(self, request, *args, **kwargs):
|
||||
# """司机直接提交不走工单
|
||||
|
||||
# 司机直接提交不走工单
|
||||
# """
|
||||
# obj = self.get_object()
|
||||
# visit_driver_end(obj)
|
||||
# return Response()
|
||||
@action(methods=['get'], detail=False, perms_map={'get': '*'}, serializer_class=Serializer)
|
||||
def export_excel(self, request, pk=None):
|
||||
return Response()
|
||||
|
||||
|
||||
class VisitorViewSet(CustomModelViewSet):
|
||||
|
|
Loading…
Reference in New Issue