更新 concurrency/FileUploadThread.py
This commit is contained in:
parent
1542682828
commit
9f6c1eb8db
|
|
@ -8,12 +8,13 @@ from loguru import logger
|
|||
import cv2
|
||||
from entity.FeedBack import message_feedback
|
||||
from enums.ExceptionEnum import ExceptionType
|
||||
from enums.ModelTypeEnum import ModelType
|
||||
from exception.CustomerException import ServiceException
|
||||
from util.AliyunSdk import AliyunOssSdk
|
||||
from util.MinioSdk import MinioSdk
|
||||
from util import TimeUtils
|
||||
from enums.AnalysisStatusEnum import AnalysisStatus
|
||||
from util.PlotsUtils import draw_painting_joint
|
||||
from util.PlotsUtils import draw_painting_joint, draw_name_ocr, draw_name_crowd
|
||||
from util.QueUtil import put_queue, get_no_block_queue, clear_queue
|
||||
import io
|
||||
from util.LocationUtils import locate_byMqtt
|
||||
|
|
@ -46,14 +47,6 @@ class FileUpload(Thread):
|
|||
print("---line46 :FileUploadThread.py---",self._algSwitch)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#如果任务是在线、离线处理,则用此类
|
||||
class ImageFileUpload(FileUpload):
|
||||
__slots__ = ()
|
||||
|
|
@ -83,15 +76,27 @@ class ImageFileUpload(FileUpload):
|
|||
if len(target_list) > 0:
|
||||
aFrame = frame.copy()
|
||||
for target in target_list:
|
||||
draw_painting_joint(target[1], aFrame, target[3], target[2], target[4], font_config, target[5])
|
||||
igH,igW = aFrame.shape[0:2]
|
||||
if len(self._mqtt_list)>=1:
|
||||
#camParas = self._mqtt_list[0]['data']
|
||||
camParas = self._mqtt_list[0]
|
||||
gps = locate_byMqtt(target[1],igW,igH,camParas,outFormat='wgs84')
|
||||
# 自研车牌模型判断
|
||||
if ModelType.CITY_CARPLATE_MODEL.value[1] == str(code):
|
||||
box = [target[1][0][0], target[1][0][1], target[1][3][0], target[1][3][1]]
|
||||
draw_name_ocr(box, aFrame, target[4], target[0])
|
||||
cls = 0
|
||||
elif ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code):
|
||||
draw_name_crowd(target[3], aFrame, target[4], cls)
|
||||
cls = 0
|
||||
else:
|
||||
gps=[None,None]
|
||||
model_info.append({"modelCode": str(code), "detectTargetCode": str(cls), "aFrame": aFrame,'gps':gps})
|
||||
draw_painting_joint(target[1], aFrame, target[3], target[2], target[4], font_config,
|
||||
target[5])
|
||||
|
||||
igH, igW = aFrame.shape[0:2]
|
||||
if len(self._mqtt_list) >= 1:
|
||||
# camParas = self._mqtt_list[0]['data']
|
||||
camParas = self._mqtt_list[0]
|
||||
gps = locate_byMqtt(target[1], igW, igH, camParas, outFormat='wgs84')
|
||||
else:
|
||||
gps = [None, None]
|
||||
model_info.append(
|
||||
{"modelCode": str(code), "detectTargetCode": str(cls), "aFrame": aFrame, 'gps': gps})
|
||||
if len(model_info) > 0:
|
||||
image_result = {
|
||||
"or_frame": frame,
|
||||
|
|
@ -249,12 +254,20 @@ class ImageTypeImageFileUpload(Thread):
|
|||
if target_list is not None and len(target_list) > 0:
|
||||
aiFrame = copy_frame.copy()
|
||||
for target in target_list:
|
||||
# 自研车牌模型判断
|
||||
if ModelType.CITY_CARPLATE_MODEL.value[1] == str(code):
|
||||
draw_name_ocr(target[1], aiFrame, font_config[cls], target[0])
|
||||
elif ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code):
|
||||
draw_name_crowd(target[1],aiFrame,font_config[cls],target[0])
|
||||
else:
|
||||
draw_painting_joint(target[1], aiFrame, target[3], target[2], target[4], font_config)
|
||||
|
||||
model_info.append({
|
||||
"modelCode": str(code),
|
||||
"detectTargetCode": str(cls),
|
||||
"frame": aiFrame
|
||||
})
|
||||
|
||||
if len(model_info) > 0:
|
||||
image_result = {
|
||||
"or_frame": copy_frame,
|
||||
|
|
@ -363,8 +376,7 @@ class ImageTypeImageFileUpload(Thread):
|
|||
for thread_result in task:
|
||||
remote_url_list.append(thread_result.result())
|
||||
|
||||
|
||||
#以下代码是为了获取图像上传后,返回的全路径地址
|
||||
# 以下代码是为了获取图像上传后,返回的全路径地址
|
||||
if det_xywh is None:
|
||||
msg_list.append(message_feedback(request_id,
|
||||
AnalysisStatus.RUNNING.value,
|
||||
|
|
@ -397,10 +409,6 @@ class ImageTypeImageFileUpload(Thread):
|
|||
model_info_list[ii].get('detectTargetCode'),
|
||||
analyse_results=result))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for msg in msg_list:
|
||||
put_queue(fb_queue, msg, timeout=2, is_ex=False)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue