elif postProcess['name']=='channel2': | elif postProcess['name']=='channel2': | ||||
ocrInfo='no ocr' | ocrInfo='no ocr' | ||||
if len(_detRets0_obj)>0: | if len(_detRets0_obj)>0: | ||||
print('##line246:',detRets1[0][0] ) | |||||
res_real = detRets1[0][0] | res_real = detRets1[0][0] | ||||
res_real="".join( list(filter(lambda x:(ord(x) >19968 and ord(x)<63865 ) or (ord(x) >47 and ord(x)<58 ),res_real))) | res_real="".join( list(filter(lambda x:(ord(x) >19968 and ord(x)<63865 ) or (ord(x) >47 and ord(x)<58 ),res_real))) | ||||
if __name__=="__main__": | if __name__=="__main__": | ||||
main() | |||||
main() |
logger = trt.Logger(trt.Logger.ERROR) | logger = trt.Logger(trt.Logger.ERROR) | ||||
with open(weights, "rb") as f, trt.Runtime(logger) as runtime: | with open(weights, "rb") as f, trt.Runtime(logger) as runtime: | ||||
self.model=runtime.deserialize_cuda_engine(f.read())# 输入trt本地文件,返回ICudaEngine对象 | self.model=runtime.deserialize_cuda_engine(f.read())# 输入trt本地文件,返回ICudaEngine对象 | ||||
#self.context = self.model.create_execution_context() | |||||
self.context = self.model.create_execution_context() | |||||
elif self.infer_type=='pth': | elif self.infer_type=='pth': | ||||
if par['mode']=='ch': | if par['mode']=='ch': | ||||
preds = self.model(image) | preds = self.model(image) | ||||
else: | else: | ||||
preds,trtstr=OcrTrtForward(self.model,[image],False) | preds,trtstr=OcrTrtForward(self.model,[image],False) | ||||
#preds,trtstr=OcrTrtForward(self.model,[image], self.context ) | |||||
t2 = time.time() | t2 = time.time() | ||||
preds_size = torch.IntTensor([preds.size(0)]*1) | preds_size = torch.IntTensor([preds.size(0)]*1) | ||||
print(res_real,os.path.basename(imgUrl),timeInfos ) | print(res_real,os.path.basename(imgUrl),timeInfos ) | ||||
2.调整crackMeasure模型中增加两个参数。 | 2.调整crackMeasure模型中增加两个参数。 | ||||
3.增加channel2业务,采用检测模型识别"国旗","浮标","船名","船只",并对"船名"调用ocr2。 | 3.增加channel2业务,采用检测模型识别"国旗","浮标","船名","船只",并对"船名"调用ocr2。 | ||||
除返回格式和过去一样,"船名"对应目标的list末尾加上了ocr结果(原始是[x0,y0,x1,y1,score,cls]--->[x0,y0,x1,y1,score,cls,ocr) | 除返回格式和过去一样,"船名"对应目标的list末尾加上了ocr结果(原始是[x0,y0,x1,y1,score,cls]--->[x0,y0,x1,y1,score,cls,ocr) | ||||
2024.1.26 | |||||
1.增加“riverT”业务,和“river2”所有参数都相同,出去yolov5.pt是定制的。 |
{ | |||||
"labelnames":[ "漂浮物","垃圾","排口","非法建筑","非法种植","水生植物","游泳人员","钓鱼人员","船只","蓝藻"] , | |||||
"labelIndexs":[ "SL04","SL05","SL06","SL07","SL08","SL09","SL10","SL11","SL12","SL13" ], | |||||
"labelOrders":[0,1,2,3,4,5,6,7,8,9] | |||||
} |
{ | |||||
"post_process":{ "name":"post_process","conf_thres":0.25,"iou_thres":0.3,"ovlap_thres_crossCategory":0.65,"classes":5,"rainbows":[ [0,0,255],[0,255,0],[255,0,0],[255,0,255],[255,255,0],[255,129,0],[255,0,127],[127,255,0],[0,255,127],[0,127,255],[127,0,255],[255,127,255],[255,255,127],[127,255,255],[0,255,255],[255,127,255],[127,255,255], [0,127,0],[0,0,127],[0,255,255]] } | |||||
} |