Commit Graph

91 Commits (813eba85b266fe46b0ac02a62fce8b25e3eeabac)

Author SHA1 Message Date
Cedric Perauer 7926afccde
Add `--half` support for FP16 CoreML exports with ()
* 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 () 2022-04-15 21:48:52 +02:00
Glenn Jocher 2da2466168
Fix EdgeTPU output directory ()
* 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 ()
No longer needed.
2022-04-12 14:57:50 +02:00
Glenn Jocher 3bb233a7fb
Add ONNX export metadata () 2022-04-09 13:27:49 +02:00
Glenn Jocher 446e6f563a
Rename 'MacOS' to 'macOS' () 2022-04-08 23:05:15 +02:00
Glenn Jocher d257c75c84
Update export.py ()
* 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 ()
* 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` ()
* 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 () 2022-04-03 22:51:11 +02:00
Glenn Jocher 05cf0d1a44
Export single output only ()
* 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()` ()
* Update

* Update time_limit
2022-04-03 18:45:05 +02:00
Glenn Jocher 734ab033fd
SavedModel TF Serve Fix ()
* 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 ()
* CLI fire prep updates

* revert unintentional TF export change
2022-03-31 17:11:43 +02:00
Jirka Borovec c3d5ac151e
precommit: yapf ()
* 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 ()
* 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 () 2022-03-18 12:29:24 +01:00
Glenn Jocher 932dc78496
YOLOv5 Export Benchmarks for GPU ()
* 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 ()
* 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 ()
* 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 ()
* Assert engine precision 

* Default to FP32 inputs for TensorRT engines

* Default to FP16 TensorRT exports 

* Remove wrong line 

* Automatically adjust detect.py input precision 

* Automatically adjust val.py input precision 

* 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 ()
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 ()
* Use `export_formats()` in export.py

* list fix
2022-02-19 16:08:33 +01:00
Jiacong Fang 66e5d794c7
Fix TF exports >= 2GB ()
* 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 ()
* 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):` ()
* 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 ()
* 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 () 2022-02-04 00:04:06 +01:00
Glenn Jocher 8d05716b66
Edge TPU compiler `sudo` fix ()
* 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 ()
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 ()
* 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 ()
* Improved `export.py` usage examples

* Cleanup
2022-02-01 22:06:29 +01:00
Glenn Jocher 750c42e43e
`export.py` automatic `forward_export` ()
* `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 ()
* `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 ()
* TensorRT `assert im.device.type != 'cpu'` on export

* Update export.py
2022-01-18 13:52:25 -10:00
Glenn Jocher fd55271c04
Console corrupted -> corrupt ()
* Console corrupted -> corrupt 

Minor style changes.

* Update export.py
2022-01-18 10:49:26 -10:00
Glenn Jocher 80473a6551
Update `export.py` with Detect, Validate usages () 2022-01-12 15:48:40 -10:00
Jinwoong Yoo 9b13a594e9
Fix `cmd` string on `tfjs` export ()
* Fix cmd string on tfjs export

* Cleanup

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-01-09 20:40:47 -10:00
Glenn Jocher 6865d19a92
TensorRT 7 export fix () 2022-01-07 09:31:17 -08:00
Glenn Jocher f80c463010
Attempt `edgetpu-compiler` autoinstall ()
* Attempt `edgetpu-compiler` autoinstall

Attempt to install edgetpu-compiler dependency if missing on Linux.

* Update export.py

* Update export.py
2022-01-05 20:57:20 -08:00
Glenn Jocher b4ac3df6ff
Add `edgetpu_compiler` checks ()
* Add `edgetpu_compiler` checks

* Update export.py

* Update export.py

* Update export.py

* Update export.py

* Update export.py

* Update export.py
2022-01-05 14:55:04 -08:00
Glenn Jocher 00d7b97869
TFLite `--int8` 'flatbuffers==1.12' fix 2 ()
* TFLite `--int8` 'flatbuffers==1.12' fix 2

Reorganizes  fix to update before `tensorflow` import so no restart required.

* Update export.py
2022-01-05 13:34:36 -08:00
Glenn Jocher 8125ec5d42
TFLite `--int8` 'flatbuffers==1.12' fix ()
* TFLite `--int8` 'flatbuffers==1.12' fix

Temporary workaround for TFLite INT8 export.

* Update export.py

* Update export.py
2022-01-05 13:01:21 -08:00
Glenn Jocher 5402753a53
Edge TPU compiler comment ()
* Edge TPU compiler comment

* 7 to 8 fix
2022-01-04 19:36:12 -08:00
Glenn Jocher b5b56a3c88
Add CoreML inference ()
* Add Apple CoreML inference

* Cleanup
2022-01-04 17:49:09 -08:00
Glenn Jocher 7b31a531b4
Add `tensorrt>=7.0.0` checks ()
* Add `tensorrt>=7.0.0` checks

* Update export.py

* Update common.py

* Update export.py
2022-01-04 13:39:13 -08:00
imyhxy a2f4a1799b
TensorRT 7 `anchor_grid` compatibility fix ()
* fix: TensorRT 7 incompatiable

* Add comment

* Add if: else and comment

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-01-04 11:09:25 -08:00
Yin Rong fb839298a1
Fix TorchScript on mobile export ()
* fix export of TorchScript on mobile

* Cleanup

Co-authored-by: yinrong <yinrong@xiaomi.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-01-03 20:25:48 -08:00
Glenn Jocher 5bd6a97b18
Global export format sort ()
* Global export sort

* Cleanup
2022-01-03 20:08:15 -08:00