Spaces:
Runtime error
Runtime error
Muhamad Usri Yusron
commited on
Commit
·
ccfbad9
1
Parent(s):
7aa2ee1
Deploy face detection model
Browse files- app.py +35 -0
- my_model.pt +3 -0
- requirements.txt +7 -0
- train/F1_curve.png +0 -0
- train/PR_curve.png +0 -0
- train/P_curve.png +0 -0
- train/R_curve.png +0 -0
- train/args.yaml +106 -0
- train/confusion_matrix.png +0 -0
- train/confusion_matrix_normalized.png +0 -0
- train/events.out.tfevents.1738229653.fbf30ac132d7.3889.0 +3 -0
- train/labels.jpg +0 -0
- train/labels_correlogram.jpg +0 -0
- train/results.csv +51 -0
- train/results.png +0 -0
- train/train_batch0.jpg +0 -0
- train/train_batch1.jpg +0 -0
- train/train_batch120.jpg +0 -0
- train/train_batch121.jpg +0 -0
- train/train_batch122.jpg +0 -0
- train/train_batch2.jpg +0 -0
- train/val_batch0_labels.jpg +0 -0
- train/val_batch0_pred.jpg +0 -0
- train/weights/best.pt +3 -0
- train/weights/last.pt +3 -0
app.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import torch
|
3 |
+
import cv2
|
4 |
+
import numpy as np
|
5 |
+
from PIL import Image
|
6 |
+
|
7 |
+
# Load model YOLOv5 yang telah kamu latih
|
8 |
+
model = torch.hub.load('ultralytics/yolov5', 'custom', path='your_face_model.pt', force_reload=True)
|
9 |
+
|
10 |
+
# Fungsi deteksi wajah
|
11 |
+
def detect_face(image):
|
12 |
+
image_cv = np.array(image) # Konversi ke array numpy
|
13 |
+
image_cv = cv2.cvtColor(image_cv, cv2.COLOR_RGB2BGR)
|
14 |
+
|
15 |
+
results = model(image_cv) # Deteksi wajah
|
16 |
+
|
17 |
+
# Gambar kotak di sekitar wajah
|
18 |
+
for *box, conf, cls in results.xyxy[0]:
|
19 |
+
x1, y1, x2, y2 = map(int, box)
|
20 |
+
cv2.rectangle(image_cv, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
21 |
+
|
22 |
+
image_result = Image.fromarray(cv2.cvtColor(image_cv, cv2.COLOR_BGR2RGB)) # Konversi kembali ke PIL
|
23 |
+
return image_result
|
24 |
+
|
25 |
+
# Buat UI dengan Gradio
|
26 |
+
iface = gr.Interface(
|
27 |
+
fn=detect_face,
|
28 |
+
inputs=gr.Image(type="pil"),
|
29 |
+
outputs=gr.Image(type="pil"),
|
30 |
+
title="Deteksi Wajah dengan YOLOv5",
|
31 |
+
description="Upload gambar dan model akan mendeteksi wajah."
|
32 |
+
)
|
33 |
+
|
34 |
+
# Jalankan aplikasi
|
35 |
+
iface.launch()
|
my_model.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:171ea4f3da708d048961e71bab44a2ed5393152cf0e254ad755f48dc703b0d0b
|
3 |
+
size 19177555
|
requirements.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
torch
|
2 |
+
torchvision
|
3 |
+
ultralytics
|
4 |
+
opencv-python
|
5 |
+
numpy
|
6 |
+
pillow
|
7 |
+
gradio
|
train/F1_curve.png
ADDED
![]() |
train/PR_curve.png
ADDED
![]() |
train/P_curve.png
ADDED
![]() |
train/R_curve.png
ADDED
![]() |
train/args.yaml
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
task: detect
|
2 |
+
mode: train
|
3 |
+
model: yolo11s.pt
|
4 |
+
data: /content/data.yaml
|
5 |
+
epochs: 50
|
6 |
+
time: null
|
7 |
+
patience: 100
|
8 |
+
batch: 16
|
9 |
+
imgsz: 640
|
10 |
+
save: true
|
11 |
+
save_period: -1
|
12 |
+
cache: false
|
13 |
+
device: null
|
14 |
+
workers: 8
|
15 |
+
project: null
|
16 |
+
name: train
|
17 |
+
exist_ok: false
|
18 |
+
pretrained: true
|
19 |
+
optimizer: auto
|
20 |
+
verbose: true
|
21 |
+
seed: 0
|
22 |
+
deterministic: true
|
23 |
+
single_cls: false
|
24 |
+
rect: false
|
25 |
+
cos_lr: false
|
26 |
+
close_mosaic: 10
|
27 |
+
resume: false
|
28 |
+
amp: true
|
29 |
+
fraction: 1.0
|
30 |
+
profile: false
|
31 |
+
freeze: null
|
32 |
+
multi_scale: false
|
33 |
+
overlap_mask: true
|
34 |
+
mask_ratio: 4
|
35 |
+
dropout: 0.0
|
36 |
+
val: true
|
37 |
+
split: val
|
38 |
+
save_json: false
|
39 |
+
save_hybrid: false
|
40 |
+
conf: null
|
41 |
+
iou: 0.7
|
42 |
+
max_det: 300
|
43 |
+
half: false
|
44 |
+
dnn: false
|
45 |
+
plots: true
|
46 |
+
source: null
|
47 |
+
vid_stride: 1
|
48 |
+
stream_buffer: false
|
49 |
+
visualize: false
|
50 |
+
augment: false
|
51 |
+
agnostic_nms: false
|
52 |
+
classes: null
|
53 |
+
retina_masks: false
|
54 |
+
embed: null
|
55 |
+
show: false
|
56 |
+
save_frames: false
|
57 |
+
save_txt: false
|
58 |
+
save_conf: false
|
59 |
+
save_crop: false
|
60 |
+
show_labels: true
|
61 |
+
show_conf: true
|
62 |
+
show_boxes: true
|
63 |
+
line_width: null
|
64 |
+
format: torchscript
|
65 |
+
keras: false
|
66 |
+
optimize: false
|
67 |
+
int8: false
|
68 |
+
dynamic: false
|
69 |
+
simplify: true
|
70 |
+
opset: null
|
71 |
+
workspace: null
|
72 |
+
nms: false
|
73 |
+
lr0: 0.01
|
74 |
+
lrf: 0.01
|
75 |
+
momentum: 0.937
|
76 |
+
weight_decay: 0.0005
|
77 |
+
warmup_epochs: 3.0
|
78 |
+
warmup_momentum: 0.8
|
79 |
+
warmup_bias_lr: 0.1
|
80 |
+
box: 7.5
|
81 |
+
cls: 0.5
|
82 |
+
dfl: 1.5
|
83 |
+
pose: 12.0
|
84 |
+
kobj: 1.0
|
85 |
+
nbs: 64
|
86 |
+
hsv_h: 0.015
|
87 |
+
hsv_s: 0.7
|
88 |
+
hsv_v: 0.4
|
89 |
+
degrees: 0.0
|
90 |
+
translate: 0.1
|
91 |
+
scale: 0.5
|
92 |
+
shear: 0.0
|
93 |
+
perspective: 0.0
|
94 |
+
flipud: 0.0
|
95 |
+
fliplr: 0.5
|
96 |
+
bgr: 0.0
|
97 |
+
mosaic: 1.0
|
98 |
+
mixup: 0.0
|
99 |
+
copy_paste: 0.0
|
100 |
+
copy_paste_mode: flip
|
101 |
+
auto_augment: randaugment
|
102 |
+
erasing: 0.4
|
103 |
+
crop_fraction: 1.0
|
104 |
+
cfg: null
|
105 |
+
tracker: botsort.yaml
|
106 |
+
save_dir: runs/detect/train
|
train/confusion_matrix.png
ADDED
![]() |
train/confusion_matrix_normalized.png
ADDED
![]() |
train/events.out.tfevents.1738229653.fbf30ac132d7.3889.0
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:875f9bcd9606d679786aa73963eceb29a2a0ac203f067a16a3e5791d4cdb4bc3
|
3 |
+
size 304810
|
train/labels.jpg
ADDED
![]() |
train/labels_correlogram.jpg
ADDED
![]() |
train/results.csv
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
epoch,time,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 |
+
1,10.8576,1.55829,4.5686,1.89263,0.0174,0.66667,0.02639,0.00326,1.91089,6.90784,2.39807,2.858e-05,2.858e-05,2.858e-05
|
3 |
+
2,12.7583,1.64016,4.50094,1.95329,0.0119,0.41667,0.02052,0.00275,1.87702,6.99771,2.37482,7.00353e-05,7.00353e-05,7.00353e-05
|
4 |
+
3,14.4729,1.46621,3.56945,1.81745,0.5385,0.75,0.79045,0.37033,1.57217,3.45723,2.35759,0.000109793,0.000109793,0.000109793
|
5 |
+
4,16.4405,1.1958,2.43055,1.65825,0.91153,0.75,0.91167,0.51358,1.28986,3.79977,1.86125,0.000147853,0.000147853,0.000147853
|
6 |
+
5,18.4641,1.23069,2.03282,1.59263,0.91883,0.93833,0.995,0.65532,1.33455,3.89588,2.26879,0.000184215,0.000184215,0.000184215
|
7 |
+
6,20.3252,1.04903,1.65295,1.42348,0.92848,1,0.995,0.74355,1.15221,3.50921,1.95509,0.00021888,0.00021888,0.00021888
|
8 |
+
7,23.0434,1.04021,1.59462,1.32107,0.89227,0.96683,0.995,0.53981,1.49806,4.06972,2.40055,0.000251847,0.000251847,0.000251847
|
9 |
+
8,25.6888,0.96822,1.45638,1.31112,0.67095,0.9566,0.74625,0.48184,1.34077,4.73687,2.50466,0.000283116,0.000283116,0.000283116
|
10 |
+
9,28.2275,0.98287,1.35079,1.33086,1,0.96998,0.995,0.75957,1.0006,2.93008,1.87688,0.000312688,0.000312688,0.000312688
|
11 |
+
10,30.2009,0.95736,1.28352,1.34082,0.92389,1,0.995,0.72041,0.95386,2.04471,1.84991,0.000340562,0.000340562,0.000340562
|
12 |
+
11,32.035,0.97261,1.24077,1.32223,0.94014,1,0.995,0.73696,1.00748,2.41444,1.79557,0.000366739,0.000366739,0.000366739
|
13 |
+
12,33.8103,0.84999,1.08427,1.28461,0.9448,1,0.995,0.7081,1.10435,2.23527,1.96388,0.000391217,0.000391217,0.000391217
|
14 |
+
13,35.5609,0.89944,0.98681,1.22827,0.90093,0.88345,0.995,0.70805,1.21896,2.15017,2.21729,0.000413998,0.000413998,0.000413998
|
15 |
+
14,37.3044,1.02668,1.01064,1.29174,0.52108,1,0.995,0.66175,1.15342,2.7919,2.02488,0.000435082,0.000435082,0.000435082
|
16 |
+
15,39.4533,0.98552,1.03554,1.28225,0.55429,0.75106,0.74625,0.6029,0.91545,2.92073,1.71726,0.000454468,0.000454468,0.000454468
|
17 |
+
16,41.993,0.92824,0.8903,1.31018,0.45606,0.8862,0.58042,0.44487,0.84305,2.26706,1.64499,0.000472156,0.000472156,0.000472156
|
18 |
+
17,44.68,0.92938,0.90291,1.25011,0.9887,0.5,0.53816,0.35095,1.20826,2.28719,2.12426,0.000488146,0.000488146,0.000488146
|
19 |
+
18,47.3468,0.92834,0.8801,1.27126,0.9885,0.5,0.58042,0.43438,1.02667,1.7848,1.83578,0.000502439,0.000502439,0.000502439
|
20 |
+
19,49.2722,0.86455,0.81939,1.23076,0.55148,1,0.65143,0.51995,0.91719,1.55999,1.58321,0.000515034,0.000515034,0.000515034
|
21 |
+
20,50.9657,0.85714,0.96959,1.26941,0.63305,0.75,0.62452,0.48004,1.04341,2.11395,1.66254,0.000525932,0.000525932,0.000525932
|
22 |
+
21,52.714,1.03044,0.89738,1.2361,0.61023,0.75,0.66292,0.48566,1.21657,1.85004,1.92787,0.000535132,0.000535132,0.000535132
|
23 |
+
22,54.4553,0.91771,0.92032,1.3477,0.79847,1,0.91167,0.60626,1.38904,1.01684,2.34415,0.000542634,0.000542634,0.000542634
|
24 |
+
23,56.1632,0.82723,0.72965,1.19995,0.77048,0.98992,0.995,0.75534,0.96783,0.86227,1.74297,0.000548439,0.000548439,0.000548439
|
25 |
+
24,57.9159,0.8996,0.78879,1.21886,0.75292,1,0.91167,0.62463,1.08983,1.02372,1.79177,0.000552546,0.000552546,0.000552546
|
26 |
+
25,60.3616,0.81167,0.74821,1.27184,0.88545,0.75,0.76583,0.60446,1.02393,1.66894,1.65488,0.000554955,0.000554955,0.000554955
|
27 |
+
26,62.9841,0.72364,0.72729,1.14725,0.48588,0.75,0.60806,0.42885,1.09399,1.72511,1.73314,0.000555667,0.000555667,0.000555667
|
28 |
+
27,65.6504,0.81118,0.70857,1.17092,0.52091,0.75,0.56367,0.44558,1.03783,2.01189,1.76716,0.000554681,0.000554681,0.000554681
|
29 |
+
28,67.6042,0.718,0.63594,1.14135,0.94615,0.75,0.76015,0.62742,0.96627,1.74127,1.55769,0.000551997,0.000551997,0.000551997
|
30 |
+
29,69.3278,0.77849,0.6731,1.22145,0.94615,0.75,0.76015,0.62742,0.96627,1.74127,1.55769,0.000547616,0.000547616,0.000547616
|
31 |
+
30,71.0985,0.77749,0.69948,1.18013,0.78061,1,0.91167,0.75166,0.91506,1.03383,1.56326,0.000541537,0.000541537,0.000541537
|
32 |
+
31,72.8137,0.76624,0.71875,1.23041,0.95083,1,0.995,0.67893,1.09941,0.91548,1.94918,0.00053376,0.00053376,0.00053376
|
33 |
+
32,74.6253,0.75077,0.7189,1.17511,0.67493,1,0.91167,0.60022,1.09093,0.95615,2.00025,0.000524286,0.000524286,0.000524286
|
34 |
+
33,76.4441,0.86854,0.76791,1.2924,0.67493,1,0.91167,0.60022,1.09093,0.95615,2.00025,0.000513114,0.000513114,0.000513114
|
35 |
+
34,78.8589,0.74828,0.64468,1.08478,0.85924,0.75,0.82833,0.53415,1.01587,0.93905,1.96313,0.000495291,0.000495291,0.000495291
|
36 |
+
35,81.4297,0.69054,0.66495,1.15744,0.93548,1,0.995,0.78673,0.861,0.58244,1.55547,0.000466997,0.000466997,0.000466997
|
37 |
+
36,84.2834,0.77097,0.73016,1.20821,0.91752,1,0.995,0.82142,0.87083,0.58043,1.51581,0.000438703,0.000438703,0.000438703
|
38 |
+
37,86.0873,0.65087,0.66471,1.16693,0.91752,1,0.995,0.82142,0.87083,0.58043,1.51581,0.000410409,0.000410409,0.000410409
|
39 |
+
38,87.9295,0.8243,0.71229,1.22269,0.92901,1,0.995,0.82661,0.89587,0.54924,1.47529,0.000382115,0.000382115,0.000382115
|
40 |
+
39,89.8292,0.69296,0.63933,1.15859,0.96717,1,0.995,0.80076,0.94154,0.5026,1.52876,0.00035382,0.00035382,0.00035382
|
41 |
+
40,91.5558,0.72674,0.57632,1.06875,0.97138,1,0.995,0.76361,0.94532,0.57795,1.56654,0.000325526,0.000325526,0.000325526
|
42 |
+
41,95.0928,0.64963,0.7392,1.17571,0.97138,1,0.995,0.76361,0.94532,0.57795,1.56654,0.000297232,0.000297232,0.000297232
|
43 |
+
42,98.24,0.66395,0.70349,1.13173,0.97318,1,0.995,0.75114,1.0003,0.61925,1.63998,0.000268938,0.000268938,0.000268938
|
44 |
+
43,100.962,0.62205,0.60594,1.1909,0.97282,1,0.995,0.78022,0.9714,0.49142,1.60858,0.000240644,0.000240644,0.000240644
|
45 |
+
44,103.708,0.57239,0.56056,1.05396,0.97399,1,0.995,0.7555,0.95778,0.44627,1.63058,0.000212349,0.000212349,0.000212349
|
46 |
+
45,105.541,0.58924,0.57748,1.11242,0.97399,1,0.995,0.7555,0.95778,0.44627,1.63058,0.000184055,0.000184055,0.000184055
|
47 |
+
46,107.219,0.58669,0.55511,1.06983,0.97212,1,0.995,0.78733,0.91202,0.4204,1.5632,0.000155761,0.000155761,0.000155761
|
48 |
+
47,108.979,0.54988,0.52492,1.15186,0.9776,1,0.995,0.78727,0.88107,0.43879,1.5298,0.000127467,0.000127467,0.000127467
|
49 |
+
48,110.759,0.56895,0.49062,1.06031,0.98157,1,0.995,0.77498,0.88952,0.44335,1.56448,9.91726e-05,9.91726e-05,9.91726e-05
|
50 |
+
49,112.415,0.47636,0.50798,0.97729,0.98157,1,0.995,0.77498,0.88952,0.44335,1.56448,7.08784e-05,7.08784e-05,7.08784e-05
|
51 |
+
50,114.266,0.54214,0.49288,1.06364,0.98393,1,0.995,0.76258,0.81723,0.38325,1.51335,4.25842e-05,4.25842e-05,4.25842e-05
|
train/results.png
ADDED
![]() |
train/train_batch0.jpg
ADDED
![]() |
train/train_batch1.jpg
ADDED
![]() |
train/train_batch120.jpg
ADDED
![]() |
train/train_batch121.jpg
ADDED
![]() |
train/train_batch122.jpg
ADDED
![]() |
train/train_batch2.jpg
ADDED
![]() |
train/val_batch0_labels.jpg
ADDED
![]() |
train/val_batch0_pred.jpg
ADDED
![]() |
train/weights/best.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:171ea4f3da708d048961e71bab44a2ed5393152cf0e254ad755f48dc703b0d0b
|
3 |
+
size 19177555
|
train/weights/last.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5aa634c1f09e5eb9f77c08a48114b86925d6f6fc666ff601c64d19f127277c9e
|
3 |
+
size 19177555
|