digitSize

This commit is contained in:
thsw 2022-10-08 16:03:21 +08:00
parent 74261cf8b9
commit 69d04d8c8b
1 changed files with 7 additions and 5 deletions

12
demo.py
View File

@ -13,7 +13,7 @@ from utilsK.masterUtils import get_needed_objectsIndex
def river_demo():
##预先设置的参数
device_='1' ##选定模型,可选 cpu,'0','1'
##以下参数目前不可改
#Detweights = "../AIlib/weights/yolov5/class5/best_5classes.pt"
#labelnames = "../AIlib/weights/yolov5/class5/labelnames.json"
@ -86,10 +86,12 @@ def road_forest_demo(business ):
#business='forest';imageW=4916 ####森林模型
#business='road';
imageW=1536 ####道路模型
Detweights = "../AIlib/weights/%s/best.pt"%(business)
digitFont= { 'line_thickness':2, 'fontSize':1.0} ###数字显示的线宽度,大小; 如果都是None则采用默认大小
Detweights="../AIlib/weights/%s/best.pt"%(business)
labelnames = "../AIlib/weights/%s/labelnames.json"%(business)
postFile= '../AIlib/conf/para.json'
print( Detweights,labelnames )
conf_thres,iou_thres,classes,rainbows=get_postProcess_para(postFile)
####模型选择参数用如下:
@ -139,7 +141,7 @@ def road_forest_demo(business ):
im0s=[cv2.imread(imgpath)]
time00 = time.time()
#使用不同的函数。每一个领域采用一个函数
p_result,timeOut = AI_process_forest(im0s,model,segmodel,names,label_arraylist,rainbows,half,device,conf_thres, iou_thres,allowedList)
p_result,timeOut = AI_process_forest(im0s,model,segmodel,names,label_arraylist,rainbows,half,device,conf_thres, iou_thres,allowedList,font=digitFont)
time11 = time.time()
image_array = p_result[1]
cv2.imwrite( os.path.join( outpth,folders[i] ) ,image_array )
@ -152,5 +154,5 @@ def road_forest_demo(business ):
if __name__=="__main__":
#river_demo()
road_forest_demo('road' )
road_forest_demo('forest' )