ai bug
This commit is contained in:
parent
fb557f7ac9
commit
4d3a54fe58
|
@ -1,7 +1,7 @@
|
||||||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||||
"""Client and server classes corresponding to protobuf-defined services."""
|
"""Client and server classes corresponding to protobuf-defined services."""
|
||||||
import grpc
|
import grpc
|
||||||
|
# import BeiHangGrpc_pb2 as BeiHangGrpc__pb2
|
||||||
from . import BeiHangGrpc_pb2 as BeiHangGrpc__pb2
|
from . import BeiHangGrpc_pb2 as BeiHangGrpc__pb2
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ import base64
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import requests
|
import requests
|
||||||
import grpc
|
import grpc
|
||||||
|
# import BeiHangGrpc_pb2_grpc
|
||||||
|
# import BeiHangGrpc_pb2
|
||||||
from . import BeiHangGrpc_pb2_grpc
|
from . import BeiHangGrpc_pb2_grpc
|
||||||
from . import BeiHangGrpc_pb2
|
from . import BeiHangGrpc_pb2
|
||||||
requests.packages.urllib3.disable_warnings()
|
requests.packages.urllib3.disable_warnings()
|
||||||
|
@ -17,6 +19,7 @@ def analyse(ip: str, pic_url: str):
|
||||||
ip (_type_): _description_
|
ip (_type_): _description_
|
||||||
pic_url (_type_): _description_
|
pic_url (_type_): _description_
|
||||||
"""
|
"""
|
||||||
|
# print(pic_url)
|
||||||
channel = grpc.insecure_channel(ip) # 监听频道
|
channel = grpc.insecure_channel(ip) # 监听频道
|
||||||
stub = BeiHangGrpc_pb2_grpc.Helmet_RegStub(channel) # 客户端使用Stub类发送请求,参数为频道,为了绑定链接
|
stub = BeiHangGrpc_pb2_grpc.Helmet_RegStub(channel) # 客户端使用Stub类发送请求,参数为频道,为了绑定链接
|
||||||
image_id = 3
|
image_id = 3
|
||||||
|
@ -27,6 +30,8 @@ def analyse(ip: str, pic_url: str):
|
||||||
# image_base64 = str(base64.b64encode(f.read()), encoding='utf-8')
|
# image_base64 = str(base64.b64encode(f.read()), encoding='utf-8')
|
||||||
# request = BeiHangGrpc_pb2.JinYu_Request(zzid=image_id,imgsbase64=image_base64)
|
# request = BeiHangGrpc_pb2.JinYu_Request(zzid=image_id,imgsbase64=image_base64)
|
||||||
base64img = str(base64.b64encode(BytesIO(requests.get(url=pic_url, verify=False).content).read()), 'utf-8')
|
base64img = str(base64.b64encode(BytesIO(requests.get(url=pic_url, verify=False).content).read()), 'utf-8')
|
||||||
|
# with open('face_test.txt', 'w') as f:
|
||||||
|
# f.write(base64img)
|
||||||
request = BeiHangGrpc_pb2.JinYu_Request(zzid=image_id, imgsbase64=base64img)
|
request = BeiHangGrpc_pb2.JinYu_Request(zzid=image_id, imgsbase64=base64img)
|
||||||
# request = BeiHangGrpc_pb2.JinYu_Request(zzid=image_id, imgUrl=pic_url)
|
# request = BeiHangGrpc_pb2.JinYu_Request(zzid=image_id, imgUrl=pic_url)
|
||||||
response = stub.sendHelmet_Info(request)
|
response = stub.sendHelmet_Info(request)
|
||||||
|
@ -38,10 +43,11 @@ def analyse(ip: str, pic_url: str):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
path = 'http://10.99.5.79:20309/media/2022/08/25/dsf_e9de9deb-213e-11ed-884a-e4246c7d1635_11584620_11593689.jpg'
|
path = 'http://10.99.5.24/evo-apigw/evo-oss/6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_3de82501-2521-11ed-884a-e4246c7d1635_7236037_7245601.jpg?token=399773e6-71f7-4202-b234-ff5aa8d2492c'
|
||||||
base64img = str(base64.b64encode(BytesIO(requests.get(url=path).content).read()), 'utf-8')
|
base64img = str(base64.b64encode(BytesIO(requests.get(url=path, verify=False).content).read()), 'utf-8')
|
||||||
with open('face_test.txt', 'w') as f:
|
with open('face_test.txt', 'w') as f:
|
||||||
f.write(base64img)
|
f.write(base64img)
|
||||||
helmet(
|
is_happend, res = analyse(
|
||||||
ip='122.224.229.24:2000',
|
ip='122.224.229.24:2000',
|
||||||
pic_url='http://1.203.161.103:2800/media/2022/07/06/dsf_bf6446cc-f9cd-11ec-bd2d-e4246c7d1635_34597240_34614457.jpg')
|
pic_url='http://10.99.5.24/evo-apigw/evo-oss/6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_3de82501-2521-11ed-884a-e4246c7d1635_7236037_7245601.jpg?token=399773e6-71f7-4202-b234-ff5aa8d2492c')
|
||||||
|
print(is_happend, res.helmetinfoList[0].head_helmet)
|
File diff suppressed because one or more lines are too long
|
@ -172,7 +172,7 @@ class TestViewSet(CustomGenericViewSet):
|
||||||
# global_img='https://10.99.5.24/evo-apigw/evo-oss/6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_caa9c522-24e2-11ed-884a-e4246c7d1635_62413404_62687586.jpg?token=0ff8bb53-c99e-4291-a587-272aa1f3f5eb')
|
# global_img='https://10.99.5.24/evo-apigw/evo-oss/6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_caa9c522-24e2-11ed-884a-e4246c7d1635_62413404_62687586.jpg?token=0ff8bb53-c99e-4291-a587-272aa1f3f5eb')
|
||||||
# return Response(ret.keys())
|
# return Response(ret.keys())
|
||||||
from apps.ecm.service import dispatch_dahua_event
|
from apps.ecm.service import dispatch_dahua_event
|
||||||
data = {'id': 1661504791886, 'category': 'alarm', 'method': 'alarm.msg', 'info': {'orgName': '曲阳县金隅水泥厂', 'nodeCode': '1000038$1$0$23', 'deviceCode': '1000038', 'alarmCode': 'ad3a0826-3946-4385-aa1b-cea396554d43', 'alarmPicture': '6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_caa9c522-24e2-11ed-884a-e4246c7d1635_62687586_62696295.jpg', 'nodeType': 2, 'alarmDate': '1661504788', 'alarmGrade': 2, 'isSave': True, 'extend': {'faceImageUrl': ['6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_caa9c522-24e2-11ed-884a-e4246c7d1635_62687586_62696295.jpg'], 'glass': 0, 'beard': 0, 'candidateInfo': [{'birthday': '2022-8-24', 'faceImageUrl': ['6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_caa9c522-24e2-11ed-884a-e4246c7d1635_62696295_62773181.jpg'], 'groupName': '全体人员', 'similarity': 96, 'sex': 1, 'cardType': 1, 'name': '石非凡', 'devPersonId': '46', 'id': '371324199803243658', 'type': 0}], 'sex': 0, 'occurrenceCount': 0, 'deviceCode': '1000038', 'globalScenePicUrl': '6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_caa9c522-24e2-11ed-884a-e4246c7d1635_62413404_62687586.jpg', 'eye': 0, 'alarmType': 1001003, 'perFlag': -1, 'mouth': 0, 'feature': [], 'isHit': True, 'channelSeq': 23, 'szSerialUUID': '', 'channelName': '窑头平台进料口', 'beginTime': 1661504788, 'endTime': 1661504788, 'age': -1, 'mask': 0}, 'unitType': 1, 'alarmType': 1001003, 'channelSeq': 23, 'orgCode': '001001001', 'channelName': '窑头平台进料口', 'alarmStat': 1, 'isEvent': True}, 'subsystem': 'evo-face', 'userIds': None, 'sid': None, 'domainId': None, 'infoArray': None, 'protocol': None}
|
data = {'id': 1661506561753, 'category': 'alarm', 'method': 'alarm.msg', 'info': {'orgName': '曲阳县金隅水泥厂', 'nodeCode': '1000038$1$0$23', 'deviceCode': '1000038', 'alarmCode': '30789599-b82b-45ba-9d3d-2de2bc1f1d00', 'alarmPicture': '6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_3de82501-2521-11ed-884a-e4246c7d1635_2088390_2096301.jpg', 'nodeType': 2, 'alarmDate': '1661506557', 'alarmGrade': 2, 'isSave': True, 'extend': {'faceImageUrl': ['6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_3de82501-2521-11ed-884a-e4246c7d1635_2088390_2096301.jpg'], 'glass': 0, 'beard': 0, 'candidateInfo': [{'birthday': '2022-8-24', 'faceImageUrl': ['6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_3de82501-2521-11ed-884a-e4246c7d1635_2096301_2173187.jpg'], 'groupName': '全体人员', 'similarity': 96, 'sex': 1, 'cardType': 1, 'name': '石非凡', 'devPersonId': '46', 'id': '371324199803243658', 'type': 0}], 'sex': 0, 'occurrenceCount': 0, 'deviceCode': '1000038', 'globalScenePicUrl': '6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_3de82501-2521-11ed-884a-e4246c7d1635_1825520_2088390.jpg', 'eye': 0, 'alarmType': 1001003, 'perFlag': -1, 'mouth': 0, 'feature': [], 'isHit': True, 'channelSeq': 23, 'szSerialUUID': '', 'channelName': '窑头平台进料口', 'beginTime': 1661506557, 'endTime': 1661506557, 'age': -1, 'mask': 0}, 'unitType': 1, 'alarmType': 1001003, 'channelSeq': 23, 'orgCode': '001001001', 'channelName': '窑头平台进料口', 'alarmStat': 1, 'isEvent': True}, 'subsystem': 'evo-face', 'userIds': None, 'sid': None, 'domainId': None, 'infoArray': None, 'protocol': None}
|
||||||
dispatch_dahua_event(data=data)
|
dispatch_dahua_event(data=data)
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
|
@ -232,4 +232,7 @@ class TestViewSet(CustomGenericViewSet):
|
||||||
Employee.objects.get_queryset(all=True).filter(type='remployee').delete(soft=False)
|
Employee.objects.get_queryset(all=True).filter(type='remployee').delete(soft=False)
|
||||||
User.objects.get_queryset(all=True).filter(type='remployee').delete(soft=False)
|
User.objects.get_queryset(all=True).filter(type='remployee').delete(soft=False)
|
||||||
Dept.objects.get_queryset(all=True).filter(type='rparty').delete(soft=False)
|
Dept.objects.get_queryset(all=True).filter(type='rparty').delete(soft=False)
|
||||||
|
if 'event' in datas:
|
||||||
|
from apps.ecm.models import Event
|
||||||
|
Event.objects.get_queryset(all=True).delete(soft=False)
|
||||||
return Response()
|
return Response()
|
||||||
|
|
Loading…
Reference in New Issue