aunghlaiingtun
commited on
Commit
·
8a8c8c6
1
Parent(s):
7357461
my frist app
Browse files
best_int8_openvino_model/best.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:667c192bfb8a38ad7a5fafe62868185de02720203ac793ec36a5cd2d4201c9dc
|
3 |
+
size 26059692
|
best_int8_openvino_model/best.xml
ADDED
The diff for this file is too large to render.
See raw diff
|
|
best_int8_openvino_model/metadata.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
description: Ultralytics best model trained on datasets/data.yaml
|
2 |
+
author: Ultralytics
|
3 |
+
date: '2024-12-24T19:25:07.780379'
|
4 |
+
version: 8.3.54
|
5 |
+
license: AGPL-3.0 License (https://ultralytics.com/license)
|
6 |
+
docs: https://docs.ultralytics.com
|
7 |
+
stride: 32
|
8 |
+
task: detect
|
9 |
+
batch: 1
|
10 |
+
imgsz:
|
11 |
+
- 640
|
12 |
+
- 640
|
13 |
+
names:
|
14 |
+
0: mask
|
15 |
+
1: shark
|
twoobjectdetect.py
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from ultralytics import YOLO
|
2 |
+
from PIL import Image
|
3 |
+
import gradio as gr
|
4 |
+
from huggingface_hub import snapshot_download
|
5 |
+
import os
|
6 |
+
|
7 |
+
#model_path = "/Users/markk/Downloads/best_int8_openvino_model"
|
8 |
+
#model_path1 = "C:\Users\aungh\Downloads\6319250G\best_int8_openvino_model"
|
9 |
+
|
10 |
+
# Define the path to the YOLOv8 mo
|
11 |
+
model_path = "./best_int8_openvino_model"
|
12 |
+
|
13 |
+
#Organizations model path location
|
14 |
+
MODEL_REPO_ID = "ITI107-2024S2/6319250G"
|
15 |
+
|
16 |
+
#load model
|
17 |
+
def load_model(repo_id):
|
18 |
+
download_dir = snapshot_download(repo_id)
|
19 |
+
print(download_dir)
|
20 |
+
path = os.path.join(download_dir, "best_int8_openvino_model")
|
21 |
+
print(path)
|
22 |
+
detection_model = YOLO(path, task='detect')
|
23 |
+
return detection_model
|
24 |
+
|
25 |
+
detection_model = load_model(MODEL_REPO_ID)
|
26 |
+
|
27 |
+
#Student ID
|
28 |
+
student_info = "Student Id: 6319250G, Name: AUNG HTUN"
|
29 |
+
|
30 |
+
#prdeict
|
31 |
+
def predict(pilimg):
|
32 |
+
source = pilimg
|
33 |
+
result = detection_model.predict(source, conf=0.5, iou=0.5)
|
34 |
+
img_bgr = result[0].plot()
|
35 |
+
out_pilimg = Image.fromarray(img_bgr[..., ::-1]) # RGB-order PIL image
|
36 |
+
return out_pilimg
|
37 |
+
|
38 |
+
#UI interface
|
39 |
+
gr.Markdown("# Two Object Detection (Shark/Mask)")
|
40 |
+
gr.Markdown(student_info)
|
41 |
+
gr.Interface(fn=predict,
|
42 |
+
inputs=gr.Image(type="pil",label="Input"),
|
43 |
+
outputs=gr.Image(type="pil",label="Output"),
|
44 |
+
title="Two Object Detection (Shark/Mask)",
|
45 |
+
description=student_info,
|
46 |
+
).launch(share=True)
|