Compare commits
No commits in common. "c3b3bb6ded9be61d4abde4540bc4c35a279e7f07" and "4fa94a647dcb69e40749156b26710c192c274d72" have entirely different histories.
c3b3bb6ded
...
4fa94a647d
4 changed files with 7 additions and 22 deletions
|
@ -16,22 +16,18 @@ classNames = ["person", "bicycle", "car", "motorbike", "aeroplane", "bus", "trai
|
|||
"teddy bear", "hair drier", "toothbrush"
|
||||
]
|
||||
|
||||
model = YOLO('yolov8m.pt') # Load an official Detect model
|
||||
model = YOLO('yolov8s.pt') # Load an official Detect model
|
||||
|
||||
async def handle_connection(websocket, path):
|
||||
print(f"Connection from: {path}")
|
||||
try:
|
||||
while True:
|
||||
raw_data = await websocket.recv()
|
||||
print(f"downloaded bytes: {len(raw_data)}")
|
||||
|
||||
# nparr = np.frombuffer(decoded_bytes, np.uint8).reshape((480, 640, 3))
|
||||
nparr = np.frombuffer(raw_data, dtype=np.uint8)
|
||||
nparr = np.frombuffer(raw_data, np.uint8).reshape((480, 640, 3))
|
||||
|
||||
frame = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
|
||||
|
||||
# frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
|
||||
cv2.imshow("from_remote", frame)
|
||||
# frame = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
|
||||
frame = cv2.cvtColor(nparr, cv2.COLOR_BGR2RGB)
|
||||
|
||||
# Perform object detection
|
||||
results = model.track(frame, persist=True)
|
||||
|
@ -77,8 +73,6 @@ async def handle_connection(websocket, path):
|
|||
|
||||
ret = lines.encode('utf-8')
|
||||
|
||||
cv2.waitKey(1)
|
||||
|
||||
await websocket.send(ret)
|
||||
|
||||
except websockets.exceptions.ConnectionClosed:
|
||||
|
|
|
@ -5,13 +5,12 @@ import cv2
|
|||
import math
|
||||
|
||||
# model
|
||||
# model = YOLO("yolov8x.pt")
|
||||
model = YOLO('yolov8n_full_integer_quant_edgetpu.tflite', task="detect") # Load an official Detect model
|
||||
model = YOLO("yolov8x.pt")
|
||||
|
||||
# start webcam
|
||||
cap = cv2.VideoCapture(0)
|
||||
cap.set(3, 640)
|
||||
cap.set(4, 640)
|
||||
cap.set(4, 480)
|
||||
|
||||
# object classes
|
||||
classNames = ["person", "bicycle", "car", "motorbike", "aeroplane", "bus", "train", "truck", "boat",
|
||||
|
@ -29,8 +28,6 @@ classNames = ["person", "bicycle", "car", "motorbike", "aeroplane", "bus", "trai
|
|||
|
||||
while True:
|
||||
success, img = cap.read()
|
||||
# img = cv2.resize(img, (512, 512), cv2.INTER_AREA)
|
||||
print(f"Image dimensions: {img.shape}")
|
||||
results = model.track(img, persist=True, stream=True)
|
||||
|
||||
# coordinates
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
from ultralytics import YOLO
|
||||
|
||||
model = YOLO("yolov8n.pt")
|
||||
|
||||
# model.export(format="onnx", simplify=True, int8=True)
|
||||
model.export(format="engine")
|
|
@ -1 +1 @@
|
|||
Subproject commit 0a47c7a9583148c101652e3772cf5ecad95d3092
|
||||
Subproject commit 66acd4698fcc997099ebc1ddc6f8e5ddd0e3579c
|
Loading…
Reference in a new issue