ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 30/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- jupyter-notebook, opencv, python, pytorch
- Ambito
- computer-vision
Direzione di ricerca
Inizia con il notebook “YOLOv8 object tracking + ByteTrack + Supervision” e riproduci il traceback in results = model(frame)[0] usando l’ambiente Python e Windows indicato. Segui la chiamata model(frame) fino al predictor Ultralytics installato e confrontalo con l’esempio attuale del notebook. Il lavoro è completato quando l’esempio supera questa chiamata senza il ValueError segnalato e visualizza il frame annotato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Search before asking
- I have searched the Roboflow Notebooks issues and found no similar bug report.
Notebook name
YOLOv8 object tracking + ByteTrack + Supervision
Bug
Traceback (most recent call last):
File "C:\Users\khars\PycharmProjects\Bytetrack\main.py", line 33, in
results = model(frame)[0] # Pass the frame as a list
File "C:\Users\khars\PycharmProjects\Bytetrack\venv\lib\site-packages\ultralytics\yolo\engine\model.py", line 58, in call
return self.predict(source, **kwargs)
File "C:\Users\khars\PycharmProjects\Bytetrack\venv\lib\site-packages\torch\utils_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "C:\Users\khars\PycharmProjects\Bytetrack\venv\lib\site-packages\ultralytics\yolo\engine\model.py", line 130, in predict
predictor.setup(model=self.model, source=source)
File "C:\Users\khars\PycharmProjects\Bytetrack\venv\lib\site-packages\ultralytics\yolo\engine\predictor.py", line 111, in setup
source = str(source or self.args.source)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Process finished with exit code 1
Environment
Local OS : Windows 11
python: 3.10.11
Minimal Reproducible Example
from ultralytics import YOLO
import cv2
import torch
from supervision.video.source import get_video_frames_generator
from supervision.notebook.utils import show_frame_in_notebook
from supervision.draw.color import ColorPalette
from supervision.tools.detections import Detections, BoxAnnotator
from supervision.video.sink import VideoSink
from supervision.video.dataclasses import VideoInfo
Load the YOLO model
MODEL = "yolov8x.pt"
model = YOLO(MODEL)
model.fuse()
source = "output5.mp4"
CLASS_NAMES_DICT = model.model.names
CLASS_ID = [0]
Generate video frames from the source
generator = get_video_frames_generator("output5.mp4")
iterator = iter(generator)
Initialize box annotator
box_annotator = BoxAnnotator(color=ColorPalette(), thickness=4, text_thickness=4, text_scale=2)
video_info = VideoInfo.from_video_path(source)
Get the first frame from the video
frame = next(iterator)
results = model(frame)[0] # Pass the frame as a list
detections = Detections(
xyxy=results.boxes.xyxy.cpu().numpy(),
confidence=results.boxes.conf.cpu().numpy(),
class_id=results.boxes.cls.cpu().numpy().astype(int)
)
labels = [
f"{CLASS_NAMES_DICT[class_id]} {confidence:0.2f}"
for _, confidence, class_id, tracker_id
in detections
]
frame = box_annotator.annotate(frame=frame, detections=detections, labels=labels)
show_frame_in_notebook(frame, (16,16))
Additional
I was following the roboflow tutorial from youtube and I faced this issue. I have tried many things search everywhere but not any success. I have also tried the new notebook but still the same error
Are you willing to submit a PR?
- Yes I'd like to help by submitting a PR!
- Lingua principale
- Jupyter Notebook
- Stelle
- 9.7k
- Fork
- 1.5k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di roboflow/notebooks
-
zero-shot-object-detection-with-grounding-dino.ipynb can't render correctlyForse già presa @rkrisa l’ha presa 146 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
-
Drone FPV Object DetectionApertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Minor Issue: The notebook tutorial is using the wrong model (yolov11s instead of RF-DETR)Forse già presa @BillionClaw l’ha presa 241 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 52/100
Tutte le issue di roboflow/notebooks
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
roboflow/supervision#2971 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
enhancement good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
MagneticResonanceImaging/MRIReco.jl#356 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
cleanlab/cleanvision#282 ·