Spaces:
Sleeping
Sleeping
KAHRAMAN42
commited on
Commit
•
b7fc969
1
Parent(s):
0c71959
Upload 4 files
Browse files- best.pt +3 -0
- image_detection.py +26 -0
- images.jpeg +0 -0
- requirements.txt +52 -0
best.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b0cdb2ceca8517a36c92d6d509f9ef29c5e211d2fd8cf5d72f95e5b2fc192ad3
|
3 |
+
size 6247961
|
image_detection.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2
|
2 |
+
from ultralytics import YOLO
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
def fonk(img_path):
|
6 |
+
|
7 |
+
model=YOLO("/home/kahraman/Masaüstü/HuggingFace_Models_and_Spaces/Cattle_Detection_with_YOLOV8/best.pt")
|
8 |
+
|
9 |
+
img= cv2.imread(img_path, cv2.IMREAD_UNCHANGED)
|
10 |
+
|
11 |
+
results= model(img)
|
12 |
+
for result in results:
|
13 |
+
if result.boxes is not None and len(result.boxes):
|
14 |
+
box = result.boxes
|
15 |
+
x1, y1, x2, y2 = map(int, box.xyxy[0])
|
16 |
+
print(x1, y1, x2, y2)
|
17 |
+
img = cv2.rectangle(img, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
18 |
+
return img
|
19 |
+
|
20 |
+
demo = gr.Interface(fonk,
|
21 |
+
inputs= gr.Image(type="filepath"),
|
22 |
+
outputs=gr.Image(),
|
23 |
+
examples= "/home/kahraman/Masaüstü/HuggingFace_Models_and_Spaces/Cattle_Detection_with_YOLOV8/images.jpeg"
|
24 |
+
)
|
25 |
+
demo.launch()
|
26 |
+
|
images.jpeg
ADDED
requirements.txt
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
certifi==2023.11.17
|
2 |
+
charset-normalizer==3.3.2
|
3 |
+
contourpy==1.2.0
|
4 |
+
cycler==0.12.1
|
5 |
+
filelock==3.13.1
|
6 |
+
fonttools==4.47.2
|
7 |
+
fsspec==2023.12.2
|
8 |
+
idna==3.6
|
9 |
+
Jinja2==3.1.3
|
10 |
+
kiwisolver==1.4.5
|
11 |
+
MarkupSafe==2.1.4
|
12 |
+
matplotlib==3.8.2
|
13 |
+
mpmath==1.3.0
|
14 |
+
networkx==3.2.1
|
15 |
+
numpy==1.26.3
|
16 |
+
nvidia-cublas-cu12==12.1.3.1
|
17 |
+
nvidia-cuda-cupti-cu12==12.1.105
|
18 |
+
nvidia-cuda-nvrtc-cu12==12.1.105
|
19 |
+
nvidia-cuda-runtime-cu12==12.1.105
|
20 |
+
nvidia-cudnn-cu12==8.9.2.26
|
21 |
+
nvidia-cufft-cu12==11.0.2.54
|
22 |
+
nvidia-curand-cu12==10.3.2.106
|
23 |
+
nvidia-cusolver-cu12==11.4.5.107
|
24 |
+
nvidia-cusparse-cu12==12.1.0.106
|
25 |
+
nvidia-nccl-cu12==2.18.1
|
26 |
+
nvidia-nvjitlink-cu12==12.3.101
|
27 |
+
nvidia-nvtx-cu12==12.1.105
|
28 |
+
opencv-python==4.9.0.80
|
29 |
+
packaging==23.2
|
30 |
+
pandas==2.2.0
|
31 |
+
pillow==10.2.0
|
32 |
+
psutil==5.9.8
|
33 |
+
py-cpuinfo==9.0.0
|
34 |
+
pyparsing==3.1.1
|
35 |
+
python-dateutil==2.8.2
|
36 |
+
pytz==2023.4
|
37 |
+
PyYAML==6.0.1
|
38 |
+
requests==2.31.0
|
39 |
+
scipy==1.12.0
|
40 |
+
seaborn==0.13.2
|
41 |
+
six==1.16.0
|
42 |
+
sympy==1.12
|
43 |
+
thop==0.1.1.post2209072238
|
44 |
+
torch==2.1.2
|
45 |
+
torchvision==0.16.2
|
46 |
+
tqdm==4.66.1
|
47 |
+
triton==2.1.0
|
48 |
+
typing_extensions==4.9.0
|
49 |
+
tzdata==2023.4
|
50 |
+
ultralytics==8.1.8
|
51 |
+
urllib3==2.1.0
|
52 |
+
gradio==4.18.0
|