modes/predict/ #7932
Replies: 85 comments 164 replies
-
thx, its amazing |
Beta Was this translation helpful? Give feedback.
-
Can we set different confidences for different classes? It would be a nice addition. |
Beta Was this translation helpful? Give feedback.
-
Can you please share more details on the I understand that by default we receive 160x160 masks in segment models, but what does setting the above True do? |
Beta Was this translation helpful? Give feedback.
-
Hi, I am trying to do a simple yolo model and every time I try predicting it doesn't detect anything. Here is what I am doing. I am. downloading this dataset and then trying to train a model on it and then once its trained I am trying to predict with it. I pasted all of my code so that you can replicate. https://universe.roboflow.com/damage-4yhkc/damaged-bchyj/dataset/5/downloadfrom roboflow import Roboflow model = YOLO('yolov8n-seg.pt') # build from YAML and transfer weights #Predict |
Beta Was this translation helpful? Give feedback.
-
Hello if i want to know these pixel coordinates represent which object, What should i do? For example this is my code
And this code give to me the pixel coordinates of objects so how can i learn which coordinate represents which object? |
Beta Was this translation helpful? Give feedback.
-
With that code :
it print that results: |
Beta Was this translation helpful? Give feedback.
-
how can we count total number of objects in the set of images after training the model? |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for your response. I appreciate it.
I want to know can we use this code for directory because I have 760 images
in the directory I want count the total predicted boxes all in once.
Thanks
…On Tue, Feb 13, 2024, 9:55 PM Glenn Jocher ***@***.***> wrote:
Hey there! 👋 To count the total number of objects across a set of images
after training your model, you can use the predict mode to process your
images and then sum up the detections. Here's a quick example using Python:
from ultralytics import YOLO
# Load your trained modelmodel = YOLO('path/to/your/trained_model.pt')
# List of images to run inference onimages = ['image1.jpg', 'image2.jpg', ...]
# Run inferenceresults = model(images)
# Count total objectstotal_objects = sum(len(result.boxes) for result in results)print(f'Total objects detected: {total_objects}')
This will give you the total count of objects detected across all your
images. Happy counting! 😊
—
Reply to this email directly, view it on GitHub
<#7932 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BAHRMJFIOOEU34WCWMTYWELYTNWFDAVCNFSM6AAAAABCTDRDM6VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DINJUGA2TM>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
If i want to run predictions on several images at once, I shoumd use a tensor as |
Beta Was this translation helpful? Give feedback.
-
If I want to predict on several images at once I should use a tensor with the format |
Beta Was this translation helpful? Give feedback.
-
If I want to predict on several images at once I should use a tensor with the format |
Beta Was this translation helpful? Give feedback.
-
This aint working: Load a pretrained YOLOv8n modelmodel = YOLO('yolov8n.pt') Create a random torch tensor of BCHW shape (1, 3, 640, 640) with values in range [0, 1] and type float32source = torch.rand(1, 3, 640, 640, dtype=torch.float32) Run inference on the sourceresults = model(source) # list of Results objects ERROR:
|
Beta Was this translation helpful? Give feedback.
-
Hello, i export the model (yolov8-seg.onnx), and i use this model in react. how can i take the outline coordinates like 'masks.xy' in react app? |
Beta Was this translation helpful? Give feedback.
-
I want to use YOLOv8 for multi-class image classification but yolov8n-cls have 1k classes which is way more than i want , i want to classify for just <80 class for example if image have Chihuahua and catfish model must return only dog and fish not the specific kind of dogs , how to do that ? |
Beta Was this translation helpful? Give feedback.
-
How to get masks only conf is over 0.8? realtime capture by webcam |
Beta Was this translation helpful? Give feedback.
-
self.model = YOLO("model/2.27best.engine",task="detect") result : 1/3: rtsp://admin:@xx192.168.1.107:554/cam/realmonitor?channel=1&subtype=0... Success ✅ (inf frames of shape 1920x1080 at 25.00 FPS) The printing of the console has no further information, and the program is still running and cannot be detected |
Beta Was this translation helpful? Give feedback.
-
I am using the stream=True parameter, if I set vid stride=30, in this loop for r in results: he will wait for vid stride interval, but I do not want to wait, in the interval does not detect, return to the original frame, what should I do |
Beta Was this translation helpful? Give feedback.
-
hi all, i want to ask, why when i run this code from ultralytics import YOLO def check_stream(url): Example usageLoad a pretrained YOLOv8n modelmodel = YOLO('yolov8n.pt') steam_url = "rtsp://192.168.1.18:554/1/h264major" Run inference on the sourceresults = model(steam_url, stream=True, show=True, stream_buffer=True) # generator of Results objects it doesnt show the video stream and will end the process immediately |
Beta Was this translation helpful? Give feedback.
-
Hi! I am trying to make my pi camera to tcp stream the detection. How do I make the cap = cv2.VideoCapture(0) work with the results = model('tcp://127.0.0.1:8888'). Because the TCP stream is working but I can't open a window to see what it's detecting. Here is my code: import cv2 def RGB(event, x, y, flags, param): cap = cv2.VideoCapture(0) my_file = open("coco.txt", "r") count=0 tracker=Tracker() cy1=250 offset=6 vh_down={} while True:
cap.release() |
Beta Was this translation helpful? Give feedback.
-
I have a doubt regarding the YOLO OBB models. Are the result.obb.xyxyxyxy array of values considered as rotated rectangles or a polygon with four points?? |
Beta Was this translation helpful? Give feedback.
-
Hey @glenn-jocher , I have a question related to threading on GPU, when I run this code on command prompt the cursor output is blinking without giving any output, without any error also on nvidia rtx a5000 24gb ram, when I run with 2 threads it is giving the output. Suppose if I'm increasing the threads like this I'm not getting the console output what is the reason for this and how to overcome this issue? Is this the problem with code or GPU or ultralytics ? import torch def model_load():
model_load() def fun1(): def fun2(): def fun3(): if name=="main":
|
Beta Was this translation helpful? Give feedback.
-
If I want to run YOLO detection algorithms for different tasks in a program, should I use multithreading or multiprocessing? As far as I know, multiprocessing is good at handling CPU intensive computing, but the tutorial provided in the article is about multithreading. How should I choose? |
Beta Was this translation helpful? Give feedback.
-
In multi stream video detection, there is usually a demand for increasing or decreasing video streams. Is there a good way to change the prediction edge for YOLOv8 prediction in this situation? Is there a better way to detect the need to interrupt and then load new data and restart? |
Beta Was this translation helpful? Give feedback.
-
Hello, I have 2 questions.
|
Beta Was this translation helpful? Give feedback.
-
Hello, how can I get the mask coordinates for each detected object? I want to make the detected object the ROI and with the help of mask coordinates I want to make other part as black and leave only ROI for further work. This is the code I wrote import cv2 results = model(img_path, imgsz=640, conf=0.25, iou=0.9, retina_masks=True) # return a list of Results objects orig_img = cv2.imread(img_path) for mask, box in zip(masks.xyn, boxes.xyxy):
|
Beta Was this translation helpful? Give feedback.
-
For predictions, I am getting the following
Can the difference between |
Beta Was this translation helpful? Give feedback.
-
Hello, I'm working on YOLOv8 and have some questions. When I use the predict mode, I can obtain inference time of each images. However, the deviation of the inference times is too large. And if I run YOLO on native, the deviation is small, but it gets bigger on a container or VM. I know there are many variables that can affect performance, but I've controlled most of them to ensure the experimental environment is consistent. Thanks for your help. |
Beta Was this translation helpful? Give feedback.
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
Hello, I would like to add a detection interval to the prediction input data, requiring only the results within the detection interval to be obtained, without considering those outside the interval. May I ask if this algorithm integrates this feature into the prediction? Or do you need to write it yourself? |
Beta Was this translation helpful? Give feedback.
-
modes/predict/
Discover how to use YOLOv8 predict mode for various tasks. Learn about different inference sources like images, videos, and data formats.
https://docs.ultralytics.com/modes/predict/
Beta Was this translation helpful? Give feedback.
All reactions