-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from zoanhy20/feature/module_01_week_04
complete all project module 1 week 4
- Loading branch information
Showing
21 changed files
with
18,539 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
Module 1/Week 4/HelmetSafetyDetection-YoloV10-FinetuningPretrainedModel/app.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+5.49 MB
Module 1/Week 4/HelmetSafetyDetection-YoloV10-FinetuningPretrainedModel/best.pt
Binary file not shown.
2,863 changes: 2,863 additions & 0 deletions
2,863
...tyDetection-YoloV10-FinetuningPretrainedModel/helmet_safety_detection_yolov10_colab.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+1.6 MB
...-YoloV10-FinetuningPretrainedModel/images/helmet_safety_detection_streamlit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.