Spaces:
Runtime error
Runtime error
Add application file
Browse files- F1_curve.png +0 -0
- PR_curve.png +0 -0
- P_curve.png +0 -0
- R_curve.png +0 -0
- app.py +56 -0
- args.yaml +97 -0
- confusion_matrix.png +0 -0
- confusion_matrix_normalized.png +0 -0
- events.out.tfevents.1687581375.5da9fcb9d510.1523.1 +3 -0
- labels.jpg +0 -0
- labels_correlogram.jpg +0 -0
- requirements.txt +47 -0
- results.csv +6 -0
- results.png +0 -0
- train_batch0.jpg +0 -0
- train_batch1.jpg +0 -0
- train_batch2.jpg +0 -0
- val_batch0_labels.jpg +0 -0
- val_batch0_pred.jpg +0 -0
- weights/best.pt +3 -0
- weights/last.pt +3 -0
F1_curve.png
ADDED
![]() |
PR_curve.png
ADDED
![]() |
P_curve.png
ADDED
![]() |
R_curve.png
ADDED
![]() |
app.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import cv2
|
3 |
+
|
4 |
+
from ultralytics import YOLO
|
5 |
+
|
6 |
+
#Cargar modelo entrenado
|
7 |
+
model = YOLO('best.pt')
|
8 |
+
|
9 |
+
#Definir funcion que ejecuta la interfaz definida (en este caso es solo una interfaz, pero pueden ser algunas)
|
10 |
+
#La interfaz solo recibe una entrada (La imagen ingresada en el cargador de path de imagenes), por lo
|
11 |
+
# q ue solo se define un parametro de entrada en la funcion.
|
12 |
+
def show_results(loaded_image):
|
13 |
+
#Se generan las salidas (detecciones) pidiendo al modelo que prediga a partir de la imagen de entrada
|
14 |
+
outputs = model.predict(source=loaded_image)
|
15 |
+
results = outputs[0].cpu().numpy()
|
16 |
+
#Se carga la imagen usando openCV para poder editarla
|
17 |
+
image = cv2.imread(loaded_image)
|
18 |
+
#Se recorre cada boundingBox detectado y para cada uno se pinta un rectangulo y se escribe un id.
|
19 |
+
for i, det in enumerate(results.boxes.xyxy):
|
20 |
+
cv2.rectangle(image,
|
21 |
+
(int(det[0]), int(det[1])),
|
22 |
+
(int(det[2]), int(det[3])),
|
23 |
+
color=(0, 0, 255),
|
24 |
+
thickness=2,
|
25 |
+
lineType=cv2.LINE_AA
|
26 |
+
)
|
27 |
+
cv2.putText(image,
|
28 |
+
text =f"id:{i}",
|
29 |
+
org=(int(det[0]), int(det[1])),
|
30 |
+
fontFace =cv2.FONT_HERSHEY_SIMPLEX,
|
31 |
+
fontScale=1,
|
32 |
+
color=(0,0,255),
|
33 |
+
thickness=1,
|
34 |
+
lineType=cv2.LINE_AA
|
35 |
+
)
|
36 |
+
#Se retornan las 2 salidas definidas(imagen y texto): la imagen resultante (image) y un texto indicando cuantos boundingBox se encontraron
|
37 |
+
return cv2.cvtColor(image, cv2.COLOR_BGR2RGB), len(results.boxes)
|
38 |
+
|
39 |
+
|
40 |
+
inputs = [gr.components.Image(type="filepath", label="Input Image"),
|
41 |
+
]
|
42 |
+
outputs= [gr.components.Image(type="numpy", label="Output Image"),
|
43 |
+
gr.Textbox(label="Total:")
|
44 |
+
]
|
45 |
+
#examples = [['demo1.png'], ['demo2.jpg'], ['demo3.jpg'], ['demo4.png']]
|
46 |
+
|
47 |
+
interface = gr.Interface(fn=show_results,
|
48 |
+
inputs=inputs,
|
49 |
+
outputs=outputs,
|
50 |
+
title="Object Detection",
|
51 |
+
#En la interfaz se pueden incluir ejemplos de lo que se espera como entrada o entradas. En este caso,
|
52 |
+
# la entrada es una imagen por lo que se pueden poner imagenes de ejemplo (deben estar subidas en el repositorio
|
53 |
+
# y con el path correctamente referenciado)
|
54 |
+
#examples=examples,
|
55 |
+
)
|
56 |
+
interface.launch()
|
args.yaml
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
task: detect
|
2 |
+
mode: train
|
3 |
+
model: yolov8n.pt
|
4 |
+
data: /content/drive/MyDrive/CuyDetector/data.yaml
|
5 |
+
epochs: 5
|
6 |
+
patience: 50
|
7 |
+
batch: 32
|
8 |
+
imgsz: 640
|
9 |
+
save: true
|
10 |
+
save_period: -1
|
11 |
+
cache: false
|
12 |
+
device: null
|
13 |
+
workers: 8
|
14 |
+
project: null
|
15 |
+
name: yolov8n_testing_01
|
16 |
+
exist_ok: false
|
17 |
+
pretrained: true
|
18 |
+
optimizer: auto
|
19 |
+
verbose: true
|
20 |
+
seed: 0
|
21 |
+
deterministic: true
|
22 |
+
single_cls: false
|
23 |
+
rect: false
|
24 |
+
cos_lr: false
|
25 |
+
close_mosaic: 0
|
26 |
+
resume: false
|
27 |
+
amp: true
|
28 |
+
fraction: 1.0
|
29 |
+
profile: false
|
30 |
+
overlap_mask: true
|
31 |
+
mask_ratio: 4
|
32 |
+
dropout: 0.0
|
33 |
+
val: true
|
34 |
+
split: val
|
35 |
+
save_json: false
|
36 |
+
save_hybrid: false
|
37 |
+
conf: null
|
38 |
+
iou: 0.7
|
39 |
+
max_det: 300
|
40 |
+
half: false
|
41 |
+
dnn: false
|
42 |
+
plots: true
|
43 |
+
source: null
|
44 |
+
show: false
|
45 |
+
save_txt: false
|
46 |
+
save_conf: false
|
47 |
+
save_crop: false
|
48 |
+
show_labels: true
|
49 |
+
show_conf: true
|
50 |
+
vid_stride: 1
|
51 |
+
line_width: null
|
52 |
+
visualize: false
|
53 |
+
augment: false
|
54 |
+
agnostic_nms: false
|
55 |
+
classes: null
|
56 |
+
retina_masks: false
|
57 |
+
boxes: true
|
58 |
+
format: torchscript
|
59 |
+
keras: false
|
60 |
+
optimize: false
|
61 |
+
int8: false
|
62 |
+
dynamic: false
|
63 |
+
simplify: false
|
64 |
+
opset: null
|
65 |
+
workspace: 4
|
66 |
+
nms: false
|
67 |
+
lr0: 0.01
|
68 |
+
lrf: 0.01
|
69 |
+
momentum: 0.937
|
70 |
+
weight_decay: 0.0005
|
71 |
+
warmup_epochs: 3.0
|
72 |
+
warmup_momentum: 0.8
|
73 |
+
warmup_bias_lr: 0.1
|
74 |
+
box: 7.5
|
75 |
+
cls: 0.5
|
76 |
+
dfl: 1.5
|
77 |
+
pose: 12.0
|
78 |
+
kobj: 1.0
|
79 |
+
label_smoothing: 0.0
|
80 |
+
nbs: 64
|
81 |
+
hsv_h: 0.015
|
82 |
+
hsv_s: 0.7
|
83 |
+
hsv_v: 0.4
|
84 |
+
degrees: 0.0
|
85 |
+
translate: 0.1
|
86 |
+
scale: 0.5
|
87 |
+
shear: 0.0
|
88 |
+
perspective: 0.0
|
89 |
+
flipud: 0.0
|
90 |
+
fliplr: 0.5
|
91 |
+
mosaic: 1.0
|
92 |
+
mixup: 0.0
|
93 |
+
copy_paste: 0.0
|
94 |
+
cfg: null
|
95 |
+
v5loader: false
|
96 |
+
tracker: botsort.yaml
|
97 |
+
save_dir: runs/detect/yolov8n_testing_01
|
confusion_matrix.png
ADDED
![]() |
confusion_matrix_normalized.png
ADDED
![]() |
events.out.tfevents.1687581375.5da9fcb9d510.1523.1
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:29a87f0811105bede02c8a35a9b95be286091781d1d1e0ce792e79603a536210
|
3 |
+
size 88
|
labels.jpg
ADDED
![]() |
labels_correlogram.jpg
ADDED
![]() |
requirements.txt
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Ultralytics requirements
|
2 |
+
# Usage: pip install -r requirements.txt
|
3 |
+
|
4 |
+
# Base ----------------------------------------
|
5 |
+
hydra-core>=1.2.0
|
6 |
+
matplotlib>=3.2.2
|
7 |
+
numpy>=1.18.5
|
8 |
+
opencv-python>=4.1.1
|
9 |
+
Pillow>=7.1.2
|
10 |
+
PyYAML>=5.3.1
|
11 |
+
requests>=2.23.0
|
12 |
+
scipy>=1.4.1
|
13 |
+
torch>=1.7.0
|
14 |
+
torchvision>=0.8.1
|
15 |
+
tqdm>=4.64.0
|
16 |
+
ultralytics
|
17 |
+
|
18 |
+
# Logging -------------------------------------
|
19 |
+
tensorboard>=2.4.1
|
20 |
+
# clearml
|
21 |
+
# comet
|
22 |
+
|
23 |
+
# Plotting ------------------------------------
|
24 |
+
pandas>=1.1.4
|
25 |
+
seaborn>=0.11.0
|
26 |
+
|
27 |
+
# Export --------------------------------------
|
28 |
+
# coremltools>=6.0 # CoreML export
|
29 |
+
# onnx>=1.12.0 # ONNX export
|
30 |
+
# onnx-simplifier>=0.4.1 # ONNX simplifier
|
31 |
+
# nvidia-pyindex # TensorRT export
|
32 |
+
# nvidia-tensorrt # TensorRT export
|
33 |
+
# scikit-learn==0.19.2 # CoreML quantization
|
34 |
+
# tensorflow>=2.4.1 # TF exports (-cpu, -aarch64, -macos)
|
35 |
+
# tensorflowjs>=3.9.0 # TF.js export
|
36 |
+
# openvino-dev # OpenVINO export
|
37 |
+
|
38 |
+
# Extras --------------------------------------
|
39 |
+
ipython # interactive notebook
|
40 |
+
psutil # system utilization
|
41 |
+
thop>=0.1.1 # FLOPs computation
|
42 |
+
# albumentations>=1.0.3
|
43 |
+
# pycocotools>=2.0.6 # COCO mAP
|
44 |
+
# roboflow
|
45 |
+
|
46 |
+
# HUB -----------------------------------------
|
47 |
+
GitPython>=3.1.24
|
results.csv
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
epoch, train/box_loss, train/cls_loss, train/dfl_loss, metrics/precision(B), metrics/recall(B), metrics/mAP50(B), metrics/mAP50-95(B), val/box_loss, val/cls_loss, val/dfl_loss, lr/pg0, lr/pg1, lr/pg2
|
2 |
+
0, 1.645, 2.6314, 1.9517, 0.00667, 1, 0.19129, 0.11475, 1.0169, 2.8058, 1.6284, 2e-05, 2e-05, 2e-05
|
3 |
+
1, 1.6322, 2.5365, 1.9488, 0.00667, 1, 0.24729, 0.11936, 1.0316, 2.8058, 1.6437, 4.812e-05, 4.812e-05, 4.812e-05
|
4 |
+
2, 1.5943, 2.5872, 1.997, 0.00667, 1, 0.28031, 0.12405, 0.99343, 2.8341, 1.6276, 6.04e-05, 6.04e-05, 6.04e-05
|
5 |
+
3, 1.4867, 2.5266, 1.8333, 0.00667, 1, 0.28265, 0.15697, 1.0849, 2.8533, 1.6092, 5.684e-05, 5.684e-05, 5.684e-05
|
6 |
+
4, 1.4518, 2.4932, 1.8417, 0.00667, 1, 0.31144, 0.17644, 1.2216, 2.8967, 1.6712, 3.744e-05, 3.744e-05, 3.744e-05
|
results.png
ADDED
![]() |
train_batch0.jpg
ADDED
![]() |
train_batch1.jpg
ADDED
![]() |
train_batch2.jpg
ADDED
![]() |
val_batch0_labels.jpg
ADDED
![]() |
val_batch0_pred.jpg
ADDED
![]() |
weights/best.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9162183dccc0878cca74fde687983e2e265dcd7d484f7d0a43ef838fd04edb26
|
3 |
+
size 6241262
|
weights/last.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0d139c476589b6e3c9fe67ac5a866bba1b7e29b389456beb2f01982b3420695e
|
3 |
+
size 6241262
|