Skip to content

Commit

Permalink
Merge pull request #11 from zoanhy20/feature/module_01_week_04
Browse files Browse the repository at this point in the history
complete all project module 1 week 4
  • Loading branch information
zoanhy20 authored Jul 14, 2024
2 parents ef0b260 + 5ecc128 commit 6b850cc
Show file tree
Hide file tree
Showing 21 changed files with 18,539 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import numpy as np
from PIL import Image
import streamlit as st
from ultralytics import YOLOv10

if __name__ == '__main__':
st.title('Helmet Safety Detection Using YOLO V10')

uploaded_file = st.file_uploader('Choose an image:', type=['png', 'jpg', 'jpeg'])

if uploaded_file is not None:
image = Image.open(uploaded_file)
image = np.array(image)

TRAINED_MODEL_PATH = 'best.pt'
model = YOLOv10(TRAINED_MODEL_PATH)
IMG_SIZE = 640
IMAGE_URL = 'https://i.pinimg.com/originals/76/69/50/7669509c488cfd1ffea99a1406419fe1.jpg'

CONF_THRESHOLD = 0.3
results = model.predict(source=image,
imgsz=IMG_SIZE,
conf=CONF_THRESHOLD)

annotated_img = results[0].plot()

st.image(annotated_img, use_column_width=True)
Binary file not shown.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6b850cc

Please sign in to comment.