Compare commits

...

2 Commits

Author SHA1 Message Date
thsw 81f88f5025 paraUdate 2022-08-09 17:25:35 +08:00
thsw 6d3d390cdd paraUdate 2022-08-09 17:24:57 +08:00
1 changed files with 23 additions and 2 deletions

25
demo.py
View File

@ -9,7 +9,8 @@ from utils.torch_utils import select_device
from utilsK.queRiver import get_labelnames,get_label_arrays
import numpy as np
import torch
from utilsK.masterUtils import get_needed_objectsIndex
def main():
##预先设置的参数
device_='1' ##选定模型,可选 cpu,'0','1'
@ -21,9 +22,29 @@ def main():
conf_thres,iou_thres,classes= 0.25,0.45,5
labelnames = "../AIlib/weights/yolov5/class5/labelnames.json"
rainbows = [ [0,0,255],[0,255,0],[255,0,0],[255,0,255],[255,255,0],[255,129,0],[255,0,127],[127,255,0],[0,255,127],[0,127,255],[127,0,255],[255,127,255],[255,255,127],[127,255,255],[0,255,255],[255,127,255],[127,255,255], [0,127,0],[0,0,127],[0,255,255]]
allowedList=[0,1,2,3]
####模型选择参数用如下:
mode_paras=[
{
"id":"0",
"config":{
"k1":"v1",
"k2":"v2"
}
},
{
"id":"1",
"config":{
"k1":"v1",
"k2":"v2"
}
}
]
allowedList,allowedList_string=get_needed_objectsIndex(mode_paras)
#allowedList=[0,1,2,3]
##加载模型,准备好显示字符
device = select_device(device_)
names=get_labelnames(labelnames)