Closed alexiej closed 2 years ago
π Hello @alexiej, 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 Glenn Jocher at glenn.jocher@ultralytics.com.
Python>=3.6.0 with all requirements.txt installed including PyTorch>=1.7. To get started:
$ git clone https://github.com/ultralytics/yolov5
$ cd yolov5
$ 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 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.
@alexiej it seems like your TensorFlow version may be out of date. You should update TensorFlow, or you can also run YOLOv5 exports in a verified environment like Colab where everything works well.
@glenn-jocher I've got the same error on Colab (GPU and CPU version). :/. In MAC, and COLAB I use the same version 2.6.0
of tensorflow.
/usr/local/lib/python3.7/dist-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.26.7) or chardet (3.0.4) doesn't match a supported version!
RequestsDependencyWarning)
export: data=yolo5/data/coco128.yaml, weights=yolo5/best_yolo5s.pt, imgsz=[640, 640], batch_size=1, device=cpu, half=False, inplace=False, train=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=13, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=['tflite']
YOLOv5 π 732439b torch 1.9.0+cu111 CPU
[2021-10-12 12:12:25.539 5e560cd0409f:190 INFO utils.py:27] RULE_JOB_STOP_SIGNAL_FILENAME: None
[2021-10-12 12:12:25.590 5e560cd0409f:190 INFO profiler_config_parser.py:111] Unable to find config at /opt/ml/input/config/profilerconfig.json. Profiler is disabled.
Fusing layers...
Model Summary: 275 layers, 7064511 parameters, 0 gradients
PyTorch: starting from yolo5/best_yolo5s.pt (14.4 MB)
TensorFlow saved_model: starting export with tensorflow 2.6.0...
from n params module arguments
0 -1 1 3520 models.common.Focus [3, 32, 3]
2021-10-12 12:12:29.578868: E tensorflow/stream_executor/cuda/cuda_driver.cc:271] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2021-10-12 12:12:29.578937: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (5e560cd0409f): /proc/driver/nvidia/version does not exist
TensorFlow saved_model: export failure: no matching TensorFlow activation found for SiLU()
TensorFlow Lite: starting export with tensorflow 2.6.0...
TensorFlow Lite: export failure: 'NoneType' object has no attribute 'call'
Export complete (4.21s)
Results saved to /content/model-training/src/yolo5
Visualize with https://netron.app
The SiLU layer I found is: Maybe it should be torch.nn.SiLU
# SiLU https://arxiv.org/pdf/1606.08415.pdf ---
class SiLU(nn.Module): # export-friendly version of nn.SiLU()
@staticmethod
def forward(x):
return x * torch.sigmoid(x)
When I comment in export.py
line: 385
if isinstance(m.act, nn.SiLU):
# m.act = SiLU()
print("ACTIVATION", m.act)
The model was exported without issues. I need to verify if it works as original, but I think this was the problem of the export.
@alexiej Colab export to TFLite works correctly for me, I'm not able to reproduce your issue:
We've created a few short guidelines below to help users provide what we need in order to get started investigating a possible problem.
When asking a question, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This is referred to by community members as creating a minimum reproducible example. Your code that reproduces the problem should be:
In addition to the above requirements, for Ultralytics to provide assistance your code should be:
git pull
or git clone
a new copy to ensure your problem has not already been resolved by previous commits.If you believe your problem meets all of the above criteria, please close this issue and raise a new one using the π Bug Report template and providing a minimum reproducible example to help us better understand and diagnose your problem.
Thank you! π
π Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
Access additional YOLOv5 π resources:
Access additional Ultralytics β‘ resources:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLOv5 π and Vision AI β!
βQuestion
How to export the trained model to .tflite ?
Additional context
I've tried this instruction:
python export.py --weights yolo5/best_yolo5s.pt --include tflite
But I've got error:
I tried found what SiLU() is, and it should work properly, but I've got errror.