ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
51.26k stars 16.44k forks source link

Sample script doesn't work #8649

Closed Russ76 closed 2 years ago

Russ76 commented 2 years ago

Search before asking

YOLOv5 Component

No response

Bug

(base) russ@russ-HP-Pavilion-Laptop-15-eh0xxx:~/yolov5$ python3 first_script.py Traceback (most recent call last): File "/home/russ/yolov5/first_script.py", line 4, in model = torch.hub.load('ultralytics/yolov5') # or yolov5n - yolov5x6, custom TypeError: load() missing 1 required positional argument: 'model' (base) russ@russ-HP-Pavilion-Laptop-15-eh0xxx:~/yolov5$ python3 first_script.py Traceback (most recent call last): File "/home/russ/yolov5/first_script.py", line 4, in model = torch.hub.load('ultralytics/yolo5x6') # or yolov5n - yolov5x6, custom TypeError: load() missing 1 required positional argument: 'model' (base) russ@russ-HP-Pavilion-Laptop-15-eh0xxx:~/yolov5$ python3 first_script1.pyTraceback (most recent call last): File "/home/russ/yolov5/first_script1.py", line 4, in model = torch.hub.load('https://ultralytics.com/yolo5x6') # or yolov5n - yolov5x6, custom TypeError: load() missing 1 required positional argument: 'model'

This was from loading the basic sample script. Is there an extension to the model name that's missing? Or a folder prefix? This is on Ubuntu 20.04, just installed repo from Yolov5 clean this morning and did the "install requirements.txt" routine. Do I need to modify .bashrc?

Environment

Yolov5 Python 3.9.12 Ubuntu 20.04 Laptop with AMD Ryzen 7

Minimal Reproducible Example

import torch

Model

model = torch.hub.load('https://ultralytics.com/yolo5x6') # or yolov5n - yolov5x6, custom

Images

img = 'https://ultralytics.com/images/zidane.jpg' # or file, Path, PIL, OpenCV, numpy, list

Inference

results = model(img)

Results

results.print() # or .show(), .save(), .crop(), .pandas(), etc.

Additional

No response

Are you willing to submit a PR?

github-actions[bot] commented 2 years ago

👋 Hello @Russ76, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

For business inquiries or professional support requests please visit https://ultralytics.com or email support@ultralytics.com.

Requirements

Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

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

Status

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on macOS, Windows, and Ubuntu every 24 hours and on every commit.