Commit Graph

63 Commits (3f3852e2ff755275098c07fe3bf4d2bde103ab30)

Author SHA1 Message Date
Glenn Jocher 3f3852e2ff
Fix val.py Ensemble() (#7490) 2022-04-19 21:15:04 -07:00
HERIUN d876caab4d
Update val.py (#7478)
* Update val.py

is_coco doesn't work!! '/' -> os.sep!!

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

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

* Cleanup

* fix

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-19 15:40:06 -07:00
Glenn Jocher 406ee528f0
Loss and IoU speed improvements (#7361)
* Loss speed improvements

* bbox_iou speed improvements

* bbox_ioa speed improvements

* box_iou speed improvements

* box_iou speed improvements
2022-04-10 13:46:07 +02:00
Glenn Jocher 446e6f563a
Rename 'MacOS' to 'macOS' (#7349) 2022-04-08 23:05:15 +02:00
Glenn Jocher 245d6459a9
Add callbacks (#7315)
* Add `on_train_start()` callback

* Update

* Update
2022-04-06 17:23:34 +02:00
Glenn Jocher f735458987
Use `tqdm.auto` (#7311) 2022-04-06 12:20:24 +02:00
Glenn Jocher d2e7ba2a3a
val.py `--weights` and `--data` compatibility check (#7292)
Improved error messages for understanding of user error with val.py. May help https://github.com/ultralytics/yolov5/issues/7291
2022-04-05 14:23:15 +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 701e1177ac
Tensor initialization on device improvements (#6959)
* Update common.py speed improvements

Eliminate .to() ops where possible for reduced data transfer overhead. Primarily affects warmup and PyTorch Hub inference.

* Updates

* Updates

* Update detect.py

* Update val.py
2022-03-12 14:00:48 +01:00
Glenn Jocher c84dd27d62
New val.py `cuda` variable (#6957)
* New val.py `cuda` variable

Fix for ONNX GPU val.

* Update val.py
2022-03-12 12:57:08 +01:00
Glenn Jocher b94b59e199
DetectMultiBackend() `--half` handling (#6945)
* DetectMultiBackend() `--half` handling

* CI fixes

* rename .half to .fp16 to avoid conflict

* warmup fix

* val update

* engine update

* engine update
2022-03-11 16:31:52 +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
Glenn Jocher 4728840745
Update `--cache disk` deprecate `*_npy/` dirs (#6876)
* Updates

* Updates

* Updates

* Updates

* Updates

* Updates

* Updates

* Updates

* Updates

* Updates

* Cleanup

* Cleanup
2022-03-06 16:16:17 +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
greg2451 8fcdf3b60b
Fixing minor multi-streaming issues with TensoRT engine (#6504)
* Update batch-size in model.warmup() + indentation for logging inference results

* These changes are in response to PR comments

* [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-02-04 18:19:37 +01:00
Glenn Jocher f3085accd3
Enable ONNX `--half` FP16 inference (#6268)
* Enable ONNX ``--half` FP16 inference

* [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-11 10:13:17 -10:00
Glenn Jocher b5b56a3c88
Add CoreML inference (#6195)
* Add Apple CoreML inference

* Cleanup
2022-01-04 17:49:09 -08:00
Glenn Jocher 5bd6a97b18
Global export format sort (#6182)
* Global export sort

* Cleanup
2022-01-03 20:08:15 -08:00
Glenn Jocher 63a4d862aa
Add OpenVINO inference (#6179) 2022-01-03 15:41:26 -08:00
Glenn Jocher ec4b6dd2a3
Update export format docstrings (#6151)
* Update export documentation

* Cleanup

* Update export.py

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

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

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

* Update README.md

* Update README.md

* Update README.md

* Update train.py

* Update train.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-02 16:09:45 -08:00
Jiacong Fang d95978a562
Add EdgeTPU support (#3630)
* Add models/tf.py for TensorFlow and TFLite export

* Set auto=False for int8 calibration

* Update requirements.txt for TensorFlow and TFLite export

* Read anchors directly from PyTorch weights

* Add --tf-nms to append NMS in TensorFlow SavedModel and GraphDef export

* Remove check_anchor_order, check_file, set_logging from import

* Reformat code and optimize imports

* Autodownload model and check cfg

* update --source path, img-size to 320, single output

* Adjust representative_dataset

* Put representative dataset in tfl_int8 block

* detect.py TF inference

* weights to string

* weights to string

* cleanup tf.py

* Add --dynamic-batch-size

* Add xywh normalization to reduce calibration error

* Update requirements.txt

TensorFlow 2.3.1 -> 2.4.0 to avoid int8 quantization error

* Fix imports

Move C3 from models.experimental to models.common

* Add models/tf.py for TensorFlow and TFLite export

* Set auto=False for int8 calibration

* Update requirements.txt for TensorFlow and TFLite export

* Read anchors directly from PyTorch weights

* Add --tf-nms to append NMS in TensorFlow SavedModel and GraphDef export

* Remove check_anchor_order, check_file, set_logging from import

* Reformat code and optimize imports

* Autodownload model and check cfg

* update --source path, img-size to 320, single output

* Adjust representative_dataset

* detect.py TF inference

* Put representative dataset in tfl_int8 block

* weights to string

* weights to string

* cleanup tf.py

* Add --dynamic-batch-size

* Add xywh normalization to reduce calibration error

* Update requirements.txt

TensorFlow 2.3.1 -> 2.4.0 to avoid int8 quantization error

* Fix imports

Move C3 from models.experimental to models.common

* implement C3() and SiLU()

* Add TensorFlow and TFLite Detection

* Add --tfl-detect for TFLite Detection

* Add int8 quantized TFLite inference in detect.py

* Add --edgetpu for Edge TPU detection

* Fix --img-size to add rectangle TensorFlow and TFLite input

* Add --no-tf-nms to detect objects using models combined with TensorFlow NMS

* Fix --img-size list type input

* Update README.md

* Add Android project for TFLite inference

* Upgrade TensorFlow v2.3.1 -> v2.4.0

* Disable normalization of xywh

* Rewrite names init in detect.py

* Change input resolution 640 -> 320 on Android

* Disable NNAPI

* Update README.me --img 640 -> 320

* Update README.me for Edge TPU

* Update README.md

* Fix reshape dim to support dynamic batching

* Fix reshape dim to support dynamic batching

* Add epsilon argument in tf_BN, which is different between TF and PT

* Set stride to None if not using PyTorch, and do not warmup without PyTorch

* Add list support in check_img_size()

* Add list input support in detect.py

* sys.path.append('./') to run from yolov5/

* Add int8 quantization support for TensorFlow 2.5

* Add get_coco128.sh

* Remove --no-tfl-detect in models/tf.py (Use tf-android-tfl-detect branch for EdgeTPU)

* Update requirements.txt

* Replace torch.load() with attempt_load()

* Update requirements.txt

* Add --tf-raw-resize to set half_pixel_centers=False

* Remove android directory

* Update README.md

* Update README.md

* Add multiple OS support for EdgeTPU detection

* Fix export and detect

* Export 3 YOLO heads with Edge TPU models

* Remove xywh denormalization with Edge TPU models in detect.py

* Fix saved_model and pb detect error

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

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

* Fix pre-commit.ci failure

* Add edgetpu in export.py docstring

* Fix Edge TPU model detection exported by TF 2.7

* Add class names for TF/TFLite in DetectMultibackend

* Fix assignment with nl in TFLite Detection

* Add check when getting Edge TPU compiler version

* Add UTF-8 encoding in opening --data file for Windows

* Remove redundant TensorFlow import

* Add Edge TPU in export.py's docstring

* Add the detect layer in Edge TPU model conversion

* Default `dnn=False`

* Cleanup data.yaml loading

* Update detect.py

* Update val.py

* Comments and generalize data.yaml names

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: unknown <fangjiacong@ut.cn>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-12-31 09:47:52 -08:00
iumyx2612 92a7391039
Add `--workers 8` argument to val.py (#5857)
* Update val.py

Add an option to choose number of workers if not called by train.py

* Update comment

* 120 char line width

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-12-02 16:49:50 +01:00
Glenn Jocher 00e308f7be
Update TorchScript suffix to `*.torchscript` (#5856) 2021-12-02 16:06:45 +01:00
Glenn Jocher fcd180d336
Refactor new `model.warmup()` method (#5810)
* Refactor new `model.warmup()` method

* Add half
2021-11-27 12:29:45 +01:00
Glenn Jocher 7c6bae0ae6
Remove NCOLS from tqdm (#5804)
* Remove NCOLS from tqdm

* [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>
2021-11-26 13:37:28 +01:00
imyhxy 7a39803476
Export, detect and validation with TensorRT engine file (#5699)
* Export and detect with TensorRT engine file

* Resolve `isort`

* Make validation works with TensorRT engine

* feat: update export docstring

* feat: change suffix from *.trt to *.engine

* feat: get rid of pycuda

* feat: make compatiable with val.py

* feat: support detect with fp16 engine

* Add Lite to Edge TPU string

* Remove *.trt comment

* Revert to standard success logger.info string

* Fix Deprecation Warning

```
export.py:310: DeprecationWarning: Use build_serialized_network instead.
  with builder.build_engine(network, config) as engine, open(f, 'wb') as t:
```

* Revert deprecation warning fix

@imyhxy it seems we can't apply the deprecation warning fix because then export fails, so I'm reverting my previous change here.

* Update export.py

* Update export.py

* Update common.py

* export onnx to file before building TensorRT engine file

* feat: triger ONNX export failed early

* feat: load ONNX model from file

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-11-22 14:58:07 +01:00
Glenn Jocher 36d12a500e
Explicitly compute TP, FP in val.py (#5727) 2021-11-20 01:04:56 +01:00
Glenn Jocher 30bc089cbb
Update val.py `speed` and `study` tasks (#5608)
Accepts all arguments now by default resolving https://github.com/ultralytics/yolov5/issues/5600
2021-11-10 16:48:38 +01:00
Glenn Jocher 61c50199a2
Update train, val `tqdm` to fixed width (#5367)
* Update tqdm for fixed width

* Update val.py

* Update val.py

* Try ncols= in train.py

* NCOLS

* NCOLS

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

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

* bar_format

* position 0 leave true

* exp0

* auto

* auto

* Cleanup

* Cleanup

* Cleanup

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-11-10 15:47:38 +01:00
Glenn Jocher 3883261143
New `DetectMultiBackend()` class (#5549)
* New `DetectMultiBackend()` class

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

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

* pb to pt fix

* Cleanup

* explicit apply_classifier path

* Cleanup2

* Cleanup3

* Cleanup4

* Cleanup5

* Cleanup6

* val.py MultiBackend inference

* warmup fix

* to device fix

* pt fix

* device fix

* Val cleanup

* COCO128 URL to assets

* half fix

* detect fix

* detect fix 2

* remove half from DetectMultiBackend

* training half handling

* training half handling 2

* training half handling 3

* Cleanup

* Fix CI error

* Add torchscript _extra_files

* Add TorchScript

* Add CoreML

* CoreML cleanup

* New `DetectMultiBackend()` class

* pb to pt fix

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

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

* Cleanup

* explicit apply_classifier path

* Cleanup2

* Cleanup3

* Cleanup4

* Cleanup5

* Cleanup6

* val.py MultiBackend inference

* warmup fix

* to device fix

* pt fix

* device fix

* Val cleanup

* COCO128 URL to assets

* half fix

* detect fix

* detect fix 2

* remove half from DetectMultiBackend

* training half handling

* training half handling 2

* training half handling 3

* Cleanup

* Fix CI error

* Add torchscript _extra_files

* Add TorchScript

* Add CoreML

* CoreML cleanup

* revert default to pt

* Add Usage examples

* Cleanup val

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-11-09 16:45:02 +01:00
Glenn Jocher 0de4a9c35d
Add `--conf-thres` >> 0.001 warning (#5567)
Partially addresses invalid mAPs at higher confidence threshold issue https://github.com/ultralytics/yolov5/issues/1466.
2021-11-08 16:04:31 +01:00
Jirka Borovec 0155548384
precommit: isort (#5493)
* precommit: isort

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

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

* Update isort config

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

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

* Update name

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>
2021-11-04 17:24:25 +01:00
Glenn Jocher 5866646cc8
Fix float zeros format (#5491)
* Fix float zeros format

* 255 to integer
2021-11-03 23:36:53 +01:00
Glenn Jocher 7b1f7aec46
Update `get_loggers()` (#4854)
* Update `set_logging()`

* Update export.py

* pre-commit fixes

* Update LoadImages

* Update LoadStreams

* Update print_args

* Single LOGGER definition

* yolo.py fix

Co-authored-by: pre-commit <pre-commit@example.com>
2021-11-01 18:22:13 +01:00
Malte Lorbach 153873e9e4
Fix `ROOT` as relative path (#5129)
* use os.path.relpath instead of relative_to

* use os.path.relpath instead of relative_to

* Remove os.path from val.py

* Remove os.path from train.py

* Update detect.py import to os

* Update export.py import to os

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-10-11 09:47:24 -07:00
Glenn Jocher 7d37b3c52e
Update val.py `pad = 0.0 if task == speed else 0.5` (#5121)
* Update val.py `pad = 0.0 if task == speed else 0.5`

* Cleanup
2021-10-10 23:20:42 -07:00
Glenn Jocher ba4b79de8b
Update val.py `--speed` and `--study` usages (#5120) 2021-10-10 21:15:28 -07:00
Glenn Jocher 4f9718abe6
Pass `--device` for `--task study` (#5118) 2021-10-10 15:07:26 -07:00
Glenn Jocher b0ade48457
Fix missing `opt.device` on `--task study` (#5031) 2021-10-02 17:55:55 -07:00
Glenn Jocher 4e04cb0dc8
Allow YOLOv5 execution from arbitrary `cwd` (#4954)
* Allow YOLOv5 execution from arbitrary `cwd`

* Fix str bugs
2021-09-27 17:40:20 -07:00
Glenn Jocher d856c48298
Validate `best.pt` on train end (#4889)
* Validate best.pt on train end

* 0.7 iou for COCO only

* pass callbacks

* active model.float() if not half

* print Validating best.pt...

* add newline
2021-09-26 11:54:53 -07:00
Glenn Jocher 4c839eeb10
Simplify `check_requirements()` usage (#4855)
* Simplify `check_requirements()` usage

* remove assert, print()
2021-09-18 18:34:30 +02:00
Glenn Jocher 4d1a2ac87e
Update `sys.path.append(str(ROOT))` (#4852)
* Update `sys.path.append(str(ROOT))`

* Cleanup
2021-09-18 15:02:08 +02:00
Glenn Jocher 3732f9ac8a
Refactor argparser printing to `print_args()` (#4850)
* Refactor argparser printing to `print_args()`

* Cleanup
2021-09-18 14:16:19 +02:00
Glenn Jocher 27a4736e96
Fix val.py study plot (#4831)
* Fix val.py study plot

* call plot_val_study

* Rename plot_study_txt to plot_val_study
2021-09-16 17:55:58 +02:00
Glenn Jocher c47be26f34
Replace `path.absolute()` with `path.resolve()` (#4763) 2021-09-11 22:46:33 +02:00
Glenn Jocher 7af1b4c266
Improved `detect.py` timing (#4741)
* Improved detect.py timing

* Eliminate 1 time_sync() call

* Inference-only time

* dash

* #Save section

* Cleanup
2021-09-10 14:34:09 +02:00
Glenn Jocher a2b3c71636
Add suffix checks (#4711)
* Add suffix checks

* Cleanup

* Cleanup2

* Cleanup3
2021-09-08 14:36:12 +02:00
Kalen Michael 2317f86ca4
Optimised Callback Class to Reduce Code and Fix Errors (#4688)
* added callbacks

* added back callback to main

* added save_dir to callback output

* reduced code count

* updated callbacks

* added default callback class to main, added missing parameters to on_model_save

* Glenn updates

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-09-07 18:32:15 +02:00