|
|
|
|
|
|
|
|
par = json.load(fp)
|
|
|
par = json.load(fp)
|
|
|
parPost=par['post_process']
|
|
|
parPost=par['post_process']
|
|
|
return parPost
|
|
|
return parPost
|
|
|
def AI_process(im0s,model,segmodel,names,label_arraylist,rainbows,objectPar={ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.45,'allowedList':[0,1,2,3],'slopeIndex':[5,6,7],'segRegionCnt':1, 'trtFlag_det':False,'trtFlag_seg':False }, font={ 'line_thickness':None, 'fontSize':None,'boxLine_thickness':None,'waterLineColor':(0,255,255),'waterLineWidth':3} ,segPar={'modelSize':(640,360),'mean':(0.485, 0.456, 0.406),'std' :(0.229, 0.224, 0.225),'numpy':False, 'RGB_convert_first':True},mode='others',postPar=None):
|
|
|
|
|
|
|
|
|
def AI_process(im0s,model,segmodel,names,label_arraylist,rainbows,objectPar={ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.45,'allowedList':[0,1,2,3],'segRegionCnt':1, 'trtFlag_det':False,'trtFlag_seg':False }, font={ 'line_thickness':None, 'fontSize':None,'boxLine_thickness':None,'waterLineColor':(0,255,255),'waterLineWidth':3} ,segPar={'modelSize':(640,360),'mean':(0.485, 0.456, 0.406),'std' :(0.229, 0.224, 0.225),'numpy':False, 'RGB_convert_first':True},mode='others',postPar=None):
|
|
|
|
|
|
|
|
|
#输入参数
|
|
|
#输入参数
|
|
|
# im0s---原始图像列表
|
|
|
# im0s---原始图像列表
|
|
|
|
|
|
|
|
|
# Letterbox
|
|
|
# Letterbox
|
|
|
|
|
|
|
|
|
half,device,conf_thres,iou_thres,allowedList = objectPar['half'],objectPar['device'],objectPar['conf_thres'],objectPar['iou_thres'],objectPar['allowedList']
|
|
|
half,device,conf_thres,iou_thres,allowedList = objectPar['half'],objectPar['device'],objectPar['conf_thres'],objectPar['iou_thres'],objectPar['allowedList']
|
|
|
slopeIndex, trtFlag_det,trtFlag_seg,segRegionCnt = objectPar['slopeIndex'],objectPar['trtFlag_det'],objectPar['trtFlag_seg'],objectPar['segRegionCnt']
|
|
|
|
|
|
|
|
|
trtFlag_det,trtFlag_seg,segRegionCnt = objectPar['trtFlag_det'],objectPar['trtFlag_seg'],objectPar['segRegionCnt']
|
|
|
if 'ovlap_thres_crossCategory' in objectPar.keys():
|
|
|
if 'ovlap_thres_crossCategory' in objectPar.keys():
|
|
|
ovlap_thres = objectPar['ovlap_thres_crossCategory']
|
|
|
ovlap_thres = objectPar['ovlap_thres_crossCategory']
|
|
|
else:
|
|
|
else:
|
|
|
|
|
|
|
|
|
pred = model(img,augment=False)[0]
|
|
|
pred = model(img,augment=False)[0]
|
|
|
|
|
|
|
|
|
time2=time.time()
|
|
|
time2=time.time()
|
|
|
#datas = [[''], img, im0s, None,pred,seg_pred,10]
|
|
|
|
|
|
#ObjectPar={ 'object_config':allowedList, 'slopeIndex':slopeIndex ,'segmodel':segFlag,'segRegionCnt':segRegionCnt }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#p_result,timeOut = post_process_(datas,conf_thres, iou_thres,names,label_arraylist,rainbows,10,ObjectPar=ObjectPar,font=font,padInfos=padInfos,ovlap_thres=ovlap_thres)
|
|
|
#p_result,timeOut = post_process_(datas,conf_thres, iou_thres,names,label_arraylist,rainbows,10,ObjectPar=ObjectPar,font=font,padInfos=padInfos,ovlap_thres=ovlap_thres)
|
|
|
|
|
|
|