Traceback (most recent call last):
File "D:/productivity/JetBrains/PyCharmProject/yolov3/detect.py", line 173, in
detect()
File "D:/productivity/JetBrains/PyCharmProject/yolov3/detect.py", line 33, in detect
model = attempt_load(weights, map_location=device) # load FP32 model
File "D:\productivity\JetBrains\PyCharmProject\yolov3\models\experimental.py", line 137, in attempt_load
model.append(torch.load(w, map_location=map_location)['model'].float().fuse().eval()) # load FP32 model
AttributeError: 'collections.OrderedDict' object has no attribute 'float'
how to solve it,plz
Hello @Zhang-Chao-China, 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 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://www.ultralytics.com or email Glenn Jocher at glenn.[email protected].
Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:
$ pip install -r requirements.txt
YOLOv3 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all YOLOv3 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv3 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.
@Zhang-Chao-China Hello, thank you for your interest in our work! This issue seems to lack the minimum requirements for a proper response, or is insufficiently detailed for us to help you. Please note that most technical problems are due to:
git clone version of this repo we can not debug it. Before going further run this code and verify your issue persists:$ git clone https://github.com/ultralytics/yolov5 yolov5_new # clone latest
$ cd yolov5_new
$ python detect.py # verify detection
# CODE TO REPRODUCE YOUR ISSUE HERE
Your custom data. If your issue is not reproducible in one of our 3 common datasets (COCO, COCO128, or VOC) we can not debug it. Visit our Custom Training Tutorial for guidelines on training your custom data. Examine train_batch0.jpg and test_batch0.jpg for a sanity check of your labels and images.
Your environment. If your issue is not reproducible in one of the verified environments below we can not debug it. If you are running YOLOv5 locally, verify your environment meets all of the requirements.txt dependencies specified below. If in doubt, download Python 3.8.0 from https://www.python.org/, create a new venv, and then install requirements.
If none of these apply to you, we suggest you close this issue and raise a new one using the Bug Report template, providing screenshots and minimum viable code to reproduce your issue. Thank you!
Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.6. To install run:
$ pip install -r requirements.txt
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are passing. These tests evaluate proper operation of basic YOLOv5 functionality, including training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu.
请问你解决了吗这个问题?我也遇到了同样的报错 @Zhang-Chao-China
@glenn-jocher it seems happens to yolov3 repo,when i see you update you train.py yesterday ,do you have a check???
@glenn-jocher it seems happens to yolov3 repo,when i see you update you train.py yesterday ,do you have a check???
+1
@Zhang-Chao-China @superXR @nanhui69 @xiezheng-cs @HomelessJayce it appears you may be trying to use the archive branch with a darknet-style *.cfg file. Master branch has been updated with YOLOv5 forward compatibility and is NOT backwards compatible any more. To run older darknet training commands please clone the archive branch. See README for instructions:
The ultralytics/yolov3 repository is now divided into two branches:
$ git clone https://github.com/ultralytics/yolov3 # master branch (default)
$ git clone -b archive https://github.com/ultralytics/yolov3 # archive branch
Also please note that archive branch yolov3.pt files are not forward compatible. The new master branch will auto-download any new model you need on first use if it does not find a file with the same name already in your directory. So for best results please clone a new version of the repo and let detect.py download new models.
Repository is verified working correctly today December 2nd 2020:

请问你解决了吗这个问题?我也遇到了同样的报错 @Zhang-Chao-China
我原来自己下载的权重,可能是版本老了,运行代码用代码自动下载的权重就好了
谢谢你的建议,我还没有解决,不过我已经打算使用最新的版本
在 2020-12-07 19:38:43,"ZhangChao" notifications@github.com 写道:
请问你解决了吗这个问题?我也遇到了同样的报错 @Zhang-Chao-China
我原来自己下载的权重,可能是版本老了,运行代码用代码自动下载的权重就好了
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
Also please note that archive branch yolov3.pt files are not forward compatible. The new master branch will auto-download any new model you need on first use if it does not find a file with the same name already in your directory. So for best results please clone a new version of the repo and let detect.py download new models.
Repository is verified working correctly today December 2nd 2020: