@@ -13,7 +13,7 @@ def message_feedback(requestId, status, type, error_code="", error_msg="", prog | |||
result_msg["original_url"] = original_url | |||
result_msg["sign_url"] = sign_url | |||
result_msg["model_type_code"] = model_type_code | |||
result_msg["model_detection_coden"] = model_detection_code | |||
result_msg["model_detection_code"] = model_detection_code | |||
result_msg["analyse_time"] = analyse_time | |||
results.append(result_msg) | |||
taskfb["results"] = results |
@@ -0,0 +1,16 @@ | |||
from enum import Enum, unique | |||
# 异常枚举 | |||
@unique | |||
class ModelType(Enum): | |||
WATER_SURFACE_MODEL = ("1", "001", "水面模型") | |||
FOREST_FARM_MODEL = ("2", "002", "林场模型") | |||
def checkCode(code): | |||
for model in ModelType: | |||
if model.value[1] == code: | |||
return True | |||
return False |
@@ -106,7 +106,7 @@ class Cv2Util(): | |||
ExceptionType.OR_VIDEO_ADDRESS_EXCEPTION.value[1]) | |||
self.or_video_file = cv2.VideoWriter(self.orFilePath, cv2.VideoWriter_fourcc(*'mp4v'), self.fps, (self.width, self.height)) | |||
self.ai_video_file = cv2.VideoWriter(self.aiFilePath, cv2.VideoWriter_fourcc(*'mp4v'), self.fps, (self.width, int(self.height/2))) | |||
self.ai_video_file = cv2.VideoWriter(self.aiFilePath, cv2.VideoWriter_fourcc(*'mp4v'), self.fps, (self.width * 2, self.height)) | |||
except ServiceException as s: | |||
raise s | |||
except Exception as e: | |||
@@ -114,8 +114,8 @@ class Cv2Util(): | |||
logger.exception(e) | |||
def video_merge(self, frame1, frame2): | |||
frameLeft = cv2.resize(frame1, (int(self.width / 2), int(self.height / 2)), interpolation=cv2.INTER_LINEAR) | |||
frameRight = cv2.resize(frame2, (int(self.width / 2), int(self.height / 2)), interpolation=cv2.INTER_LINEAR) | |||
frameLeft = cv2.resize(frame1, (int(self.width), int(self.height)), interpolation=cv2.INTER_LINEAR) | |||
frameRight = cv2.resize(frame2, (int(self.width), int(self.height)), interpolation=cv2.INTER_LINEAR) | |||
frame_merge = np.hstack((frameLeft, frameRight)) | |||
return frame_merge | |||
@@ -64,7 +64,7 @@ class LCModel(Model): | |||
self.device = select_device(self.device_) | |||
self.names = get_labelnames(labelnames) | |||
###默认是1920,在森林巡检的高清图像中是4920 | |||
imageW = 4915 | |||
imageW = 1920 | |||
outfontsize = int(imageW/1920*40) | |||
self.label_arraylist = get_label_arrays(self.names, self.rainbows, outfontsize=outfontsize, fontpath="../AIlib/conf/platech.ttf") | |||
self.half = self.device.type != 'cpu' # half precision only supported on CUDA |
@@ -6,8 +6,7 @@ from common import Constant | |||
# 从配置文件读取所有配置信息 | |||
def getConfigs(): | |||
print("开始读取配置文件,获取配置消息:", Constant.APPLICATION_CONFIG) | |||
applicationConfigPath = "../dsp_application.yml" | |||
print(applicationConfigPath) | |||
applicationConfigPath = os.path.abspath(Constant.APPLICATION_CONFIG) | |||
if not os.path.exists(applicationConfigPath): | |||
raise Exception("未找到配置文件:{}".format(Constant.APPLICATION_CONFIG)) | |||
with open(applicationConfigPath, Constant.R, encoding=Constant.UTF_8) as f: |