`ultralytics 8.3.3` update Streamlit app to YOLO11 (#16590)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
pull/16611/head v8.3.3
Muhammad Rizwan Munawar 2 months ago committed by GitHub
parent abb87c09c6
commit f5a491cd45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      ultralytics/__init__.py
  2. 6
      ultralytics/solutions/streamlit_inference.py
  3. 16
      ultralytics/utils/plotting.py

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license # Ultralytics YOLO 🚀, AGPL-3.0 license
__version__ = "8.3.2" __version__ = "8.3.3"
import os import os

@ -23,13 +23,13 @@ def inference(model=None):
# Main title of streamlit application # Main title of streamlit application
main_title_cfg = """<div><h1 style="color:#FF64DA; text-align:center; font-size:40px; main_title_cfg = """<div><h1 style="color:#FF64DA; text-align:center; font-size:40px;
font-family: 'Archivo', sans-serif; margin-top:-50px;margin-bottom:20px;"> font-family: 'Archivo', sans-serif; margin-top:-50px;margin-bottom:20px;">
Ultralytics YOLOv8 Streamlit Application Ultralytics YOLO Streamlit Application
</h1></div>""" </h1></div>"""
# Subtitle of streamlit application # Subtitle of streamlit application
sub_title_cfg = """<div><h4 style="color:#042AFF; text-align:center; sub_title_cfg = """<div><h4 style="color:#042AFF; text-align:center;
font-family: 'Archivo', sans-serif; margin-top:-15px; margin-bottom:50px;"> font-family: 'Archivo', sans-serif; margin-top:-15px; margin-bottom:50px;">
Experience real-time object detection on your webcam with the power of Ultralytics YOLOv8! 🚀</h4> Experience real-time object detection on your webcam with the power of Ultralytics YOLO! 🚀</h4>
</div>""" </div>"""
# Set html page configuration # Set html page configuration
@ -67,7 +67,7 @@ def inference(model=None):
vid_file_name = 0 vid_file_name = 0
# Add dropdown menu for model selection # Add dropdown menu for model selection
available_models = [x.replace("yolo", "YOLO") for x in GITHUB_ASSETS_STEMS if x.startswith("yolov8")] available_models = [x.replace("yolo", "YOLO") for x in GITHUB_ASSETS_STEMS if x.startswith("yolo11")]
if model: if model:
available_models.insert(0, model.split(".pt")[0]) # insert model without suffix as *.pt is added later available_models.insert(0, model.split(".pt")[0]) # insert model without suffix as *.pt is added later

@ -591,8 +591,8 @@ class Annotator:
Args: Args:
label (str): queue counts label label (str): queue counts label
points (tuple): region points for center point calculation to display text points (tuple): region points for center point calculation to display text
region_color (RGB): queue region color region_color (tuple): RGB queue region color.
txt_color (RGB): text display color txt_color (tuple): RGB text display color.
""" """
x_values = [point[0] for point in points] x_values = [point[0] for point in points]
y_values = [point[1] for point in points] y_values = [point[1] for point in points]
@ -631,8 +631,8 @@ class Annotator:
Args: Args:
im0 (ndarray): inference image im0 (ndarray): inference image
text (str): object/class name text (str): object/class name
txt_color (bgr color): display color for text foreground txt_color (tuple): display color for text foreground
bg_color (bgr color): display color for text background bg_color (tuple): display color for text background
x_center (float): x position center point for bounding box x_center (float): x position center point for bounding box
y_center (float): y position center point for bounding box y_center (float): y position center point for bounding box
margin (int): gap between text and rectangle for better display margin (int): gap between text and rectangle for better display
@ -655,8 +655,8 @@ class Annotator:
Args: Args:
im0 (ndarray): inference image im0 (ndarray): inference image
text (dict): labels dictionary text (dict): labels dictionary
txt_color (bgr color): display color for text foreground txt_color (tuple): display color for text foreground
bg_color (bgr color): display color for text background bg_color (tuple): display color for text background
margin (int): gap between text and rectangle for better display margin (int): gap between text and rectangle for better display
""" """
horizontal_gap = int(im0.shape[1] * 0.02) horizontal_gap = int(im0.shape[1] * 0.02)
@ -836,8 +836,8 @@ class Annotator:
Args: Args:
pixels_distance (float): Pixels distance between two bbox centroids. pixels_distance (float): Pixels distance between two bbox centroids.
centroids (list): Bounding box centroids data. centroids (list): Bounding box centroids data.
line_color (RGB): Distance line color. line_color (tuple): RGB distance line color.
centroid_color (RGB): Bounding box centroid color. centroid_color (tuple): RGB bounding box centroid color.
""" """
# Get the text size # Get the text size
(text_width_m, text_height_m), _ = cv2.getTextSize( (text_width_m, text_height_m), _ = cv2.getTextSize(

Loading…
Cancel
Save