Commit Graph

105 Commits (1dcb77499869d64e5dea7c5bd38357c92f5eff29)

Author SHA1 Message Date
Glenn Jocher c215878f11
YOLOv5 Apple Metal Performance Shader (MPS) support (#7878)
* Apple Metal Performance Shader (MPS) device support

Following https://pytorch.org/blog/introducing-accelerated-pytorch-training-on-mac/

Should work with Apple M1 devices with PyTorch nightly installed with command `--device mps`. Usage examples:
```bash
python train.py --device mps
python detect.py --device mps
python val.py --device mps
```

* Update device strategy to fix MPS issue
2022-05-24 13:34:32 +02:00
xylieong 27911dc824
OpenVINO metadata fix2 (#7954)
* Bug Fixed: OpenVINO metadata

* Bug Fixed: OpenVINO metadata

* Update export.py

* Update export.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-05-24 13:19:25 +02:00
Glenn Jocher 0dd66e2dc7
OpenVINO metadata fix (#7952)
* Rename OpenVINO meta.yaml to model name

* Rename OpenVINO meta.yaml to model name

* Rename OpenVINO meta.yaml to model name

* fix
2022-05-24 11:59:59 +02:00
xylieong a3a652c933
Add OpenVINO metadata to export (#7947)
* Write .yaml file when exporting model to openvino

Write .yaml file automatically when exporting model to openvino to be used during inference

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update export.py

* Update export.py

* Load metadata on inference

* Update common.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-05-24 11:30:36 +02:00
Glenn Jocher 547c89b3a0
Add `--keras` argument for TF exports (#7921)
Resolves https://github.com/ultralytics/yolov5/issues/7911#issuecomment-1133671255
2022-05-22 13:33:36 +02:00
Jaewon Lee fe1b503cbb
Removed shell=True from subprocess commands that require user inputs (#7875)
* Removed shell=True from subprocess commands that require user inputs. Also removed unused arguments

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added check=True

* Revert line add

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-05-19 11:49:13 +02:00
Glenn Jocher f00071416f
Refactor collections and fstrings (#7821)
* Update torch_utils.py

* Additional code refactoring

* tuples to sets

* Cleanup
2022-05-15 16:38:26 +02:00
Glenn Jocher 9d8ed37df7
Rename `utils/datasets.py` > `utils/dataloaders.py` (#7799) 2022-05-13 14:34:16 +02:00
Glenn Jocher d4ea61e043
FROM nvcr.io/nvidia/pytorch:22.04-py3 (#7680)
* FROM nvcr.io/nvidia/pytorch:22.04-py3

* Update Docker

* Update Docker

* Update Docker

* Update Docker

* Update TRT auto-install

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Cleanup

* Cleanup

* Cleanup cpu

* Cleanup cpu

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-05-03 13:47:30 -07:00
David Matos bff6e51bc4
Disallow `--dynamic` when `--half` is passed (#7669)
* disallow dynamic arg when half is given

* Update export.py

Co-authored-by: David Matos <david@track32.nl>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-05-02 09:00:24 -07:00
Duncan Moss 177da7f348
Add `--half` support for OpenVINO exports (#7615)
* feature(export): add half support for openvino models

* Update export.py

* Update export.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-04-27 17:29:59 -07:00
Glenn Jocher 1f1ec1c3e7
Restrict TRT autoinstall to Linux-only (#7549)
May partially resolve concerns in https://github.com/ultralytics/yolov5/pull/7537#discussion_r856843711
2022-04-23 09:36:36 -07:00
Glenn Jocher f62609eb52
Update check_requirements() with `cmds=()` argument (#7543) 2022-04-22 14:31:05 -07:00
Glenn Jocher cc1d7df03c
Autoinstall TensorRT if missing (#7537)
* Autoinstall TensorRT if missing

May resolve https://github.com/ultralytics/yolov5/issues/7464

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update export.py

* Update export.py

* Update export.py

* Update export.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-04-22 12:31:33 -07:00
Cedric Perauer 7926afccde
Add `--half` support for FP16 CoreML exports with (#7446)
* add fp16 for coreml using --half

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix

* Cleanup

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update export.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-04-16 18:00:50 +02:00
Glenn Jocher 3eefab1bb1
Remove `tensorrt` pip install check (#7439) 2022-04-15 21:48:52 +02:00
Glenn Jocher 2da2466168
Fix EdgeTPU output directory (#7399)
* Fix EdgeTPU output directory

Outputs to same directory as --weights

* Update export.py
2022-04-12 15:08:53 +02:00
Glenn Jocher 5333b55e74
Remove OpenVINO ONNX `opset<=12` check (#7398)
No longer needed.
2022-04-12 14:57:50 +02:00
Glenn Jocher 3bb233a7fb
Add ONNX export metadata (#7353) 2022-04-09 13:27:49 +02:00
Glenn Jocher 446e6f563a
Rename 'MacOS' to 'macOS' (#7349) 2022-04-08 23:05:15 +02:00
Glenn Jocher d257c75c84
Update export.py (#7301)
* Update export.py

Simplify code.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-04-05 21:21:57 +02:00
Glenn Jocher 5f97001ed4
Context manager `open(file) as f` fixes (#7289)
* Flask context manager `open()` fix

* Additional read context manager fixes
2022-04-05 12:54:25 +02:00
leeflix 8d0291f3af
Enable TensorFlow ops for `--nms` and `--agnostic-nms` (#7281)
* enable TensorFlow ops if flag --nms or --agnostic-nms is used

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update export.py

* Update export.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-04-05 11:33:08 +02:00
Glenn Jocher 8bc839ed8e
TorchScript single-output fix (#7261) 2022-04-03 22:51:11 +02:00
Glenn Jocher 05cf0d1a44
Export single output only (#7259)
* Update

* Update

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-04-03 21:29:20 +02:00
Glenn Jocher ffcbd8ca97
Export with official `nn.SiLU()` (#7256)
* Update

* Update time_limit
2022-04-03 18:45:05 +02:00
Glenn Jocher 734ab033fd
SavedModel TF Serve Fix (#7228)
* SavedModel TF Serve Fix

Fix for https://github.com/ultralytics/yolov5/issues/7205 proposed by @tylertroy

* Update export.py
2022-04-01 00:07:23 +02:00
Glenn Jocher 2c3221844b
CLI `fire` prep updates (#7229)
* CLI fire prep updates

* revert unintentional TF export change
2022-03-31 17:11:43 +02:00
Jirka Borovec c3d5ac151e
precommit: yapf (#5494)
* precommit: yapf

* align isort

* fix

# Conflicts:
#	utils/plots.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update setup.cfg

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update setup.cfg

* Update setup.cfg

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update wandb_utils.py

* Update augmentations.py

* Update setup.cfg

* Update yolo.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update val.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* simplify colorstr

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* val run fix

* export.py last comma

* Update export.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update hubconf.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* PyTorch Hub tuple fix

* PyTorch Hub tuple fix2

* PyTorch Hub tuple fix3

* Update setup

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-03-31 16:52:34 +02:00
Glenn Jocher e19f87eb4b
Sidestep `os.path.relpath()` Windows bug (#7158)
* Sidestep os.path.relpath() Windows bug

os.path.relpath() seems to have a major bug on Windows due to Windows horrible path handling. This fix attempts to sidestep the issue.

```
File "C:\Users\mkokg/.cache\torch\hub\ultralytics_yolov5_master\export.py", line 64, in
ROOT = Path(os.path.relpath(ROOT, Path.cwd())) # relative
File "C:\Users\mkokg\AppData\Local\Programs\Python\Python310\lib\ntpath.py", line 718, in relpath
raise ValueError("path is on mount %r, start on mount %r" % (
ValueError: path is on mount 'C:', start on mount 'D:'
```

* Update yolo.py

* Update yolo.py

* Update yolo.py

* Update export.py
2022-03-26 14:18:53 +01:00
Mrinal Jain 4effd064b1
Consistent saved_model output format (#7032) 2022-03-18 12:29:24 +01:00
Glenn Jocher 932dc78496
YOLOv5 Export Benchmarks for GPU (#6963)
* Add benchmarks.py GPU support

* Updates

* Updates

* Updates

* Updates

* Add --half

* Add TRT requirements

* Cleanup

* Add TF to warmup types

* Update export.py

* Update export.py

* Update benchmarks.py
2022-03-14 15:07:13 +01:00
Glenn Jocher 99de551f97
pt model to cpu on TF export 2022-03-14 12:41:06 +01:00
paradigm c13d4ce7ef
EdgeTPU optimizations (#6808)
* removed transpose op for better edgetpu support

* fix for training case

* enabled experimental new quantizer flag

* precalculate add and mul ops at compile time

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-03-12 16:15:09 +01:00
Glenn Jocher acc58c1dcf
Fix TRT `max_workspace_size` deprecation notice (#6856)
* Fix TRT `max_workspace_size` deprecation notice

* Update export.py

* Update export.py
2022-03-07 13:52:53 +01:00
DavidB 596de6d5a0
Default FP16 TensorRT export (#6798)
* Assert engine precision #6777

* Default to FP32 inputs for TensorRT engines

* Default to FP16 TensorRT exports #6777

* Remove wrong line #6777

* Automatically adjust detect.py input precision #6777

* Automatically adjust val.py input precision #6777

* Add missing colon

* Cleanup

* Cleanup

* Remove default trt_fp16_input definition

* Experiment

* Reorder detect.py if statement to after half checks

* Update common.py

* Update export.py

* Cleanup

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-03-06 21:21:16 +01:00
Louis Combaldieu b2adc7c39a
Fix export for 1-channel images (#6780)
Export failed for 1-channel input shape, 1-liner fix
2022-02-25 10:56:37 +01:00
Glenn Jocher de9c25b35e
Use `export_formats()` in export.py (#6705)
* Use `export_formats()` in export.py

* list fix
2022-02-19 16:08:33 +01:00
Jiacong Fang 66e5d794c7
Fix TF exports >= 2GB (#6292)
* Fix exporting saved_model: pb exceeds 2GB

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Replace TF v1.x API with TF v2.x API for saved_model export

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Clean up

* Remove lambda in tf.function()

* Revert "Remove lambda in tf.function()" to be compatible with TF v2.4

This reverts commit 46c7931f11dfdea6ae340c77287c35c30b9e0779.

* Fix for pre-commit.ci

* Cleanup1

* Cleanup2

* Backwards compatibility update

* Update common.py

* Update common.py

* Cleanup3

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-02-18 16:36:45 +01:00
Glenn Jocher a45e472358
YOLOv5 Export Benchmarks (#6613)
* Add benchmarks.py

* Update

* Add requirements

* Updates

* Updates

* Updates

* Updates

* Updates

* Updates

* dataset autodownload from root

* Update

* Redirect to /dev/null

* sudo --help

* Cleanup

* Add exports pd df

* Updates

* Updates

* Updates

* Cleanup

* dir handling fix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Cleanup

* Cleanup2

* Cleanup3

* Cleanup model_type

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-02-12 16:05:43 +01:00
Glenn Jocher 22da63e30f
Fix zero-export handling with `if any(f):` (#6569)
* Fix zero-export handling with `if any(f):`

Partial fix for https://github.com/ultralytics/yolov5/issues/6563

* Cleanup
2022-02-08 12:20:39 +01:00
Jirka Borovec cba4303d32
Fix 6 Flake8 issues (#6541)
* F541

* F821

* F841

* E741

* E302

* E722

* Apply suggestions from code review

* Update general.py

* Update datasets.py

* Update export.py

* Update plots.py

* Update plots.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-02-05 15:22:59 +01:00
Glenn Jocher 9bc72a3ac2
Edge TPU export 'list index out of range' fix (#6533) 2022-02-04 00:04:06 +01:00
Glenn Jocher 8d05716b66
Edge TPU compiler `sudo` fix (#6531)
* Edge TPU compiler sudo fix

Allows for auto-install of Edge TPU compiler on non-sudo systems like the YOLOv5 Docker image.

@kalenmike

* Update export.py

* Update export.py

* Update export.py
2022-02-03 20:40:09 +01:00
Glenn Jocher 4c40933266
Suppress export.run() TracerWarnings (#6499)
Suppresses warnings when calling export.run() directly, not just CLI python export.py.

Also adds Requirements examples for CPU and GPU backends
2022-02-01 23:52:50 +01:00
Glenn Jocher 842d049e1b
Suppress `torch.jit.TracerWarning` on export (#6498)
* Suppress torch.jit.TracerWarning

TracerWarnings can be safely ignored.

* Cleanup
2022-02-01 22:59:26 +01:00
Glenn Jocher 5e4ff195b2
Improved `export.py` usage examples (#6495)
* Improved `export.py` usage examples

* Cleanup
2022-02-01 22:06:29 +01:00
Glenn Jocher 750c42e43e
`export.py` automatic `forward_export` (#6352)
* `export.py` automatic `forward_export`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-19 12:24:40 -10:00
Glenn Jocher 0cf932bf63
`export.py` return exported files/dirs (#6343)
* `export.py` return exported files/dirs

* Path to str
2022-01-18 15:18:23 -10:00
Glenn Jocher e2e95b2d8e
TensorRT `assert im.device.type != 'cpu'` on export (#6340)
* TensorRT `assert im.device.type != 'cpu'` on export

* Update export.py
2022-01-18 13:52:25 -10:00