add road model
This commit is contained in:
parent
a67ee03dcf
commit
74261cf8b9
24
demo.py
24
demo.py
|
|
@ -73,13 +73,21 @@ def river_demo():
|
|||
cv2.imwrite( os.path.join( outpth,folders[i] ) ,image_array )
|
||||
print('----AIprocess:%s, %.1f, %s'%(folders[i], (time11 - time00) * 1000,timeOut))
|
||||
|
||||
def forest_demo():
|
||||
|
||||
def road_forest_demo(business ):
|
||||
|
||||
##使用森林,道路模型,business 控制['forest','road']
|
||||
##预先设置的参数
|
||||
device_='1' ##选定模型,可选 cpu,'0','1'
|
||||
|
||||
|
||||
|
||||
##以下参数目前不可改
|
||||
Detweights = "../AIlib/weights/forest/best.pt"
|
||||
labelnames = "../AIlib/weights/forest/labelnames.json"
|
||||
#business='forest';imageW=4916 ####森林模型
|
||||
#business='road';
|
||||
imageW=1536 ####道路模型
|
||||
Detweights = "../AIlib/weights/%s/best.pt"%(business)
|
||||
labelnames = "../AIlib/weights/%s/labelnames.json"%(business)
|
||||
postFile= '../AIlib/conf/para.json'
|
||||
|
||||
conf_thres,iou_thres,classes,rainbows=get_postProcess_para(postFile)
|
||||
|
|
@ -110,7 +118,7 @@ def forest_demo():
|
|||
##只加载检测模型,准备好显示字符
|
||||
device = select_device(device_)
|
||||
names=get_labelnames(labelnames)
|
||||
imageW=4915;###默认是1920,在森林巡检的高清图像中是4920
|
||||
#imageW=4915;###默认是1920,在森林巡检的高清图像中是4920
|
||||
outfontsize=int(imageW/1920*40);###
|
||||
label_arraylist = get_label_arrays(names,rainbows,outfontsize=outfontsize,fontpath="../AIlib/conf/platech.ttf")
|
||||
half = device.type != 'cpu' # half precision only supported on CUDA
|
||||
|
|
@ -122,7 +130,7 @@ def forest_demo():
|
|||
|
||||
##图像测试
|
||||
#url='images/examples/20220624_响水河_12300_1621.jpg'
|
||||
impth = 'images/forest/'
|
||||
impth = 'images/%s/'%(business)
|
||||
outpth = 'images/results/'
|
||||
folders = os.listdir(impth)
|
||||
for i in range(len(folders)):
|
||||
|
|
@ -139,10 +147,10 @@ def forest_demo():
|
|||
print('----image:%s, process:%s ,save:%s, %s'%(folders[i],(time11-time00) * 1000, (time.time() - time11) * 1000,timeOut) )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__=="__main__":
|
||||
river_demo()
|
||||
#forest_demo()
|
||||
#river_demo()
|
||||
road_forest_demo('road' )
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 538 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 550 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 578 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 696 KiB |
Loading…
Reference in New Issue