seg optimizer
This commit is contained in:
parent
25c95f1ac1
commit
953a0ca990
6
demo.py
6
demo.py
|
|
@ -12,7 +12,7 @@ import torch
|
|||
from utilsK.masterUtils import get_needed_objectsIndex
|
||||
def river_demo():
|
||||
##预先设置的参数
|
||||
device_='1' ##选定模型,可选 cpu,'0','1'
|
||||
device_='0' ##选定模型,可选 cpu,'0','1'
|
||||
|
||||
##以下参数目前不可改
|
||||
#Detweights = "../AIlib/weights/yolov5/class5/best_5classes.pt"
|
||||
|
|
@ -66,12 +66,13 @@ def river_demo():
|
|||
for i in range(len(folders)):
|
||||
imgpath = os.path.join(impth, folders[i])
|
||||
im0s=[cv2.imread(imgpath)]
|
||||
H,W,C = im0s[0].shape
|
||||
time00 = time.time()
|
||||
p_result,timeOut = AI_process(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 )
|
||||
print('----AIprocess:%s, %.1f, %s'%(folders[i], (time11 - time00) * 1000,timeOut))
|
||||
print('%s,%d*%d,AI-process: %.1f, %s'%(folders[i],H,W, (time11 - time00) * 1000,timeOut))
|
||||
|
||||
|
||||
def road_forest_demo(business ):
|
||||
|
|
@ -135,6 +136,7 @@ def road_forest_demo(business ):
|
|||
impth = 'images/%s/'%(business)
|
||||
outpth = 'images/results/'
|
||||
folders = os.listdir(impth)
|
||||
folders.sort()
|
||||
for i in range(len(folders)):
|
||||
#for i in range(2):
|
||||
imgpath = os.path.join(impth, folders[i])
|
||||
|
|
|
|||
Loading…
Reference in New Issue