Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem in predict yolov8 #12162

Open
1 task done
antigravity233 opened this issue May 11, 2024 · 2 comments
Open
1 task done

problem in predict yolov8 #12162

antigravity233 opened this issue May 11, 2024 · 2 comments
Labels
question Further information is requested

Comments

@antigravity233
Copy link

antigravity233 commented May 11, 2024

Search before asking

Question

Hello, i want predict my video in vehicle counting in jupyter notebook by follow tutorial in youtube and face this problem in
python predict.py model='best.pt' source='test4.mp4'
youtube link:https://www.youtube.com/watch?v=nkptX_vXJKo

[2024-05-11 13:55:22,816][root.tracker][INFO] - Loading weights from deep_sort_pytorch/deep_sort/deep/checkpoint/ckpt.t7... Done!

Ultralytics YOLOv8.2.12 🚀 Python-3.11.5 torch-2.3.0+cpu CPU (13th Gen Intel Core(TM) i5-13450HX)
Model summary (fused): 268 layers, 43614318 parameters, 0 gradients, 164.9 GFLOPs
Error executing job with overrides: ["model='best.pt'", "source='test4.mp4'"]

Traceback (most recent call last):
File "C:\Users\kingy\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\detect\predict.py", line 250, in predict
predictor()
File "C:\Users\kingy\anaconda3\Lib\site-packages\ultralytics\engine\predictor.py", line 168, in call
return list(self.stream_inference(source, model, *args, **kwargs)) # merge list of Result into one
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\kingy\anaconda3\Lib\site-packages\torch\utils_contextlib.py", line 35, in generator_context
response = gen.send(None)
^^^^^^^^^^^^^^
File "C:\Users\kingy\anaconda3\Lib\site-packages\ultralytics\engine\predictor.py", line 220, in stream_inference
self.setup_source(source if source is not None else self.args.source)
File "C:\Users\kingy\anaconda3\Lib\site-packages\ultralytics\engine\predictor.py", line 182, in setup_source
self.imgsz = check_imgsz(self.args.imgsz, stride=self.model.stride, min_dim=2) # check image size
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\kingy\anaconda3\Lib\site-packages\ultralytics\utils\checks.py", line 147, in check_imgsz
raise TypeError(
TypeError: 'imgsz=[640, 640]' is of invalid type ListConfig. Valid imgsz types are int i.e. 'imgsz=640' or list i.e. 'imgsz=[640,640]'

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

Additional

No response

@antigravity233 antigravity233 added the question Further information is requested label May 11, 2024
Copy link

👋 Hello @antigravity233, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.

Install

Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

pip install ultralytics

Environments

YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

Ultralytics CI

If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

@glenn-jocher
Copy link
Member

@antigravity233 hello! It seems like there's an issue with how the image size (imgsz) is being specified. Based on the error message, you should double-check the format of the imgsz parameter in your prediction command.

From the error:

TypeError: 'imgsz=[640, 640]' is of invalid type ListConfig. Valid imgsz types are int i.e. 'imgsz=640' or list i.e. 'imgsz=[640,640]'

It suggests that the format should either be a single integer or a properly formatted list. Here’s an example of how you can format your command correctly:

python predict.py model='best.pt' source='test4.mp4' imgsz=640

or

python predict.py model='best.pt' source='test4.mp4' imgsz=[640,640]

Try adjusting this parameter, and it should resolve the issue you’re encountering. If the problem persists, ensure your model file best.pt is correctly pathed and accessible. Happy coding! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants