digitSize
This commit is contained in:
parent
74261cf8b9
commit
69d04d8c8b
12
demo.py
12
demo.py
|
|
@ -13,7 +13,7 @@ from utilsK.masterUtils import get_needed_objectsIndex
|
||||||
def river_demo():
|
def river_demo():
|
||||||
##预先设置的参数
|
##预先设置的参数
|
||||||
device_='1' ##选定模型,可选 cpu,'0','1'
|
device_='1' ##选定模型,可选 cpu,'0','1'
|
||||||
|
|
||||||
##以下参数目前不可改
|
##以下参数目前不可改
|
||||||
#Detweights = "../AIlib/weights/yolov5/class5/best_5classes.pt"
|
#Detweights = "../AIlib/weights/yolov5/class5/best_5classes.pt"
|
||||||
#labelnames = "../AIlib/weights/yolov5/class5/labelnames.json"
|
#labelnames = "../AIlib/weights/yolov5/class5/labelnames.json"
|
||||||
|
|
@ -86,10 +86,12 @@ def road_forest_demo(business ):
|
||||||
#business='forest';imageW=4916 ####森林模型
|
#business='forest';imageW=4916 ####森林模型
|
||||||
#business='road';
|
#business='road';
|
||||||
imageW=1536 ####道路模型
|
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)
|
labelnames = "../AIlib/weights/%s/labelnames.json"%(business)
|
||||||
|
|
||||||
postFile= '../AIlib/conf/para.json'
|
postFile= '../AIlib/conf/para.json'
|
||||||
|
print( Detweights,labelnames )
|
||||||
conf_thres,iou_thres,classes,rainbows=get_postProcess_para(postFile)
|
conf_thres,iou_thres,classes,rainbows=get_postProcess_para(postFile)
|
||||||
|
|
||||||
####模型选择参数用如下:
|
####模型选择参数用如下:
|
||||||
|
|
@ -139,7 +141,7 @@ def road_forest_demo(business ):
|
||||||
im0s=[cv2.imread(imgpath)]
|
im0s=[cv2.imread(imgpath)]
|
||||||
time00 = time.time()
|
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()
|
time11 = time.time()
|
||||||
image_array = p_result[1]
|
image_array = p_result[1]
|
||||||
cv2.imwrite( os.path.join( outpth,folders[i] ) ,image_array )
|
cv2.imwrite( os.path.join( outpth,folders[i] ) ,image_array )
|
||||||
|
|
@ -152,5 +154,5 @@ def road_forest_demo(business ):
|
||||||
|
|
||||||
if __name__=="__main__":
|
if __name__=="__main__":
|
||||||
#river_demo()
|
#river_demo()
|
||||||
road_forest_demo('road' )
|
road_forest_demo('forest' )
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue