roxas010394 commited on
Commit
cf06c1d
·
0 Parent(s):

Duplicate from roxas010394/parts-of-cars

Browse files
Files changed (5) hide show
  1. .gitattributes +34 -0
  2. README.md +14 -0
  3. app.py +34 -0
  4. best.pt +3 -0
  5. requirements.txt +5 -0
.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Parts Of Cars
3
+ emoji: 👁
4
+ colorFrom: indigo
5
+ colorTo: yellow
6
+ sdk: gradio
7
+ sdk_version: 3.20.1
8
+ app_file: app.py
9
+ pinned: false
10
+ license: unknown
11
+ duplicated_from: roxas010394/parts-of-cars
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ultralytics import YOLO
2
+ import matplotlib.pyplot as plt
3
+ import gradio as gr
4
+ import cv2
5
+ import numpy as np
6
+ import random
7
+ import seaborn as sns
8
+ from PIL import Image
9
+ import io
10
+ def predict(path:str):
11
+ model = YOLO("yolov8n.yaml")
12
+ model = YOLO("best.pt")
13
+ image = cv2.imread(path)
14
+
15
+ image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
16
+ results = model.predict(source=path)
17
+ paleta= sns.color_palette("bright", 17)
18
+ fig = plt.figure()
19
+ vectObjs = results[0].masks.xy
20
+ resNumClase = results[0].boxes.cls.numpy().astype(int)
21
+ conf = results[0].boxes.conf.numpy()
22
+ for i in range(len(vectObjs)):
23
+ objDet = vectObjs[i].astype(int)
24
+ color = (paleta[i][0]*255, paleta[i][1]*255, paleta[i][2]*255)
25
+ image = cv2.polylines(image, [objDet], True, color, 4)
26
+ plt.text(objDet[0][0], objDet[0][1], results[0].names[resNumClase[i]]+" "+ str(conf[i]), bbox=dict(facecolor=paleta[i], alpha=0.5))
27
+
28
+ plt.imshow(image)
29
+ plt.axis('off')
30
+ return plt
31
+ gr.Interface(fn=predict,
32
+ inputs=gr.components.Image(type="filepath", label="Input"),
33
+ outputs=gr.Plot(label="Resultado de detección de objetos con regularizacion")).launch()
34
+ #outputs=gr.components.Image(type="pil", label="Output")).launch()
best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c6225903bf0151ed639859338fe490946f1c5ae9e2a515ed5a9df709c4acf87
3
+ size 23798722
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ ultralytics
2
+ opencv-python
3
+ numpy
4
+ matplotlib
5
+ seaborn