import sys
import libsunergy as sun
NAMES_PATH = ''
CFG_PATH = ''
MODEL_PATH = ''
m_flag, classify_hd = sun.init(NAMES_PATH, CFG_PATH, MODEL_PATH)
if ("SUCCESS" != m_flag):
logger.error("%s: Classification handle error!" % (m_flag))
sys.exit()
pass
netInfo = sun.getNetInfo(classify_hd)
sun.setDataType(classify_hd, 0) # opencv => cpu = 0, moon => gpu = 1
vflag, sunhd = sun.init(cfg['names'],
cfg['cfg'],
cfg['weights'])
if(vflag != 'SUCCESS'):
logger.error("handle error!")
return
netInfo = sun.getNetInfo(sunhd)
# 参数设定
if decoder == 'moon':
sun.setDataType(sunhd, 1) # gpu 1 cpu 0
else:
sun.setDataType(sunhd, 0)
sun.setThreshold(sunhd, cfg['threshold'])
sun.setNms(sunhd, cfg['nms'])