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

@ -30,7 +30,7 @@ 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'
self.model = yolov8_segment()
self.model.load_model(model_path, device)
@ -39,14 +39,14 @@ class Detection:
device = 'CPU'
self.model = yolov8_segment_openvino(model_path, device, conf_thres=0.3, iou_thres=0.3)
img_path = ''.join([os.getcwd(), '/Vision/model/data/test0911.png'])
point_path = ''.join([os.getcwd(), '/Vision/model/data/test0911.xyz'])
img_path = ''.join([os.getcwd(), '/Vision/model/data/2024_11_29_10_05_58.png'])
point_path = ''.join([os.getcwd(), '/Vision/model/data/2024_11_29_10_05_58.xyz'])
self.img = cv2.imread(img_path)
self.point = np.loadtxt(point_path).reshape((1080, 1440, 3))
self.point = np.loadtxt(point_path).reshape((self.img.shape[0], self.img.shape[1], 3))
pass
def get_position(self, Point_isVision=False, Box_isPoint=False, First_Depth =True, Iter_Max_Pixel = 30, save_img_point=0, seg_distance_threshold = 0.01, 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, seg_distance_threshold = 10, Height_reduce = 50, width_reduce = 50):
"""
检测料袋相关信息
:param Point_isVision: 点云可视化
@ -167,7 +167,7 @@ class Detection:
'''
rect = cv2.minAreaRect(max_contour)
if rect[1][0] - width_reduce < 30 or rect[1][1] - Height_reduce < 30:
if rect[1][0] - width_reduce > 30 and rect[1][1] - Height_reduce > 30:
rect_reduce = (
(rect[0][0], rect[0][1]), (rect[1][0] - width_reduce, rect[1][1] - Height_reduce), rect[2])
else: