Initial commit for push folder
This commit is contained in:
commit
c4af9fcbb5
82 changed files with 3294 additions and 0 deletions
25
recognization/code/test.py
Normal file
25
recognization/code/test.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from ultralytics import YOLO
|
||||
import cv2
|
||||
|
||||
model = YOLO("/Users/nguyenhongvan/recongnize/runs/detect/train/weights/best.pt")
|
||||
|
||||
image_path = "/Users/nguyenhongvan/recongnize/data/add/image9.jpg"
|
||||
|
||||
results = model(image_path)
|
||||
|
||||
image = cv2.imread(image_path)
|
||||
|
||||
for box in results[0].boxes.xyxy.cpu().numpy():
|
||||
x1, y1, x2, y2 = map(int, box)
|
||||
|
||||
cv2.rectangle(
|
||||
image,
|
||||
(x1, y1),
|
||||
(x2, y2),
|
||||
(0, 255, 0),
|
||||
2
|
||||
)
|
||||
|
||||
cv2.imshow("Bounding Boxes Only", image)
|
||||
cv2.waitKey(0)
|
||||
cv2.destroyAllWindows()
|
||||
Loading…
Add table
Add a link
Reference in a new issue