Compare commits
2 Commits
8d3d6cba99
...
81f88f5025
| Author | SHA1 | Date |
|---|---|---|
|
|
81f88f5025 | |
|
|
6d3d390cdd |
25
demo.py
25
demo.py
|
|
@ -9,7 +9,8 @@ from utils.torch_utils import select_device
|
||||||
from utilsK.queRiver import get_labelnames,get_label_arrays
|
from utilsK.queRiver import get_labelnames,get_label_arrays
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
from utilsK.masterUtils import get_needed_objectsIndex
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
##预先设置的参数
|
##预先设置的参数
|
||||||
device_='1' ##选定模型,可选 cpu,'0','1'
|
device_='1' ##选定模型,可选 cpu,'0','1'
|
||||||
|
|
@ -21,9 +22,29 @@ def main():
|
||||||
conf_thres,iou_thres,classes= 0.25,0.45,5
|
conf_thres,iou_thres,classes= 0.25,0.45,5
|
||||||
labelnames = "../AIlib/weights/yolov5/class5/labelnames.json"
|
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]]
|
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_)
|
device = select_device(device_)
|
||||||
names=get_labelnames(labelnames)
|
names=get_labelnames(labelnames)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue