UPDATE Vision 更新openvino模型

This commit is contained in:
HJW
2024-12-02 17:20:40 +08:00
parent e2821f7e48
commit dc640f461d
8 changed files with 172 additions and 140 deletions

View File

@ -50,7 +50,7 @@ class Detection:
self.model = yolov8_segment()
self.model.load_model(model_path, device)
else:
model_path = ''.join([os.getcwd(), '/Vision/model/openvino/best.xml'])
model_path = ''.join([os.getcwd(), '/Vision/model/openvino/one_bag.xml'])
device = 'CPU'
if self.cameraType == 'RVC':
self.camera_rvc = camera_rvc()

View File

@ -35,9 +35,9 @@ class Detection:
self.model = yolov8_segment()
self.model.load_model(model_path, device)
else:
model_path = ''.join([os.getcwd(), '/Vision/model/openvino/best.xml'])
model_path = ''.join([os.getcwd(), '/Vision/model/openvino/one_bag.xml'])
device = 'CPU'
self.model = yolov8_segment_openvino(model_path, device, conf_thres=0.3, iou_thres=0.3)
self.model = yolov8_segment_openvino(model_path, device, conf_thres=0.6, iou_thres=0.6)
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'])

View File

@ -49,6 +49,7 @@ class DetectionPerson:
if ret:
# img_src = cv2.imread(img_path)
img = self.precess_image(img_src, self.imgsz, self.half, self.cuda)
img = img[250:1000, 380:2000]
preds = self.model(img)
det = ops.non_max_suppression(preds, self.conf, self.iou, classes=None, agnostic=False, max_det=300,
nc=len(self.names))

30
Vision/find_img_point.py Normal file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
# @Time : 2024/12/2 15:55
# @Author : hjw
# @File : find_img_point.py
'''
import cv2
import numpy as np
img = cv2.imread('./model/data/0925_01_28.png')
img2 = img[:600, 380:]
cv2.imshow('img2',img2)
cv2.imshow('img',img)
cv2.waitKey(0)
def on_EVENT_LBUTTONDOWN(event, x, y, flags, param):
if event == cv2.EVENT_LBUTTONDOWN:
xy = "%d,%d" % (x, y)
cv2.circle(img, (x, y), 1, (255, 0, 0), thickness = -1)
cv2.putText(img, xy, (x, y), cv2.FONT_HERSHEY_PLAIN,
1.0, (0,0,0), thickness = 1)
cv2.imshow("image", img)
cv2.namedWindow("image")
cv2.setMouseCallback("image", on_EVENT_LBUTTONDOWN)
while(1):
cv2.imshow("image", img)
if cv2.waitKey(0)&0xFF==27:
break
cv2.destroyAllWindows()

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

View File

@ -1,6 +1,6 @@
description: Ultralytics YOLOv8n-seg model trained on D:\work\ultralytics-main\ultralytics\cfg\datasets\coco8-seg-dy.yaml
author: Ultralytics
date: '2024-09-10T13:48:59.901222'
date: '2024-12-02T17:16:53.470305'
version: 8.2.86
license: AGPL-3.0 License (https://ultralytics.com/license)
docs: https://docs.ultralytics.com
@ -11,4 +11,5 @@ imgsz:
- 640
- 640
names:
0: box
0: zheng
1: fan