Spaces:
Runtime error
Runtime error
Delete Ikinci_Yol.py
Browse files- Ikinci_Yol.py +0 -30
Ikinci_Yol.py
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
import cv2
|
2 |
-
from ultralytics import YOLO
|
3 |
-
import numpy as np
|
4 |
-
model=YOLO("/home/kahraman/Masaüstü/HuggingFace_Models_and_Spaces/yolov8_model_on_custom_data/best.pt")
|
5 |
-
|
6 |
-
source="/home/kahraman/Masaüstü/HuggingFace_Models_and_Spaces/yolov8_model_on_custom_data/cow-video-cows-mooing-and-grazing-in-a-field.mp4"
|
7 |
-
|
8 |
-
cap = cv2.VideoCapture(source)
|
9 |
-
|
10 |
-
while True:
|
11 |
-
ret, frame = cap.read()
|
12 |
-
|
13 |
-
if not ret:
|
14 |
-
break
|
15 |
-
|
16 |
-
results = model(frame)
|
17 |
-
for result in results:
|
18 |
-
box=result.boxes
|
19 |
-
|
20 |
-
x1, y1, x2, y2 = map(int, box.xyxy[0])
|
21 |
-
print(x1, y1, x2, y2)
|
22 |
-
cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
23 |
-
|
24 |
-
cv2.imshow("img", frame)
|
25 |
-
|
26 |
-
if cv2.waitKey(1) & 0xFF == ord("q"):
|
27 |
-
break
|
28 |
-
|
29 |
-
cap.release()
|
30 |
-
cv2.destroyAllWindows()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|