1)新增M027:建筑物下行人检测及计数 2)密集人群计数模型及自研车牌模型优化 3)分类模型支持pt模型加载(巴中水利)
This commit is contained in:
commit
98480b45d6
|
|
@ -27,6 +27,7 @@ class FileUpload(Thread):
|
|||
super().__init__()
|
||||
self._fb_queue, self._context, self._msg, self._image_queue, self._analyse_type, self._mqtt_list = args
|
||||
self._storage_source = self._context['service']['storage_source']
|
||||
<<<<<<< HEAD
|
||||
self._algStatus = False # 默认关闭
|
||||
|
||||
# self._algStatus = True # 默认关闭
|
||||
|
|
@ -34,6 +35,17 @@ class FileUpload(Thread):
|
|||
|
||||
# 0521:
|
||||
default_enabled = str(self._msg.get("defaultEnabled", "True")).lower() == "true"
|
||||
=======
|
||||
self._algStatus = False # 默认关闭
|
||||
|
||||
# self._algStatus = True # 默认关闭
|
||||
self._algSwitch = self._context['service']['algSwitch']
|
||||
|
||||
|
||||
|
||||
#0521:
|
||||
default_enabled = str(self._msg.get("defaultEnabled", "True")).lower() == "true"
|
||||
>>>>>>> origin/zsl
|
||||
if default_enabled:
|
||||
print("执行默认程序(defaultEnabled=True)")
|
||||
self._algSwitch = True
|
||||
|
|
@ -43,10 +55,17 @@ class FileUpload(Thread):
|
|||
# 这里放非默认逻辑的代码
|
||||
self._algSwitch = False
|
||||
|
||||
<<<<<<< HEAD
|
||||
print("---line46 :FileUploadThread.py---", self._algSwitch)
|
||||
|
||||
|
||||
# 如果任务是在线、离线处理,则用此类
|
||||
=======
|
||||
print("---line46 :FileUploadThread.py---",self._algSwitch)
|
||||
|
||||
|
||||
#如果任务是在线、离线处理,则用此类
|
||||
>>>>>>> origin/zsl
|
||||
class ImageFileUpload(FileUpload):
|
||||
__slots__ = ()
|
||||
|
||||
|
|
@ -66,6 +85,10 @@ class ImageFileUpload(FileUpload):
|
|||
'''
|
||||
print('*' * 100, ' mqtt_list:', len(self._mqtt_list))
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> origin/zsl
|
||||
model_info = []
|
||||
# 更加模型编码解析数据
|
||||
for code, det_list in det_xywh.items():
|
||||
|
|
@ -76,10 +99,19 @@ class ImageFileUpload(FileUpload):
|
|||
for target in target_list:
|
||||
# 自研车牌模型判断
|
||||
if ModelType.CITY_CARPLATE_MODEL.value[1] == str(code):
|
||||
<<<<<<< HEAD
|
||||
draw_name_ocr(target[1], aFrame, target[4])
|
||||
elif ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code) or\
|
||||
ModelType.CITY_UNDERBUILDCOUNT_MODEL.value[1] == str(code):
|
||||
draw_name_crowd(target[1], aFrame, target[4])
|
||||
=======
|
||||
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
|
||||
>>>>>>> origin/zsl
|
||||
else:
|
||||
draw_painting_joint(target[1], aFrame, target[3], target[2], target[4], font_config,
|
||||
target[5])
|
||||
|
|
@ -139,10 +171,15 @@ class ImageFileUpload(FileUpload):
|
|||
if 'stop' == image_msg[1]:
|
||||
logger.info("开始停止图片上传线程, requestId:{}", request_id)
|
||||
break
|
||||
<<<<<<< HEAD
|
||||
if 'algStart' == image_msg[1]: self._algStatus = True; logger.info(
|
||||
"图片上传线程,执行算法开启命令, requestId:{}", request_id)
|
||||
if 'algStop' == image_msg[1]: self._algStatus = False; logger.info(
|
||||
"图片上传线程,执行算法关闭命令, requestId:{}", request_id)
|
||||
=======
|
||||
if 'algStart' == image_msg[1]: self._algStatus = True; logger.info("图片上传线程,执行算法开启命令, requestId:{}", request_id)
|
||||
if 'algStop' == image_msg[1]: self._algStatus = False; logger.info("图片上传线程,执行算法关闭命令, requestId:{}", request_id)
|
||||
>>>>>>> origin/zsl
|
||||
|
||||
if image_msg[0] == 1:
|
||||
image_result = self.handle_image(image_msg[1], frame_step)
|
||||
|
|
@ -153,8 +190,13 @@ class ImageFileUpload(FileUpload):
|
|||
image_result["last_frame"],
|
||||
analyse_type,
|
||||
"OR", "0", "0", request_id)
|
||||
<<<<<<< HEAD
|
||||
if self._storage_source == 1:
|
||||
or_future = t.submit(minioSdk.put_object, or_image, or_image_name)
|
||||
=======
|
||||
if self._storage_source==1:
|
||||
or_future = t.submit(minioSdk.put_object, or_image,or_image_name)
|
||||
>>>>>>> origin/zsl
|
||||
else:
|
||||
or_future = t.submit(aliyunOssSdk.put_object, or_image_name, or_image.tobytes())
|
||||
task.append(or_future)
|
||||
|
|
@ -169,12 +211,20 @@ class ImageFileUpload(FileUpload):
|
|||
model_info["modelCode"],
|
||||
model_info["detectTargetCode"],
|
||||
request_id)
|
||||
<<<<<<< HEAD
|
||||
if self._storage_source == 1:
|
||||
=======
|
||||
if self._storage_source==1:
|
||||
>>>>>>> origin/zsl
|
||||
ai_future = t.submit(minioSdk.put_object, ai_image,
|
||||
ai_image_name)
|
||||
else:
|
||||
ai_future = t.submit(aliyunOssSdk.put_object, ai_image_name,
|
||||
<<<<<<< HEAD
|
||||
ai_image.tobytes())
|
||||
=======
|
||||
ai_image.tobytes())
|
||||
>>>>>>> origin/zsl
|
||||
|
||||
task.append(ai_future)
|
||||
# msg_list.append(message_feedback(request_id,
|
||||
|
|
@ -198,9 +248,15 @@ class ImageFileUpload(FileUpload):
|
|||
model_info['detectTargetCode'],
|
||||
longitude=model_info['gps'][0],
|
||||
latitude=model_info['gps'][1],
|
||||
<<<<<<< HEAD
|
||||
))
|
||||
|
||||
if (not self._algSwitch) or (self._algStatus and self._algSwitch):
|
||||
=======
|
||||
) )
|
||||
|
||||
if (not self._algSwitch) or ( self._algStatus and self._algSwitch):
|
||||
>>>>>>> origin/zsl
|
||||
for msg in msg_list:
|
||||
put_queue(fb_queue, msg, timeout=2, is_ex=False)
|
||||
del task, msg_list
|
||||
|
|
@ -225,6 +281,10 @@ def build_image_name(*args):
|
|||
time_now = TimeUtils.now_date_to_str("%Y-%m-%d-%H-%M-%S")
|
||||
return "%s/%s_frame-%s-%s_type_%s-%s-%s-%s_%s.jpg" % (request_id, time_now, current_frame, last_frame,
|
||||
random_num, mode_type, modeCode, target, image_type)
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> origin/zsl
|
||||
|
||||
|
||||
# 如果任务是图像处理,则用此类
|
||||
|
|
@ -257,10 +317,16 @@ class ImageTypeImageFileUpload(Thread):
|
|||
for target in target_list:
|
||||
# 自研车牌模型判断
|
||||
if ModelType.CITY_CARPLATE_MODEL.value[1] == str(code):
|
||||
<<<<<<< HEAD
|
||||
draw_name_ocr(target, aiFrame, font_config[cls])
|
||||
elif ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code) or \
|
||||
ModelType.CITY_UNDERBUILDCOUNT_MODEL.value[1] == str(code):
|
||||
draw_name_crowd(target, aiFrame, font_config[cls])
|
||||
=======
|
||||
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])
|
||||
>>>>>>> origin/zsl
|
||||
else:
|
||||
draw_painting_joint(target[1], aiFrame, target[3], target[2], target[4], font_config)
|
||||
|
||||
|
|
@ -315,8 +381,13 @@ class ImageTypeImageFileUpload(Thread):
|
|||
ai_image_name = build_image_name(0, 0, analyse_type, "AI", result.get("modelCode"),
|
||||
result.get("type"), request_id)
|
||||
|
||||
<<<<<<< HEAD
|
||||
if self._storage_source == 1:
|
||||
ai_future = t.submit(minioSdk.put_object, copy_frame, ai_image_name)
|
||||
=======
|
||||
if self._storage_source==1:
|
||||
ai_future = t.submit(minioSdk.put_object, copy_frame,ai_image_name)
|
||||
>>>>>>> origin/zsl
|
||||
else:
|
||||
ai_future = t.submit(aliyunOssSdk.put_object, ai_image_name, copy_frame)
|
||||
|
||||
|
|
@ -338,12 +409,21 @@ class ImageTypeImageFileUpload(Thread):
|
|||
if image_url is None:
|
||||
or_result, or_image = cv2.imencode(".jpg", image_result.get("or_frame"))
|
||||
image_url_0 = build_image_name(image_result.get("current_frame"),
|
||||
<<<<<<< HEAD
|
||||
image_result.get("last_frame"),
|
||||
analyse_type,
|
||||
"OR", "0", "O", request_id)
|
||||
|
||||
if self._storage_source == 1:
|
||||
or_future = t.submit(minioSdk.put_object, or_image, image_url_0)
|
||||
=======
|
||||
image_result.get("last_frame"),
|
||||
analyse_type,
|
||||
"OR", "0", "O", request_id)
|
||||
|
||||
if self._storage_source==1:
|
||||
or_future = t.submit(minioSdk.put_object, or_image,image_url_0)
|
||||
>>>>>>> origin/zsl
|
||||
else:
|
||||
or_future = t.submit(aliyunOssSdk.put_object, image_url_0,
|
||||
or_image.tobytes())
|
||||
|
|
@ -359,8 +439,13 @@ class ImageTypeImageFileUpload(Thread):
|
|||
model_info.get("modelCode"),
|
||||
model_info.get("detectTargetCode"),
|
||||
request_id)
|
||||
<<<<<<< HEAD
|
||||
if self._storage_source == 1:
|
||||
ai_future = t.submit(minioSdk.put_object, ai_image, ai_image_name)
|
||||
=======
|
||||
if self._storage_source==1:
|
||||
ai_future = t.submit(minioSdk.put_object, ai_image, ai_image_name)
|
||||
>>>>>>> origin/zsl
|
||||
else:
|
||||
ai_future = t.submit(aliyunOssSdk.put_object, ai_image_name,
|
||||
ai_image.tobytes())
|
||||
|
|
|
|||
|
|
@ -91,6 +91,10 @@ class IntelligentRecognitionProcess(Process):
|
|||
hb_thread.start()
|
||||
return hb_thread
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> origin/zsl
|
||||
|
||||
|
||||
class OnlineIntelligentRecognitionProcess(IntelligentRecognitionProcess):
|
||||
|
|
@ -296,8 +300,12 @@ class OnlineIntelligentRecognitionProcess(IntelligentRecognitionProcess):
|
|||
for i, model in enumerate(model_array):
|
||||
model_conf, code = model
|
||||
if ModelType.CITY_CARPLATE_MODEL.value[1] == str(code) or \
|
||||
<<<<<<< HEAD
|
||||
ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code) or\
|
||||
ModelType.CITY_UNDERBUILDCOUNT_MODEL.value[1] == str(code):
|
||||
=======
|
||||
ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code):
|
||||
>>>>>>> origin/zsl
|
||||
if draw_config.get(code) is None:
|
||||
draw_config[code] = {}
|
||||
draw_config["font_config"] = model_conf[4]
|
||||
|
|
@ -623,8 +631,12 @@ class OfflineIntelligentRecognitionProcess(IntelligentRecognitionProcess):
|
|||
for i, model in enumerate(model_array):
|
||||
model_conf, code = model
|
||||
if ModelType.CITY_CARPLATE_MODEL.value[1] == str(code) or \
|
||||
<<<<<<< HEAD
|
||||
ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code) or\
|
||||
ModelType.CITY_UNDERBUILDCOUNT_MODEL.value[1] == str(code):
|
||||
=======
|
||||
ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code):
|
||||
>>>>>>> origin/zsl
|
||||
if draw_config.get(code) is None:
|
||||
draw_config[code] = {}
|
||||
draw_config["font_config"] = model_conf[4]
|
||||
|
|
@ -941,7 +953,11 @@ class PhotosIntelligentRecognitionProcess(Process):
|
|||
logger.error("模型分析异常: {}, requestId: {}", format_exc(), request_id)
|
||||
raise e
|
||||
|
||||
<<<<<<< HEAD
|
||||
#自研车牌模型
|
||||
=======
|
||||
#自研究车牌模型
|
||||
>>>>>>> origin/zsl
|
||||
def carplate_rec(self, imageUrl, mod, image_queue, request_id):
|
||||
try:
|
||||
# model_conf: modeType, allowedList, detpar, ocrmodel, rainbows
|
||||
|
|
@ -980,6 +996,10 @@ class PhotosIntelligentRecognitionProcess(Process):
|
|||
# param = [image, new_device, model, par, img_type, request_id]
|
||||
# model_conf, frame, device, requestId
|
||||
dataBack = MODEL_CONFIG[code][3]([[modeType, device, model, postPar], image, request_id])[0][2]
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
logger.info("当前人数:{}", dataBack[0][0])
|
||||
>>>>>>> origin/zsl
|
||||
dets[code][0] = dataBack
|
||||
if not dataBack:
|
||||
logger.info("当前页面无人")
|
||||
|
|
@ -1268,8 +1288,12 @@ class PhotosIntelligentRecognitionProcess(Process):
|
|||
result = t.submit(self.carpalteRec, imageUrls, model, image_queue, request_id)
|
||||
task_list.append(result)
|
||||
# 人群计数模型
|
||||
<<<<<<< HEAD
|
||||
elif model[1] == ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] or \
|
||||
model[1] == ModelType.CITY_UNDERBUILDCOUNT_MODEL.value[1]:
|
||||
=======
|
||||
elif model[1] == ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1]:
|
||||
>>>>>>> origin/zsl
|
||||
result = t.submit(self.denscrowdcountRec, imageUrls, model, image_queue, request_id)
|
||||
task_list.append(result)
|
||||
else:
|
||||
|
|
@ -1484,9 +1508,15 @@ class ScreenRecordingProcess(Process):
|
|||
clear_queue(self._hb_queue)
|
||||
clear_queue(self._pull_queue)
|
||||
|
||||
<<<<<<< HEAD
|
||||
def upload_video(self, base_dir, env, request_id, orFilePath):
|
||||
if self._storage_source == 1:
|
||||
minioSdk = MinioSdk(base_dir, env, request_id)
|
||||
=======
|
||||
def upload_video(self,base_dir, env, request_id, orFilePath):
|
||||
if self._storage_source==1:
|
||||
minioSdk = MinioSdk(base_dir, env, request_id )
|
||||
>>>>>>> origin/zsl
|
||||
upload_video_thread_ai = Common(minioSdk.put_object, aiFilePath, "%s/ai_online.mp4" % request_id)
|
||||
else:
|
||||
aliyunVodSdk = ThAliyunVodSdk(base_dir, env, request_id)
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ class OnPushStreamProcess(PushStreamProcess):
|
|||
# 自研车牌模型处理
|
||||
if ModelType.CITY_CARPLATE_MODEL.value[1] == str(code):
|
||||
cls = 0
|
||||
<<<<<<< HEAD
|
||||
box = xy2xyxy(qs[1])
|
||||
score = None
|
||||
color = rainbows[cls]
|
||||
|
|
@ -159,10 +160,22 @@ class OnPushStreamProcess(PushStreamProcess):
|
|||
elif ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code) or\
|
||||
ModelType.CITY_UNDERBUILDCOUNT_MODEL.value[1] == str(code):
|
||||
cls = 0
|
||||
=======
|
||||
ocrlabel, xybox = qs
|
||||
box = xy2xyxy(xybox)
|
||||
score = None
|
||||
color = rainbows[cls]
|
||||
label_array = None
|
||||
rr = t.submit(draw_name_ocr, xybox, copy_frame, color, ocrlabel)
|
||||
elif ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code):
|
||||
cls = 0
|
||||
crowdlabel, points = qs
|
||||
>>>>>>> origin/zsl
|
||||
box = [(0, 0), (0, 0), (0, 0), (0, 0)]
|
||||
score = None
|
||||
color = rainbows[cls]
|
||||
label_array = None
|
||||
<<<<<<< HEAD
|
||||
rr = t.submit(draw_name_crowd, qs, copy_frame, color)
|
||||
else:
|
||||
try: # 应对NaN情况
|
||||
|
|
@ -179,6 +192,24 @@ class OnPushStreamProcess(PushStreamProcess):
|
|||
else:
|
||||
rr = t.submit(draw_painting_joint, box, copy_frame, label_array,
|
||||
score, color, font_config)
|
||||
=======
|
||||
rr = t.submit(draw_name_crowd, points, copy_frame, color, crowdlabel)
|
||||
else:
|
||||
try: # 应对NaN情况
|
||||
box, score, cls = xywh2xyxy2(qs)
|
||||
except:
|
||||
continue
|
||||
if cls not in allowedList or score < frame_score:
|
||||
continue
|
||||
label_array, color = label_arrays[cls], rainbows[cls]
|
||||
if ModelType.CHANNEL2_MODEL.value[1] == str(code) and cls == 2:
|
||||
rr = t.submit(draw_name_joint, box, copy_frame,
|
||||
draw_config[code]["label_dict"], score, color,
|
||||
font_config, qs[6])
|
||||
else:
|
||||
rr = t.submit(draw_painting_joint, box, copy_frame, label_array,
|
||||
score, color, font_config)
|
||||
>>>>>>> origin/zsl
|
||||
|
||||
thread_p.append(rr)
|
||||
if det_xywh.get(code) is None:
|
||||
|
|
@ -260,10 +291,18 @@ class OnPushStreamProcess(PushStreamProcess):
|
|||
is_new = False
|
||||
if q[11] == 1:
|
||||
is_new = True
|
||||
<<<<<<< HEAD
|
||||
if ModelType.CITY_CARPLATE_MODEL.value[1] == str(code) or \
|
||||
ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code) or\
|
||||
ModelType.CITY_UNDERBUILDCOUNT_MODEL.value[1] == str(code):
|
||||
box = qs
|
||||
=======
|
||||
if ModelType.CITY_CARPLATE_MODEL.value[1] == str(code):
|
||||
cls = ocrlabel
|
||||
elif ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code):
|
||||
cls = crowdlabel
|
||||
label_array = points
|
||||
>>>>>>> origin/zsl
|
||||
if cd is None:
|
||||
det_xywh2[code][cls] = [[cls, box, score, label_array, color, is_new]]
|
||||
else:
|
||||
|
|
@ -391,21 +430,38 @@ class OffPushStreamProcess(PushStreamProcess):
|
|||
# 自研车牌模型处理
|
||||
if ModelType.CITY_CARPLATE_MODEL.value[1] == str(code):
|
||||
cls = 0
|
||||
<<<<<<< HEAD
|
||||
box = xy2xyxy(qs[1])
|
||||
=======
|
||||
ocrlabel, xybox = qs
|
||||
box = xy2xyxy(xybox)
|
||||
>>>>>>> origin/zsl
|
||||
score = None
|
||||
color = rainbows[cls]
|
||||
label_array = None
|
||||
label_arrays = [None]
|
||||
<<<<<<< HEAD
|
||||
rr = t.submit(draw_name_ocr, qs, copy_frame, color)
|
||||
|
||||
elif ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code) or\
|
||||
ModelType.CITY_UNDERBUILDCOUNT_MODEL.value[1] == str(code):
|
||||
cls = 0
|
||||
=======
|
||||
rr = t.submit(draw_name_ocr,xybox,copy_frame,color,ocrlabel)
|
||||
|
||||
elif ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code):
|
||||
cls = 0
|
||||
crowdlabel, points = qs
|
||||
>>>>>>> origin/zsl
|
||||
box = [(0,0),(0,0),(0,0),(0,0)]
|
||||
score = None
|
||||
color = rainbows[cls]
|
||||
label_array = None
|
||||
<<<<<<< HEAD
|
||||
rr = t.submit(draw_name_crowd, qs, copy_frame, color)
|
||||
=======
|
||||
rr = t.submit(draw_name_crowd, points, copy_frame, color, crowdlabel)
|
||||
>>>>>>> origin/zsl
|
||||
|
||||
else:
|
||||
box, score, cls = xywh2xyxy2(qs)
|
||||
|
|
@ -497,10 +553,19 @@ class OffPushStreamProcess(PushStreamProcess):
|
|||
if q[11] == 1:
|
||||
is_new = True
|
||||
|
||||
<<<<<<< HEAD
|
||||
if ModelType.CITY_CARPLATE_MODEL.value[1] == str(code) or \
|
||||
ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code) or\
|
||||
ModelType.CITY_UNDERBUILDCOUNT_MODEL.value[1] == str(code):
|
||||
box = qs
|
||||
=======
|
||||
if ModelType.CITY_CARPLATE_MODEL.value[1] == str(code):
|
||||
cls = ocrlabel
|
||||
elif ModelType.CITY_DENSECROWDCOUNT_MODEL.value[1] == str(code):
|
||||
cls = crowdlabel
|
||||
label_array = points
|
||||
|
||||
>>>>>>> origin/zsl
|
||||
if cd is None:
|
||||
det_xywh2[code][cls] = [[cls, box, score, label_array, color, is_new]]
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -374,8 +374,13 @@ class ModelType(Enum):
|
|||
},
|
||||
'models':[
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
'weight':'../weights/trt/AIlib2/cityMangement3/yolov5_%s_fp16.engine'%(gpuName),
|
||||
'name':'yolov5',
|
||||
=======
|
||||
'weight':'../weights/trt/AIlib2/cityMangement3/yolov5_%s_fp16.engine'%(gpuName),
|
||||
'name':'yolov5',
|
||||
>>>>>>> origin/zsl
|
||||
'model':yolov5Model,
|
||||
'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.45,'allowedList':[0,1,2,3,4,5,6,7],'segRegionCnt':1, 'trtFlag_det':True,'trtFlag_seg':True, "score_byClass":{"0":0.8,"1":0.4,"2":0.5,"3":0.5 } }
|
||||
},
|
||||
|
|
@ -974,7 +979,11 @@ class ModelType(Enum):
|
|||
'row': 2,
|
||||
'line': 2,
|
||||
'point_loss_coef': 0.45,
|
||||
<<<<<<< HEAD
|
||||
'conf': 0.50,
|
||||
=======
|
||||
'conf': 0.25,
|
||||
>>>>>>> origin/zsl
|
||||
'gpu_id': 0,
|
||||
'eos_coef': '0.5',
|
||||
'set_cost_class': 1,
|
||||
|
|
@ -1002,6 +1011,7 @@ class ModelType(Enum):
|
|||
"rainbows": COLOR
|
||||
},
|
||||
|
||||
<<<<<<< HEAD
|
||||
})
|
||||
|
||||
CITY_UNDERBUILDCOUNT_MODEL = ("30", "306", "建筑物下人群计数", 'perUnderBuild', lambda device, gpuName: {
|
||||
|
|
@ -1036,6 +1046,8 @@ class ModelType(Enum):
|
|||
'backbone': 'vgg16_bn'
|
||||
},
|
||||
}],
|
||||
=======
|
||||
>>>>>>> origin/zsl
|
||||
})
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -406,8 +406,13 @@ class DENSECROWDCOUNTModel:
|
|||
par = modeType.value[4](str(device), gpu_name)
|
||||
rainbows = par["rainbows"]
|
||||
models=[ modelPar['model'](weights=modelPar['weight'],par=modelPar['par']) for modelPar in par['models'] ]
|
||||
<<<<<<< HEAD
|
||||
postPar = [pp['par'] for pp in par['models']]
|
||||
self.model_conf = (modeType, device, models, postPar, rainbows)
|
||||
=======
|
||||
postPar = par['models'][0]['par']
|
||||
self.model_conf = (modeType, device, models[0], postPar, rainbows)
|
||||
>>>>>>> origin/zsl
|
||||
except Exception:
|
||||
logger.error("模型加载异常:{}, requestId:{}", format_exc(), requestId)
|
||||
raise ServiceException(ExceptionType.MODEL_LOADING_EXCEPTION.value[0],
|
||||
|
|
@ -756,6 +761,7 @@ MODEL_CONFIG = {
|
|||
None,
|
||||
lambda x: cc_process(x)
|
||||
),
|
||||
<<<<<<< HEAD
|
||||
# 加载建筑物下行人检测模型
|
||||
ModelType.CITY_UNDERBUILDCOUNT_MODEL.value[1]: (
|
||||
lambda x, y, r, t, z, h: DENSECROWDCOUNTModel(x, y, r, ModelType.CITY_UNDERBUILDCOUNT_MODEL, t, z, h),
|
||||
|
|
@ -763,4 +769,6 @@ MODEL_CONFIG = {
|
|||
None,
|
||||
lambda x: cc_process(x)
|
||||
),
|
||||
=======
|
||||
>>>>>>> origin/zsl
|
||||
}
|
||||
|
|
|
|||
|
|
@ -225,11 +225,19 @@ def draw_name_joint(box, img, label_array_dict, score=0.5, color=None, config=No
|
|||
cv2.putText(img, label, p3, 0, config[3], [225, 255, 255], thickness=config[4], lineType=cv2.LINE_AA)
|
||||
return img, box
|
||||
|
||||
<<<<<<< HEAD
|
||||
def draw_name_ocr(box, img, color, line_thickness=2, outfontsize=40):
|
||||
font = ImageFont.truetype(FONT_PATH, outfontsize, encoding='utf-8')
|
||||
# (color=None, label=None, font=None, fontSize=40, unify=False)
|
||||
label_zh = get_label_array(color, box[0], font, outfontsize)
|
||||
return plot_one_box_auto(box[1], img, color, line_thickness, label_zh)
|
||||
=======
|
||||
def draw_name_ocr(box, img, color, label, line_thickness=2, outfontsize=40):
|
||||
font = ImageFont.truetype(FONT_PATH, outfontsize, encoding='utf-8')
|
||||
#(color=None, label=None, font=None, fontSize=40, unify=False)
|
||||
label_zh = get_label_array(color, label, font, outfontsize)
|
||||
return plot_one_box_auto(box, img, color, line_thickness, label_zh)
|
||||
>>>>>>> origin/zsl
|
||||
|
||||
def filterBox(det0, det1, pix_dis):
|
||||
# det0为 (m1, 11) 矩阵
|
||||
|
|
@ -317,6 +325,7 @@ def plot_one_box_auto(box, img, color=None, line_thickness=2, label_array=None):
|
|||
return img, box
|
||||
|
||||
|
||||
<<<<<<< HEAD
|
||||
def draw_name_crowd(dets, img, color, line_thickness=2, outfontsize=20):
|
||||
font = ImageFont.truetype(FONT_PATH, outfontsize, encoding='utf-8')
|
||||
if len(dets) == 1:
|
||||
|
|
@ -363,5 +372,23 @@ def draw_name_crowd(dets, img, color, line_thickness=2, outfontsize=20):
|
|||
|
||||
cv2.polylines(img, [np.asarray(xy2xyxy(b), np.int32)], True, (0, 128, 255), 2)
|
||||
img[y0:y1, x0:x1, :] = label_arr
|
||||
=======
|
||||
def draw_name_crowd(dets, img, color, label, line_thickness=2, outfontsize=20):
|
||||
font = ImageFont.truetype(FONT_PATH, outfontsize, encoding='utf-8')
|
||||
H,W = img.shape[:2]
|
||||
# img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
||||
# img = Image.fromarray(img)
|
||||
# width, height = img.size
|
||||
Wrate = W // 128 * 128/W
|
||||
Hrate = H // 128 * 128/H
|
||||
|
||||
# img = cv2.cvtColor(np.array(img), cv2.COLOR_RGB2BGR)
|
||||
|
||||
for p in dets:
|
||||
img = cv2.circle(img, (int(p[0]/Wrate), int(p[1]/Hrate)), line_thickness, color, -1)
|
||||
Calc_label_arr = get_label_array(color, label, font, outfontsize)
|
||||
lh, lw = Calc_label_arr.shape[0:2]
|
||||
img[0:lh, 0:lw, :] = Calc_label_arr
|
||||
>>>>>>> origin/zsl
|
||||
|
||||
return img, dets
|
||||
Loading…
Reference in New Issue