-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
关于调用推理代码块遇到的与一些问题 #2207
Comments
👋 Hello @Pandoravirus-N-T, thank you for your interest in YOLOv3 🚀! 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 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. RequirementsPython>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started: git clone https://github.com/ultralytics/yolov3 # clone
cd yolov3
pip install -r requirements.txt # install EnvironmentsYOLOv3 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv3 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv3 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit. Introducing YOLOv8 🚀We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀! Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects. Check out our YOLOv8 Docs for details and get started with: pip install ultralytics |
您好!👋 看起来您在尝试通过 确保您正在使用的Torch版本与YOLOv3兼容。对于这个具体的问题,建议使用以下代码示例正确加载模型: import torch
# 确保模型名称是正确的
model = torch.hub.load('ultralytics/yolov3', 'yolov3', pretrained=True) 如果您仍然遇到问题,请参考我们的官方文档 https://docs.ultralytics.com/ 获取更多帮助和指导。 祝编码愉快!如果有进一步的问题,我们一直在这里帮助您。 |
你好这是我的代码 Modelmodel = torch.hub.load("ultralytics/yolov3", "yolov3", trust_repo=True) Imagesimg = r"results\test.png" # or file, Path, PIL, OpenCV, numpy, list Inferenceresults = model(img) Resultsresults.print() # or .show(), .save(), .crop(), .pandas(), etc. |
您好!😊 遇到的问题可能是由于尝试用 确保模型正确加载,后续再用本地权重更新模型,可以使用以下代码: import torch
# 正确加载模型
model = torch.hub.load('ultralytics/yolov3', 'yolov3', pretrained=True, trust_repo=True)
# 加载本地权重文件(如果你有YOLOv3的权重,并希望用它来更新模型)
weights_path = "path/to/your/yolov3-tiny.pt" # 请确保这里的路径是正确的
model.load_state_dict(torch.load(weights_path)) 注意,请替换 如果您要处理的是本地图片文件,可以这样使用: img_path = "path/to/your/test.png" # 确保这里的路径是正确的
results = model(img_path)
results.print() # 或其他结果处理方式,如.show(), .save()等 希望这能帮到您!如果仍有疑问,请随时向我们反馈。👍 |
按您的方法修改后还是报错 正确加载模型model = torch.hub.load('ultralytics/yolov3', 'yolov3', pretrained=True, trust_repo=True) 加载本地权重文件(如果你有YOLOv3的权重,并希望用它来更新模型)weights_path = r“\yolov3-tiny.pt" # 请确保这里的路径是正确的 |
您好!😊 看起来问题仍然存在,可能是因为torch.hub在查找模型时遇到了一些困难。这种情况下,一个可行的解决方案是直接从GitHub克隆YOLOv3的仓库,并使用本地版本运行模型。这样可以避开
下面的代码示例假设您已经将YOLOv3仓库克隆到本地,并在相应的环境中运行: import torch
from models import * # 确保这是从您克隆的YOLOv3仓库中导入的
from utils import * # 同上
# 初始化模型
model = Darknet('path/to/your/yolov3.cfg').cuda() # 配置文件路径
model.load_weights('path/to/your/yolov3-tiny.pt') # 权重文件路径
# 加载图片
img_path = 'path/to/your/test.png'
img = load_images(img_path) # 使用YOLOv3仓库中的utils函数或自定义的加载图片方法
# 推理
results = model(img)
results.print() # 或使用其他方式处理结果 请确保替换所有的 希望这个方法对您有所帮助!如果还有其他问题,请随时告诉我们。 |
嗯好的,谢谢作者您的答复。我在下载模型和参数时发现都是v5的模型,影响吗,因为我的python解释器是3.7版本的 |
您好!😊 非常高兴能帮到您。使用v5模型在Python 3.7上是没问题的,只要确保您的环境中安装了兼容的Torch版本即可。YOLOv5是YOLO系列中的最新版,提供了许多改进和新功能,应该能够很好地满足您的需求。 如果您的项目特定需要使用YOLOv3并且您已经下载了YOLOv5的模型,建议您访问YOLOv3的GitHub页面或使用YOLOv3的直接下载链接来获取YOLOv3模型和权重文件。 祝您编码愉快!如果还有其他问题,请随时联系。 |
Search before asking
YOLOv3 Component
No response
Bug
D:\anaconda\envs\master1\lib\site-packages\torch\hub.py:268: UserWarning: You are about to download and run code from an untrusted repository. In a future release, this won't be allowed. To add the repository to your trusted list, change the command to {calling_fn}(..., trust_repo=False) and a command prompt will appear asking for an explicit confirmation of trust, or load(..., trust_repo=True), which will assume that the prompt is to be answered with 'yes'. You can also use load(..., trust_repo='check') which will only prompt for confirmation if the repo is not already trusted. This will eventually be the default behaviour
"You are about to download and run code from an untrusted repository. In a future release, this won't "
Downloading: "https://github.com/ultralytics/yolov3/zipball/master" to C:\Users\Lenovo/.cache\torch\hub\master.zip
Traceback (most recent call last):
File "C:\Users\Lenovo\Desktop\xin\KinD-master\evaluate.py", line 118, in
model = torch.hub.load("ultralytics/yolov3", "yolov3") # or yolov5n - yolov5x6, custom
File "D:\anaconda\envs\KinD-master1\lib\site-packages\torch\hub.py", line 542, in load
model = _load_local(repo_or_dir, model, *args, **kwargs)
File "D:\anaconda\envs\KinD-master1\lib\site-packages\torch\hub.py", line 571, in _load_local
entry = _load_entry_from_hubconf(hub_module, model)
File "D:\anaconda\envs\KinD-master1\lib\site-packages\torch\hub.py", line 321, in _load_entry_from_hubconf
raise RuntimeError('Cannot find callable {} in hubconf'.format(model))
RuntimeError: Cannot find callable yolov3 in hubconf
Environment
用的pyton3.7版本
Minimal Reproducible Example
No response
Additional
是不是这个路径出了一些问题呀作者,期待您的回复
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: