UPDATE Vision 更新模型

This commit is contained in:
HJW
2024-12-02 15:51:32 +08:00
parent 157e7edce5
commit e2821f7e48
9 changed files with 1228822 additions and 20 deletions

View File

@ -26,7 +26,7 @@ import os
class Detection:
def __init__(self, use_openvino_model=False, cameraType = 'RVC'): # cameraType = 'RVC' or cameraType = 'Pe'
def __init__(self, use_openvino_model=False, cameraType = 'Pe'): # cameraType = 'RVC' or cameraType = 'Pe'
"""
初始化相机及模型
:param use_openvino_model: 选择模型默认使用openvino
@ -36,14 +36,14 @@ class Detection:
self.use_openvino_model = use_openvino_model
self.cameraType = cameraType
if self.use_openvino_model == False:
model_path = ''.join([os.getcwd(), '/Vision/model/pt/best.pt'])
model_path = ''.join([os.getcwd(), '/Vision/model/pt/one_bag.pt'])
device = 'cpu'
if self.cameraType == 'RVC':
self.camera_rvc = camera_rvc()
self.seg_distance_threshold = 0.01 # 1厘米
self.seg_distance_threshold = 10 # 1厘米
elif self.cameraType == 'Pe':
self.camera_rvc = camera_pe()
self.seg_distance_threshold = 20 # 2厘米
self.seg_distance_threshold = 10 # 2厘米
else:
print('相机参数错误')
return
@ -54,7 +54,7 @@ class Detection:
device = 'CPU'
if self.cameraType == 'RVC':
self.camera_rvc = camera_rvc()
self.seg_distance_threshold = 0.01
self.seg_distance_threshold = 10
elif self.cameraType == 'Pe':
self.camera_rvc = camera_pe()
self.seg_distance_threshold = 20
@ -64,7 +64,7 @@ class Detection:
self.model = yolov8_segment_openvino(model_path, device, conf_thres=0.3, iou_thres=0.3)
def get_position(self, Point_isVision=False, Box_isPoint=True, First_Depth =True, Iter_Max_Pixel = 30, save_img_point=0, Height_reduce = 30, width_reduce = 30):
def get_position(self, Point_isVision=False, Box_isPoint=True, First_Depth =True, Iter_Max_Pixel = 30, save_img_point=0, Height_reduce = 50, width_reduce = 50):
"""
检测料袋相关信息
:param Point_isVision: 点云可视化
@ -75,7 +75,7 @@ class Detection:
:param Height_reduce: 检测框的高内缩像素
:param width_reduce: 检测框的宽内缩像素
:return ret: bool 相机是否正常工作
:return img: ndarry 返回img
:return img: ndarray 返回img
:return xyz: list 目标中心点云值形如[x,y,z]
:return nx_ny_nz: list 拟合平面法向量,形如[a,b,c]
:return box_list: list 内缩检测框四顶点,形如[[x1,y1],[],[],[]]