V0.1.0
王莹 2 years ago
parent a820ccc941
commit 1c13cce5a3

@ -0,0 +1,95 @@
from xml.etree.ElementTree import ElementTree, Element
# xml换行
def indent(elem, level=0):
i = "\n" + level*"\t"
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + "\t"
if not elem.tail or not elem.tail.strip():
elem.tail = i
for elem in elem:
indent(elem, level+1)
if not elem.tail or not elem.tail.strip():
elem.tail = i
else:
if level and (not elem.tail or not elem.tail.strip()):
elem.tail = i
def add_xml(inforsDict,xmlFilePath):
result = inforsDict
for re in result:
# if re['score'] > 0.5:
# 获得标注信息
ObjName = list(re.keys())[0]
xmin = int(list(re.values())[0][0])
ymin = int(list(re.values())[0][1])
xmax = int(list(re.values())[0][2])
ymax = int(list(re.values())[0][3])
# xmax = xmin + r
# ymax = ymin + z
#if ObjName == 'person':
tree = ElementTree()
tree.parse(xmlFilePath)
# 得到根目录
root = tree.getroot()
# 创建一级目录
elementOjb = Element('object')
elementBox = Element('bndbox')
# 创建二级目录
one = Element('name')
one.text = ObjName # 二级目录的值 #结果展示:<id>1</id>
elementOjb.append(one) # 将二级目录加到一级目录里
two = Element('pose')
two.text = "Unspecified"
elementOjb.append(two)
three = Element('truncated')
three.text = "0"
elementOjb.append(three)
four = Element('difficult')
four.text = "0"
elementOjb.append(four)
five = Element('xmin')
five.text = str(xmin)
elementBox.append(five)
six = Element('xmax')
six.text = str(xmax)
elementBox.append(six)
seven = Element('ymin')
seven.text = str(ymin)
elementBox.append(seven)
eight = Element('ymax')
eight.text = str(ymax)
elementBox.append(eight)
# 将一级目录加到根目录里
elementOjb.append(elementBox)
root.append(elementOjb)
# 换行缩进
indent(elementOjb)
indent(elementBox)
# 让结果保存进文件就可以了
tree.write(xmlFilePath, encoding='utf-8', xml_declaration=True)

@ -0,0 +1,30 @@
# load model file
model: /home/xbank/xbank_poc_test_use/model_file/yolov8.onnx
model_cache: /home/xbank/xbank_poc_test_use/tensort_cache/yolov8.trt
# label and bbox message set
model_parameter:
device : gpu
label_names: ["person","sleep"] # model labels
compara_label_names: ["person"] #
compara_relevancy: False # 'object_num'
relevancy_para : False
object_num_min : 5
confidence : 0.5
# save_path : /home/xbank/xbank_poc_test_use/save_path/sleep
# save_path_original : /home/yaxin/xbank/xbank_poc_test/save_path_original/sleep
# test_path : /home/yaxin/xbank/xbank_poc_test/test_save_path/sleep
save_path_original : False
test_path : False
save_annotations : False
save_path : False
# save videos
save_videos : /home/xbank/xbank_poc_test_use/video_save_path/person
# detect time set
detect_time : 60
detect_time_small : 5
detect_ratio : 0.9

@ -1,21 +1,36 @@
# load model file # load model file
model: ./model_file/yolov5.onnx model: /home/xbank/xbank_poc_test_use/model_file/yolov5.onnx
model_cache: ./tensort_cache/yolov5.trt model_cache: /home/xbank/xbank_poc_test_use/tensort_cache/yolov5.trt
# label and bbox message set # label and bbox message set
model_parameter: model_parameter:
device : gpu device : gpu
label_names: ["Keypad","hands","keyboard", "mouse","phone"] # model labels label_names: ["Keypad","hands","keyboard", "mouse","phone"] # model labels
compara_label_names: ["hands","phone"] # compara_label_names: ["hands","phone"] #
compara_relevancy: 'overlap' # 'in_bbox' compara_relevancy: overlap # 'in_bbox','overlap'
relevancy_para : 0 relevancy_para : 0
object_num_min : False
confidence : 0.2 confidence : 0.2
save_path : ./save_path/hands # temporarily save images
# save_path : E:/Bank_files/Bank_03/xbank_poc_test_use/save_path/hands/det
# save_path_original : /home/yaxin/xbank/xbank_poc_test/save_path_original/hands # save_path_original : /home/yaxin/xbank/xbank_poc_test/save_path_original/hands
# test_path : /home/yaxin/xbank/xbank_poc_test/test_save_path/hands # test_path : E:/Bank_files/Bank_03/xbank_poc_test_use/save_path/hands/nodet
save_path_original : False save_path : False
test_path : False test_path : False
save_path_original : False
save_annotations : False
# save detect infors
save_annotations : False
# save videos
save_videos : /home/xbank/xbank_poc_test_use/video_save_path/hands
# detect time set
detect_time : 60
detect_time_small : 5
detect_ratio : 0.5

@ -1,20 +1,31 @@
# load model file # load model file
model: ./model_file/yolov8.onnx model: /home/xbank/xbank_poc_test_use/model_file/yolov8.onnx
model_cache: ./tensort_cache/yolov8.trt model_cache: /home/xbank/xbank_poc_test_use/tensort_cache/yolov8.trt
# label and bbox message set # label and bbox message set
model_parameter: model_parameter:
device : gpu device : gpu
label_names: ["person","sleep"] # model labels label_names: ["person","sleep"] # model labels
compara_label_names: ["person","sleep"] # compara_label_names: ["sleep"] #
compara_relevancy: False # 'in_bbox' compara_relevancy: False # 'in_bbox'
relevancy_para : False relevancy_para : False
confidence : 0.2 object_num_min : False
confidence : 0.5
save_path : ./save_path/sleep # save_path : /home/xbank/xbank_poc_test_use/save_path/sleep
# save_path_original : /home/yaxin/xbank/xbank_poc_test/save_path_original/sleep # save_path_original : /home/yaxin/xbank/xbank_poc_test/save_path_original/sleep
# test_path : /home/yaxin/xbank/xbank_poc_test/test_save_path/sleep # test_path : /home/yaxin/xbank/xbank_poc_test/test_save_path/sleep
save_path_original : False save_path_original : False
test_path : False test_path : False
save_annotations : False
save_path : False
# save videos
save_videos : /home/xbank/xbank_poc_test_use/video_save_path/sleep
# detect time set
detect_time : 60
detect_time_small : 5
detect_ratio : 0.5

@ -0,0 +1,53 @@
from lxml.etree import Element, SubElement, tostring
def create_xml(boxs, img_shape, xml_path):
"""
创建xml文件依次写入xml文件必备关键字
:param boxs: txt文件中的box
:param img_shape: 图片信息xml中需要写入WHC
:return:
"""
node_root = Element('annotation')
node_folder = SubElement(node_root, 'folder')
node_folder.text = 'Images'
node_filename = SubElement(node_root, 'filename')
node_filename.text = str(img_shape[3])
node_size = SubElement(node_root, 'size')
node_width = SubElement(node_size, 'width')
node_width.text = str(img_shape[1])
node_height = SubElement(node_size, 'height')
node_height.text = str(img_shape[0])
node_depth = SubElement(node_size, 'depth')
node_depth.text = str(img_shape[2])
if len(boxs) >= 1: # 循环写入box
for box in boxs:
node_object = SubElement(node_root, 'object')
node_name = SubElement(node_object, 'name')
# if str(list_[4]) == "person": # 根据条件筛选需要标注的标签,例如这里只标记person这类不符合则直接跳过
# node_name.text = str(list_[4])
# else:
# continue
node_name.text = str(list(box.keys())[0])
node_difficult = SubElement(node_object, 'difficult')
node_difficult.text = '0'
node_bndbox = SubElement(node_object, 'bndbox')
node_xmin = SubElement(node_bndbox, 'xmin')
node_xmin.text = str(int(list(box.values())[0][0]))
node_ymin = SubElement(node_bndbox, 'ymin')
node_ymin.text = str(int(list(box.values())[0][1]))
node_xmax = SubElement(node_bndbox, 'xmax')
node_xmax.text = str(int(list(box.values())[0][2]))
node_ymax = SubElement(node_bndbox, 'ymax')
node_ymax.text = str(int(list(box.values())[0][3]))
xml = tostring(node_root, pretty_print=True) # 格式化显示,该换行的换行
# file_name = img_shape[3].split(".")[0]
# filename = xml_path+"/{}.xml".format(file_name)
f = open(xml_path, "wb")
f.write(xml)
f.close()

