Closed lucasjinreal closed 4 years ago
@jinfagang thanks for the bug report! Hardswish() will be supported in ONNX 1.8, which is supposed to be officially released in the next few months. See https://github.com/onnx/onnx/issues/2728
In the meantime I believe your best option may be to export v2.0 LeakyReLU(0.1) models with pytorch 1.5.1 and onnx 1.7.
I alse got this issue when I use the model (pt file, trained on my cloud machine ) to detect on my desktop.
@jinfagang @Frank1126lin after reading the error again, I think you simply need to update your pytorch to 1.6 or higher. nn.Hardswish was introduced in 1.6.
@jinfagang @Frank1126lin after reading the error again, I think you simply need to update your pytorch to 1.6 or higher. nn.Hardswish was introduced in 1.6.
Yeah, after update torch and torchvison to 1.6, It works. And @glenn-jocher thank you so much.
I can not still clear the AttributeError MSG by python:3.8.5 pytorch:1.7.0
AttributeError: Can't get attribute 'Hardswish' on <module 'torch.nn.modules.activation' from 'C:\Users\user\anaconda3\envs\yolov5\lib\site-packages\torch\nn\modules\activation.py'>
@Yoshitsugi , thank you for your interest in YOLOv5! 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
- **Your custom data.** If your issue is not reproducible in one of our 3 common datasets ([COCO](https://github.com/ultralytics/yolov5/blob/master/data/coco.yaml), [COCO128](https://github.com/ultralytics/yolov5/blob/master/data/coco128.yaml), or [VOC](https://github.com/ultralytics/yolov5/blob/master/data/voc.yaml)) we can not debug it. Visit our [Custom Training Tutorial](https://docs.ultralytics.com/yolov5/tutorials/train_custom_data) 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](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) dependencies specified below. If in doubt, download Python 3.8.0 from https://www.python.org/, create a new [venv](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/), 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!
## Requirements
Python 3.8 or later with all [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) dependencies installed, including `torch>=1.6`. To install run:
```bash
$ 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.
Hi Glenn I have traced your instruction, but failed. yolov5new.txt yolov5new.txt
@Yoshitsugi use a verified environment, that's why we created them.
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
Hi Glenn I have changed from Windows 10 Python, torch environment to Google Colab, resulted great success!! Thanks for your greatest support!!!
@Yoshitsugi great! Unfortunately windows and conda can both be difficult environments for ML.
Hi Glenn your yolov5 is fit to colab, not to windows and conda. I believe some guy will challenge for conda environment for success, since your code is also written for conda environment.
@Yoshitsugi I can't speak for conda, as we don't use it or test on it, but Windows is fully supported. We run daily tests on all 3 operating systems including Windows of all core YOLOv5 functions, see below.
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.
@Yoshitsugi the latest windows results are here, from about 9 hours ago: https://github.com/ultralytics/yolov5/runs/1450815198?check_suite_focus=true
It is great! Tell me what kind of cpu for your test? Regards
@Yoshitsugi I'm not sure. This is the windows-latest
environment described here:
https://github.com/actions/virtual-environments
For google Colab, I have checked several code by you. However Test code I have tried and takes time. I understand your program has enormous contents, so I hesitate to proceed by windows. Maybe after I have got more capability for coding, I would like to try. I have tried yolov3 and it was successful. yolov4 was hard to run, since it requires visual studio and cmake. yolov5 looks partly successful supported by you. Thank you for very much! Regards
Great, I'm glad you find it useful!
Hi Glenn By the way, will you tell me how to recognize different photo other than Jidane.jpg by Colab yolov5? Since the Colab yolov5 is highly automated, I can not load different photo. Pls. advise
python detect.py --source anyphoto.jpg
Hi Glenn I have tried 'Kaggle Notebook with free GPU: https://www.kaggle.com/models/ultralytics/yolov5', resulting error MSG. Pls. advise. Kaggle_yolov5.txt
@Yoshitsugi thanks for spotting this. I will update the kaggle notebook.
In the meantime the image is in exp/, not exp0.
Hi Glenn I am trying to upload a new photo in exp/, but I can not find the folder in the google drive. Tell me how to upload a photo? Regards
Please ensure you're using the latest version of the YOLOv5 repository and check the error message for specific details. If the issue persists, try running the code in a fresh Kaggle environment.
AttributeError: Can't get attribute 'Hardswish' on <module 'torch.nn.modules.activation' from '/usr/local/lib/python3.6/dist-packages/torch/nn/modules/activation.py'>