@ -1,128 +1,256 @@
from analysis_result.get_model_result import det_img from analysis_result.get_model_result import det_img
from analysis_result.same_model_img import same_model_img_analysis_labels, model_labels_selet from analysis_result.same_model_img import same_model_img_analysis_labels, model_labels_selet
from model_load.model_load import load_model from model_load.model_load import Load_model
from drawing_img.drawing_img import drawing_frame from drawing_img.drawing_img import drawing_frame
from analysis_data.data_dir_file import get_dir_file from analysis_data.data_rtsp import rtsp_para
from analysis_data.data_dir_file import get_dir_file, get_imgframe
from analysis_data.config_load import get_configs from analysis_data.config_load import get_configs
from utils import is_image_file, is_rtsp_or_video from add_xml import add_xml
from create_xml import create_xml
import yaml
import cv2 import cv2
import os import os
from pathlib import Path
import time import time
from datetime import datetime from datetime import datetime
import glob
import json
def data_load(args): def data_load(args):
# print('正在运行的进程',msg)
# print(args)
source = args[0] source = args[0]
model_yaml = args[1] model_ymal = args[1]
# 数据加载 # 数据加载
rtsp_or_video_source = is_rtsp_or_video(source) rtsp_source = rtsp_para(source)
dir_source = os.path.isdir(source) dir_source = os.path.isdir(source)
img_source = is_image_file(source) file_source = os.path.isfile(source)
# # 模型加载 # # 模型加载
model_data = get_configs(model_yaml) model_data = get_configs(model_ymal)
model_inference = load_model(model_file=model_data["model"], model_inference = Load_model(model_file=model_data["model"],
device=model_data["model_parameter"]['device'], device=model_data["model_parameter"]['device'],
cache_file=model_data["model_cache"]) cache_file=model_data["model_cache"])
if rtsp_or_video_source: if rtsp_source:
start_point = time.perf_counter()
cap = cv2.VideoCapture(source) rtsp_detect_process(source=source, model_data=model_data,
model_inference=model_inference)
try: if dir_source:
i = 0 dir_source_process(source, model_inference, model_data)
while True:
ret, frame = cap.read()
if not ret: if file_source:
# 流媒体不稳定,
# 如果未成功读取到视频帧,则继续读取下一帧
if source.startswith('rtsp'):
continue
else:
break
print(source,datetime.today(), i) file_source_process(source, model_inference, model_data)
# if source == 'rtsp://admin:@192.168.10.18':
# cv2.imshow('18',frame)
img_frame_dict = {"path": source, 'frame': frame} def rtsp_detect_process(source, model_data, model_inference):
images_update = img_process(
img_frame_dict, model_inference, model_data)
# print(type(images_update['frame']))
# if source == 'rtsp://admin:@192.168.10.18': cap = cv2.VideoCapture(source)
# cv2.namedWindow('18',0)
# cv2.imshow('18',images_update['frame'])
i = i+1 # 视频流信息
fps = int(cap.get(cv2.CAP_PROP_FPS))
fps_num = fps*model_data['detect_time']
fps_num_small = fps*model_data['detect_time_small']
size = (int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)),
int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
try:
i = 0
j = 0
except Exception as e: det_t_num = 0
# 处理异常或错误 nodet_t_num = 0
print(str(e))
cap.release() det_img = []
end_point = time.perf_counter() video_name_time = 0
print(f"视频处理时间: {(end_point - start_point)}s") det_fps_time = []
exit(0) while True:
ret, frame = cap.read()
if dir_source: t1 = time.time()
if not ret:
continue # 如果未成功读取到视频帧,则继续读取下一帧
i = i + 1
j = j + 1
# 读取到当前视频帧时间
data_now = datetime.now()
get_time = str(data_now.strftime("%H")) + \
str(data_now.strftime("%M")) + str(data_now.strftime("%S")) + \
str(data_now.strftime("%f"))
# 视频保存
if video_name_time == 0:
video_name_time = get_time
savePath = os.path.join(model_data['save_videos'], (str(data_now.strftime(
"%Y")) + str(data_now.strftime("%m")) + str(data_now.strftime("%d"))))
if not os.path.exists(savePath):
os.makedirs(savePath)
video_path = os.path.join(
savePath, video_name_time + '.avi')
print('video_path:', video_path)
out_video = cv2.VideoWriter(
video_path, cv2.VideoWriter_fourcc(*'DIVX'), fps, size)
print(source, data_now, i, j,video_path)
# 推理部分
imgframe_dict = {"path": source, 'frame': frame, 'get_fps': j}
images_det_result = img_process(
imgframe_dict, model_inference, model_data)
images_update = save_process(
imgframe_dict, images_det_result, model_data)
# print('images_det_result:', len(images_det_result))
# 结果判断t
if images_det_result:
det_t_num = det_t_num + 1
if len(det_img) == 0:
img_dict = images_update.copy()
del img_dict['frame']
det_img.append(img_dict)
if not images_det_result and len(det_img) > 0:
nodet_t_num = nodet_t_num + 1
if (det_t_num + nodet_t_num) >= fps_num_small:
para = determine_time(
det_num=det_t_num, nodet_num=nodet_t_num, ratio_set=model_data['detect_ratio'])
if para:
first_fps_time = det_img[0]
first_fps_time.update(
{"dert_fps": (j-int(first_fps_time['get_fps'])+1)})
det_fps_time.append(first_fps_time)
det_img.clear()
det_t_num = 0
nodet_t_num = 0
img_ext = [".jpg", ".JPG", ".bmp"] # 视频保存
video_ext = [".mp4", ".avi", ".MP4"] out_video.write(images_update['frame'])
img_list = get_dir_file(source, img_ext) # 结果判断 T
video_list = get_dir_file(source, video_ext) if j >= fps_num:
if img_list: out_video.release()
for img in img_list: # T时间截至判断t时间结果。
if det_img:
para = determine_time(
det_num=det_t_num, nodet_num=nodet_t_num, ratio_set=model_data['detect_ratio'])
t1 = time.time() first_fps_time = det_img[0]
images = cv2.imread(img)
# print(j-int(first_fps_time['get_fps'])+1)
img_frame_dict = {"path": img, 'frame': images} # print(fps_num_small/2)
if (j-int(first_fps_time['get_fps'])+1) >= (fps_num_small/2):
first_fps_time.update(
{"dert_fps": (j-int(first_fps_time['get_fps'])+1)})
det_fps_time.append(first_fps_time)
# print('det_fps_time:', det_fps_time)
if det_fps_time:
re_list = json_get(
time_list=det_fps_time, video_path=video_path,fps=fps)
json_save(re_list)
else:
print(video_path)
os.remove(video_path)
print('----------------------------------------------clear videos-----------------------------------------------')
# 重置
print('----------------------------------------------next-----------------------------------------------')
det_img.clear()
det_fps_time.clear()
det_t_num = 0
nodet_t_num = 0
video_name_time = 0
j = 0
# print('det_fps_time:', det_fps_time,'det_img:',det_img)
t2 = time.time()
tx = t2 - t1
print('检测一张图片的时间为:', tx)
except Exception as e:
# 处理异常或错误
print(str(e))
cap.release()
images_update = img_process(
img_frame_dict, model_inference, model_data)
t2 = time.time() def dir_source_process(source, model_inference, model_data):
tx = t2 - t1
print('检测一张图片的时间为:',tx)
img_ext = [".jpg", ".JPG", ".bmp"]
video_ext = [".mp4", ".avi", ".MP4"]
if video_list: img_list = get_dir_file(source, img_ext)
video_list = get_dir_file(source, video_ext)
pass if img_list:
if img_source: for img in img_list:
img_para = True t1 = time.time()
images = cv2.imread(img)
if img_para: imgframe_dict = {"path": img, 'frame': images}
images = cv2.imread(source)
img_frame_dict = {"path": source, 'frame': images}
images_update = img_process( images_update = img_process(
img_frame_dict, model_inference, model_data) imgframe_dict, model_inference, model_data)
t2 = time.time()
tx = t2 - t1
print('检测一张图片的时间为:', tx)
def img_process(images, model_inference, model_data): if video_list:
pass
def file_source_process(source, model_inference, model_data):
img_para = True
if img_para:
images = cv2.imread(source)
imgframe_dict = {"path": source, 'frame': images}
images_update = img_process(
imgframe_dict, model_inference, model_data)
start_point = time.perf_counter()
def img_process(images, model_inference, model_data):
# t1 = time.time()
# 检测每帧图片,返回推理结果 # 检测每帧图片,返回推理结果
results = det_img(model_inference=model_inference, results = det_img(model_inference=model_inference,
images_frame=images['frame'], images_frame=images['frame'],
@ -146,36 +274,56 @@ def img_process(images, model_inference, model_data):
determine_bbox = select_labels_list determine_bbox = select_labels_list
# 判断后的信息返回结果,这里是画图,可返回结果 # print(determine_bbox)
if model_data['model_parameter']['object_num_min']:
if len(determine_bbox) >= model_data["model_parameter"]['object_num_min']:
# print(len(determine_bbox))
determine_bbox.clear()
# 返回检测后结果
return determine_bbox
def save_process(images, determine_bbox, model_data):
if determine_bbox: if determine_bbox:
images.update({"results": determine_bbox}) images.update({"results": determine_bbox})
img_save = drawing_frame( img_save = drawing_frame(
images_frame=images['frame'], result_list=determine_bbox) images_frame=images['frame'], result_list=determine_bbox)
images.update({"frame": img_save}) images.update({"frame": img_save})
img_name = images_save( if model_data["save_path"]:
images=images['frame'], save_path=model_data["save_path"])
print('sleep:', images['path'], img_name) imgname = images_save(
images=images, save_path=model_data["save_path"])
if model_data['save_path_original']: if model_data['save_path_original']:
images_save(images=images['frame'], imgname_original = images_save(images=images,
save_path=model_data["save_path_original"]) save_path=model_data["save_path_original"])
else:
pass if model_data["save_annotations"]:
if not os.path.exists(model_data["save_annotations"]):
os.makedirs(model_data["save_annotations"])
save_annotations_xml(
xml_save_file=model_data["save_annotations"], save_infors=determine_bbox, images=images['path'])
else:
pass
else: else:
# 没检测出来的图片是否保存 # 没检测出来的图片是否保存
if model_data["test_path"]: if model_data["test_path"]:
img_name = images_save( imgname = images_save(
images=images['frame'], save_path=model_data["test_path"]) images=images, save_path=model_data["test_path"])
# print('no:',images['path'],img_name) # print('no:',images['path'],imgname)
else:
pass
# 展示显示 # 展示显示
# if images['path'] == 'rtsp://admin:@192.168.10.11': # if images['path'] == 'rtsp://admin:@192.168.10.11':
# cv2.namedWindow('11', cv2.WINDOW_NORMAL) # cv2.namedWindow('11', cv2.WINDOW_NORMAL)
@ -185,29 +333,120 @@ def img_process(images, model_inference, model_data):
# t2 = time.time() # t2 = time.time()
end_point = time.perf_counter()
cost = end_point - start_point
print(f"Predicted in {cost * 1000:.2f}ms. {1.0 / cost:.2f} FPS")
return images return images
def images_save(images, save_path): def images_save(images, save_path):
# 保存时候时间为图片名 # 保存时候时间为图片名
data_now = datetime.today() # data_now = datetime.now()
images_name = str(data_now.year) + str(data_now.month) + str(data_now.day) + str(data_now.hour) + \ # images_name = str(data_now.strftime("%Y")) + str(data_now.strftime("%m")) + str(data_now.strftime("%d")) + str(data_now.strftime("%H")) + \
str(data_now.minute) + str(data_now.second) + \ # str(data_now.strftime("%M")) + str(data_now.strftime("%S")) + \
str(data_now.microsecond) + '.jpg' # str(data_now.strftime("%f")) + '.jpg'
img_save_path = save_path + '/' + str( # img_save_path = save_path + '/' + str(
data_now.year) + '/' + str(data_now.month) + '_' + str(data_now.day) + '/' # data_now.year) + '/' + str(data_now.month) + '_' + str(data_now.day) + '/'
img_save_path = os.path.join(save_path, str(images['path'].split('.')[-1]))
images_name = images['get_time'] + '.jpg'
if not os.path.exists(img_save_path): if not os.path.exists(img_save_path):
os.makedirs(img_save_path) os.makedirs(img_save_path)
full_name = img_save_path + images_name full_name = os.path.join(img_save_path, images_name)
cv2.imwrite(full_name, images) cv2.imwrite(full_name, images['frame'])
return full_name return full_name
def save_annotations_xml(xml_save_file, save_infors, images):
results = save_infors
img = os.path.basename(images)
img_frame = cv2.imread(images)
xml_save_path = os.path.join(xml_save_file, img.split('.')[0] + '.xml')
w, h, d = img_frame.shape
img_shape = (w, h, d, img)
if os.path.isfile(xml_save_path):
add_xml(inforsDict=results,
xmlFilePath=xml_save_path)
else:
create_xml(boxs=results,
img_shape=img_shape,
xml_path=xml_save_path)
def determine_time(det_num, nodet_num, ratio_set):
ratio = det_num / (det_num + nodet_num)
# print(det_num, nodet_num, ratio)
if ratio >= ratio_set:
return True
else:
return False
def video_synthesis(imglist, savePath, size, fps, videoname):
if not os.path.exists(savePath):
os.makedirs(savePath)
print(videoname)
video_path = os.path.join(savePath, videoname + '.avi')
out = cv2.VideoWriter(
video_path, cv2.VideoWriter_fourcc(*'DIVX'), fps, size)
sorted_list = sorted(imglist, key=lambda x: x['get_time'])
for filename in sorted_list:
out.write(filename['frame'])
out.release()
def json_get(time_list, video_path,fps):
result_dict ={'info': {'video_path': video_path,'fps':fps}}
re_dict = {}
for i, det_dict in enumerate(time_list):
list_hands = ["Keypad", "hands", "keyboard", "mouse", "phone"]
list_sleep = ["person", "sleep"]
if list(det_dict['results'][0].keys())[0] in list_hands:
result_lables = 'playing_phone'
if list(det_dict['results'][0].keys())[0] in list_sleep:
result_lables = "sleep"
fps_dict = {'time': det_dict['get_fps'],
'duration': det_dict['dert_fps'], 'result': result_lables}
re_dict.update({('id_' + str(i)): fps_dict})
result_dict.update({'result':re_dict})
return result_dict
def json_save(result_dict):
json_path = result_dict['info`']['video_path'].split('.')[0] + '.json'
result = json.dumps(result_dict)
f = open(json_path, 'w')
f.write(result + '\n')
f.close
# if __name__ == '__main__':
# data_load(['rtsp://admin:@192.168.10.203',
# 'E:/Bank_files/Bank_03/xbank_poc_test_use/config_phone.yaml'])

@ -19,7 +19,7 @@ def build_option(device, backend, cache_file):
return option return option
def load_model(model_file, device, cache_file): def Load_model(model_file, device, cache_file):
""" """
加载模型的tensorRT引擎 加载模型的tensorRT引擎
model_file模型权重 格式".onnx" model_file模型权重 格式".onnx"

@ -6,22 +6,56 @@
model: /home/yaxin/xbank/xbank_poc_test/config_phone.yaml # 配置检测的模型配置文件 model: /home/yaxin/xbank/xbank_poc_test/config_phone.yaml # 配置检测的模型配置文件
4、模型配置文件config_检测名称.yaml 4、模型配置文件config_检测名称.yaml
# load model file # load model file
model: /home/yaxin/xbank/xbank_poc_test/model_file/yolov5.onnx # 模型的绝对路径
model_cache: /home/yaxin/xbank/xbank_poc_test/tensort_cache/yolov5.trt # 设置cache不用更改 # 模型的绝对路径
model: /home/yaxin/xbank/xbank_poc_test/model_file/yolov5_XXX.onnx
# label and bbox message set # 设置cache不用更改
model_parameter: # 模型检测中需要的参数 model_cache: /home/yaxin/xbank/xbank_poc_test/tensort_cache/yolov5_XXX.trt
device : gpu # 使用gpu检测
label_names: ["Keypad","hands","keyboard", "mouse","phone"] # model labels # 检测模型训练时的标签名列表,标签名顺序需要跟训练时候分配数据集时候的顺序一致,不用更改 # label and bbox message set
compara_label_names: ["hands","phone"] # # 检测到的类别中需要挑选出来的目标
compara_relevancy: 'overlap' # 'in_bbox' # 是否对挑选出来进行推理的目标进行其标签框之间关系进行推理如果不需要就设置成FALSE默认不用更改 # 模型检测中需要的参数
relevancy_para : 0 # 需要的参数 model_parameter:
confidence : 0.2 # 设置检测出来的目标过滤的置信度
# 使用gpu检测
save_path : /home/yaxin/xbank/xbank_poc_test/save_path/hands # 保存检测后的图片的路径,默认不需要更改 device : gpu
# save_path_original : /home/yaxin/xbank/xbank_poc_test/save_path_original/hands # 检测到的图片的原始图片的路径不保存使用False # 检测模型训练时的标签名列表,标签名顺序需要跟训练时候分配数据集时候的顺序一致,不用更改
# test_path : /home/yaxin/xbank/xbank_poc_test/test_save_path/hands # 未检测到目标的图片不保存设置为False默认保存 label_names: ["Keypad","hands","keyboard", "mouse","phone"] # model labels
# 检测到的类别中需要挑选出来的目标
compara_label_names: ["hands","phone"]
# 是否对挑选出来进行推理的目标进行其标签框之间关系进行推理如果不需要就设置成FALSE默认不用更改
compara_relevancy: 'overlap' # 'in_bbox'
# 需要的参数
relevancy_para : 0
# 设置检测出来的目标过滤的置信度
confidence : 0.2
# 统计检测到的目标最低数量不需要统计则设置为False
object_num_min : 5
# 保存检测后的图片的路径不保存使用False
save_path : /home/yaxin/xbank/xbank_poc_test/save_path/hands
# 检测到的图片的原始图片的路径不保存使用False
save_path_original : /home/yaxin/xbank/xbank_poc_test/save_path_original/hands
# 未检测到目标的图片不保存设置为False默认保存
test_path : /home/yaxin/xbank/xbank_poc_test/test_save_path/hands
# 检测到的目标的图片是否保存检测信息为xml标注信息不保存设置为False
save_annotations : False
# 保存检测到目标的视频片段
# save videos
# 视频保存路径,
save_videos : /home/xbank/xbank_poc_test_use/video_save_path/person
# 检测中时长的判断
# detect time set
# 保存的长视频的时长单位为s
detect_time : 60
# 判断是否为目标行为的时长单位为S
detect_time_small : 5
# 在单位时长中,判定为目标行为的目标信息在总检测信息中的比例
detect_ratio : 0.9
5、使用本地环境 5、使用本地环境
conda activate fastdeploy conda activate fastdeploy

Loading…
Cancel
Save