Commit Graph

414 Commits (d389840f66bb95c150d8c0e4d97759b07d21e821)

Author SHA1 Message Date
Glenn Jocher a0a4adf6de
Add PyTorch Hub `results.save(labels=False)` option (#7129)
Resolves https://github.com/ultralytics/yolov5/issues/388#issuecomment-1077121821
2022-03-24 11:31:22 +01:00
Glenn Jocher ecc2c7ba73
Remove named arguments where possible (#7105)
* Remove named arguments where possible

Speed improvements.

* Update yolo.py

* Update yolo.py

* Update yolo.py
2022-03-22 20:44:07 +01:00
Glenn Jocher 9b771a3e71
Revert "Update detect.py non-inplace with `y.tensor_split()` (#7062)" (#7074)
This reverts commit d5e363f29d.
2022-03-21 09:33:39 +01:00
Glenn Jocher 0529b77232
Update common.py lists for tuples (#7063)
Improved profiling.
2022-03-20 18:03:37 +01:00
Glenn Jocher d5e363f29d
Update detect.py non-inplace with `y.tensor_split()` (#7062) 2022-03-20 18:02:05 +01:00
Glenn Jocher f327eee614
Fix `check_anchor_order()` in pixel-space not grid-space (#7060)
* Update `check_anchor_order()`

Use mean area per output layer for added stability.

* Check in pixel-space not grid-space fix
2022-03-20 16:27:51 +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 2d45de617e
Model `ema` key backward compatibility fix (#6972)
Fix for older model loading issue in d3d9cbce22 (commitcomment-68622388)
2022-03-14 10:54:51 +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 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 52c1399fdc
DetectMultiBackend() return `device` update (#6958)
Fixes ONNX validation that returns outputs on CPU.
2022-03-12 13:16:29 +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
Glenn Jocher 84efa62b2d
Fix PyTorch Hub export inference shapes (#6949)
May resolve https://github.com/ultralytics/yolov5/issues/6947
2022-03-11 16:18:40 +01:00
Glenn Jocher 055e72af5b
Optimize PyTorch 1.11.0 compatibility update (#6933) 2022-03-10 12:58:41 +01:00
Glenn Jocher d3d9cbce22
PyTorch 1.11.0 compatibility updates (#6932)
Resolves `AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'` first raised in https://github.com/ultralytics/yolov5/issues/5499
2022-03-10 12:41:06 +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
Raffaele Galliera a297efc383
Edge TPU inference fix (#6686)
* refactor: use edgetpu flag

* fix: remove bitwise and assignation to tflite

* Cleanup and fix tflite

* Cleanup

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-02-19 15:10:07 +01:00
Glenn Jocher 56697c43ff
Fix CoreML P6 inference (#6700)
* Fix CoreML P6 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-02-18 20:38: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 ee6c70ae43
Fix yolov3.yaml remove list (#6655)
Per https://github.com/ultralytics/yolov3/issues/1887#issuecomment-1041135181
2022-02-16 10:13:05 +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 dc7e093071
Edge TPU TF imports fix (#6542)
* Edge TPU TF imports fix

Fix for https://github.com/ultralytics/yolov5/issues/6535#issuecomment-1030631526

* Update common.py
2022-02-05 15:45:44 +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 079b36d72b
Edge TPU `tf.lite.experimental.load_delegate` fix (#6536)
* Edge TPU `tf.lite.experimental.load_delegate` fix

Fix attempt for #6535

* [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 09:30:01 +01:00
Glenn Jocher 77977e0791
CoreML inference fix `list()` -> `sorted()` (#6496) 2022-02-01 22:34:15 +01:00
Glenn Jocher b884ea36c4
Simplify TF normalized to pixels (#6494) 2022-02-01 21:17:56 +01:00
Motoki Kimura 16563ac5b5
Prefer `tflite_runtime` for TFLite inference if installed (#6406)
* import tflite_runtime if tensorflow not installed

* rename tflite to tfli

* Attempt tflite_runtime for all TFLite workflows

Also rename tfli to tfl

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-01-25 07:24:24 -08:00
Glenn Jocher 33a67b4918
Update P2-P7 `models/hub` variants (#6230)
* Update p2-p7 `models/hub` variants

* Update common.py

* AutoAnchor camelcase corrections
2022-01-06 11:08:09 -08:00
Glenn Jocher 5402753a53
Edge TPU compiler comment (#6196)
* Edge TPU compiler comment

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

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

* Update export.py

* Update common.py

* Update export.py
2022-01-04 13:39:13 -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
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
Deep Patel c72270c076
Init tensor directly on device (#6068)
Slightly more efficient than .to(device)
2021-12-23 13:49:00 +01:00
Glenn Jocher 407a905747
Check TensorRT>=8.0.0 version (#6021)
* Check TensorRT>=8.0.0 version

* [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-12-17 14:59:46 +01:00
Glenn Jocher c1249a47c7
*.torchscript inference `self.jit` fix (#6007) 2021-12-16 14:10:54 +01:00
Glenn Jocher da9a1b719b
Allow `--weights URL` (#5991) 2021-12-15 15:27:08 +01:00
Yono Mittlefehldt 8f354362cd
Fix Detections class `tolist()` method (#5945)
* Fix tolist() to add the file for each Detection

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

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

* Fix PEP8 requirement for 2 spaces before an inline comment

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

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

* Cleanup

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-12-11 18:40:37 +01:00
Glenn Jocher 5bdb28ed10
Default PyTorch Hub to `autocast(False)` (#5926) 2021-12-08 23:15:14 +01:00
Glenn Jocher 581dc301a7
Add ONNX inference providers (#5918)
* Add ONNX inference providers

Fix for https://github.com/ultralytics/yolov5/issues/5916

* Update common.py
2021-12-08 13:37:33 +01:00
Li Zeng fa05f8c977
`Detections().tolist()` explicit argument fix (#5907)
debugged for missigned Detections attributes
2021-12-07 16:01:41 +01:00
Glenn Jocher 7bf04d9bbf
`AutoShape()` models as `DetectMultiBackend()` instances (#5845)
* Update AutoShape()

* autodownload ONNX

* Cleanup

* Finish updates

* Add Usage

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* fix device

* Update hubconf.py

* Update common.py

* smart param selection

* autodownload all formats

* autopad only pytorch models

* new_shape edits

* stride tensor fix

* Cleanup
2021-12-04 15:00:07 +01:00
Glenn Jocher 00e308f7be
Update TorchScript suffix to `*.torchscript` (#5856) 2021-12-02 16:06:45 +01:00
imyhxy a4207a202d
Fix TensorRT potential unordered binding addresses (#5826)
* feat: change file suffix in pythonic way

* fix: enforce binding addresses order

* fix: enforce binding addresses order
2021-11-30 13:52:22 +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
Phil2020 53349dac8e
Scope TF imports in `DetectMultiBackend()` (#5792)
* tensorflow or tflite exclusively as interpreter

As per bug report https://github.com/ultralytics/yolov5/issues/5709 I think there should be only one attempt to assign interpreter, and it appears tflite is only ever needed for the case of edgetpu model.

* Scope imports

* Nested definition line fix

* Update common.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-11-25 17:54:00 +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 46daa7b78d
Remove `.autoshape()` method (#5694) 2021-11-20 01:11:36 +01:00
Jirka Borovec eb51ffdcac
Prune unused imports (#5711)
* prune unused imports

* [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-19 13:32:53 +01:00
Nrupatunga 0453b758e7
TFDetect dynamic anchor count assignment fix (#5668)
* fix tf.py when anchors not equal to 3

* revert the isort fix

* update the fix to use anchor attribute available already
2021-11-16 12:36:00 +01:00
Ding Yiwei c2523be634
Replace 2 `transpose()` with 1 `permute` in TransformerBlock()` (#5645) 2021-11-15 10:06:18 +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 79bca2bf64
`LOGGER` consolidation (#5569)
* Logger consolidation

* [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-08 16:32:15 +01:00
Glenn Jocher 3f64ad1760
Fix `save_one_box()` (#5545)
* Fix `save_one_box()`

* [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-06 19:28:03 +01:00
Glenn Jocher 60c8a4f696
Fix for *.yaml emojis on load (#5543)
Fix for Colab hub error:


```python
import yaml

with open('yolov5s.yaml', errors='ignore') as f:
     d = yaml.safe_load(f)  # model dict

print(d)

---------------------------------------------------------------------------
ReaderError                               Traceback (most recent call last)
<ipython-input-8-1150b5143073> in <module>()
      2 
      3 with open('yolov5s.yaml', errors='ignore') as f:
----> 4      d = yaml.safe_load(f)  # model dict
      5 
      6 print(d)

6 frames
/usr/local/lib/python3.7/dist-packages/yaml/reader.py in check_printable(self, data)
    142             position = self.index+(len(self.buffer)-self.pointer)+match.start()
    143             raise ReaderError(self.name, position, ord(character),
--> 144                     'unicode', "special characters are not allowed")
    145 
    146     def update(self, length):

ReaderError: unacceptable character #x1f680: special characters are not allowed
  in "yolov5s.yaml", position 9
```
2021-11-06 16:03:14 +01:00
Glenn Jocher fa2344cdd8
Update `models/hub/*.yaml` files for v6.0n release (#5540)
* Update model yamls for v6.0

* Add python models/yolo.py --test

* Ghost fix
2021-11-06 15:07:45 +01:00
Deep Patel 336437998f
Suppress ONNX export trace warning (#5437)
Checking for `onnx_dynamic` first should suppress the warning:

```log
TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  if self.grid[i].shape[2:4] != x[i].shape[2:4] or self.onnx_dynamic
```
2021-11-05 19:31:53 +01:00
Glenn Jocher bfacfc6b4a
Update cls bias init (#5520)
* Update cls bias init

Increased numerical precision. Returns 1.0 probability for single-class datasets now. Addresses https://github.com/ultralytics/yolov5/issues/5357

```python
torch.sigmoid(torch.tensor([math.log(0.6 / (1 - 0.99999))]))
Out[19]: tensor([1.0000])
```

* Update yolo.py
2021-11-05 13:18:46 +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 06bf8ef7e5
Add tf.py verification printout (#5484)
* Update tf.py with verified confirmation

* Update ci-testing.yml

* Update ci-testing.yml
2021-11-03 19:04:51 +01:00
Glenn Jocher 042f02ff9b
Fix tf.py `LoadImages()` dataloader return values (#5455) 2021-11-02 23:04:15 +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
Glenn Jocher 8c326a1edf
Meshgrid `indexing='ij'` for PyTorch 1.10 (#5309)
* Meshgrid `indexing='ij'` for PyTorch 1.10

Will not merge currently as breaks backwards compatibility.

* Meshgrid `indexing='ij'` for PyTorch 1.10

Will not merge currently as breaks backwards compatibility.

* Add check_version hard argument

* Update comment
2021-11-01 14:33:08 +01:00
Glenn Jocher 5d4258fac5
Fix MixConv2d() remove shortcut + apply depthwise (#5410) 2021-10-30 13:38:51 +02:00
Jirka Borovec ed887b5976
Add pre-commit CI actions (#4982)
* define pre-commit

* add CI code

* configure

* apply pre-commit

* fstring

* apply MD

* pre-commit

* Update torch_utils.py

* Update print strings

* notes

* Cleanup code-format.yml

* Update setup.cfg

* Update .pre-commit-config.yaml

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-10-28 18:35:01 +02:00
Glenn Jocher 9c31a66f5d
Update `AutoShape.forward()` model.classes example (#5324) 2021-10-25 14:03:25 +02:00
Yoni Chechik 34da872ab6
fix `tf` conversion in new v6 models (#5153)
* fix `tf` conversion in new v6 (#5147)

* sort imports

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-10-12 08:38:54 -07:00
Glenn Jocher 956be8e642
YOLOv5 release v6.0 (#5141)
* Update P5 models

* Update P6 models

* Update with GFLOPs and Params

* Update with GFLOPs and Params

* Update README

* Update

* Update README

* Update

* Update

* Add times

* Update README

* Update results

* Update results

* Update results

* Update hyps

* Update plots

* Update plots

* Update README.md

* Add nano models to hubconf.py
2021-10-11 23:47:18 -07:00
Jebastin Nadar 9d75e42f98
Refactor `Detect()` anchors for ONNX <> OpenCV DNN compatibility (#4833)
* refactor anchors and anchor_grid in Detect Layer

* fix CI failures by adding compatibility

* fix tf failure

* fix different devices errors

* Cleanup

* fix anchors overwriting issue

* better refactoring

* Remove self.anchor_grid shape check (redundant with self.grid check)

Also PEP8 / 120 line width

* Convert _make_grid() from static to dynamic method

* Remove anchor_grid.to(device)

clone() should already clone to same device as self.anchors

* fix different devices error

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-10-11 09:58:42 -07:00
Jebastin Nadar a0e15046c3
Fix different devices bug when moving model from GPU to CPU (#5110)
* fix different devices bug

* extend _apply() instead of to() for a general fix

* Only apply if Detect() is last layer

Co-authored-by: Jebastin Nadar <njebastin10@gmail.com>

* Indent fix

* Add comment to yolo.py

* Add comment to common.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-10-10 14:24:05 -07:00
Glenn Jocher 070af88108
Fix `yaml.safe_load()` ignore emoji errors (#5060) 2021-10-05 13:41:52 -07:00
Glenn Jocher d133968b1e
Clip TTA Augmented Tails (#5028)
* Clip TTA Augmented Tails

Experimental TTA update.

* Update yolo.py

* Update yolo.py

* Update yolo.py

* Update yolo.py
2021-10-04 15:48:55 -07:00
Zhiqiang Wang 1922ddeac0
Fix pylint: do not use bare 'except' (#5025)
* Fix E722, do not use bare 'except'

* Remove used codes

* Add FileNotFoundError in LoadImagesAndLabels

* Remove AssertionError

* Ignore LoadImagesAndLabels

* Ignore downloads.py

* Ignore torch_utils.py

* Ignore train.py

* Ignore datasets.py

* Enable utils/download.py

* Fixing exception in thop

* Remove unused code

* Fixing exception in LoadImagesAndLabels

* Fixing exception in exif_size

* Fixing exception in parse_model

* Ignore exceptions in requests

* Revert the exception as suggested

* Revert the exception as suggested
2021-10-03 17:54:40 -07:00
Glenn Jocher fb982d6030
Fix relative `ROOT` Pytorch Hub custom model bug (#4974)
* Fix relative `ROOT` Pytorch Hub custom model bug

* Update yolo.py
2021-09-28 06:36:12 -07:00
Glenn Jocher 5ed28603cf
Update relative `ROOT` logic (#4955)
* Update relative `ROOT` logic

* python 3.9 Path().is_relative_to() removal
2021-09-27 18:26:41 -07:00
Glenn Jocher a820b43aca
Automatic Chinese fonts plotting (#4951)
* Automatic Chinese fonts plotting

* Default PIL=False
2021-09-27 13:48:15 -07:00
Jiacong Fang 2c2ef25f8b
TensorFlow.js export enhancements (#4905)
* Add arguments to TensorFlow NMS call

* Add regex substitution to reorder Identity_*

* Delete reorder in docstring

* Cleanup

* Cleanup2

* Removed `+ \` on string ends (not needed)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-09-24 14:18:15 -07: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
Jiacong Fang 3beb871ba4
Multiple TF export improvements (#4824)
* Add fused conv support

* Set all saved_model values to non trainable

* Fix TFLite fp16 model export

* Fix int8 TFLite conversion
2021-09-16 15:27:22 +02:00
Glenn Jocher 0dc725e3dc
Refactor `forward()` method profiling (#4816) 2021-09-16 09:47:34 +02:00
Glenn Jocher c3a93d783d
Add TensorFlow formats to `export.py` (#4479)
* Initial commit

* Remove unused export_torchscript return

* ROOT variable

* Add prefix to fcn arg

* fix ROOT

* check_yaml into run()

* interim fixes

* imgsz=(320, 320)

* Hardcode tf_raw_resize False

* Finish opt elimination

* Update representative_dataset_gen()

* Update export.py with TF methods

* SiLU and GraphDef fixes

* file_size() directory handling feature

* export fixes

* add lambda: to representative_dataset

* Detect training False default

* Fuse false for TF models

* Embed agnostic NMS arguments

* Remove lambda

* TensorFlow.js export success

* Add pb to Usage

* Add *_tfjs_model/ to ignore files

* prepend YOLOv5 to function headers

* Remove end --- comments

* parameterize tfjs export pb file

* update run() data default /ROOT

* update --include help

* update imports

* return ct_model

* Consolidate TFLite export

* pb prerequisite to tfjs

* TF modules CamelCase

* Remove exports from tf.py and cleanup

* pass agnostic NMS arguments

* CI

* CI

* ignore *_web_model/

* Add tensorflow to CI dependencies

* CI tensorflow-cpu

* Update requirements.txt

* Remove tensorflow check_requirement

* CI coreml tfjs

* export only onnx torchscript

* reorder exports torchscript first
2021-09-12 15:52:24 +02:00
Glenn Jocher c47be26f34
Replace `path.absolute()` with `path.resolve()` (#4763) 2021-09-11 22:46:33 +02:00
Jean-Baptiste Martin 1cad0ce2c7
Allow `multi_label` option for NMS with PyTorch Hub (#4728)
* Allow specifying multi_label option for NMS when using torch hub

* Reformat

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-09-09 15:32:04 +02:00
ELHoussineT 0d8a184237
Add `crops = results.crops()` dictionary (#4676)
* adding get cropped functionality

* Add target logic in existing functions

* Crops cleanup

* Add dictionary keys: conf, cls, box

* Bug fixes - avoid return after first image

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-09-08 19:42:28 +02:00
Glenn Jocher a2b3c71636
Add suffix checks (#4711)
* Add suffix checks

* Cleanup

* Cleanup2

* Cleanup3
2021-09-08 14:36:12 +02:00
Yukun Xia 35fe031461
Fix: add P2 layer 21 to yolov5-p2.yaml `Detect()` inputs (#4608)
Layer 21 includes the information of xsmall objects
2021-08-30 15:46:33 +02:00
Glenn Jocher e5e5ebc799
Auto-UTF handling (#4594) 2021-08-29 17:15:18 +02:00
Glenn Jocher de44376d1b
Create `Annotator()` class (#4591)
* Add Annotator() class

* Download Arial

* 2x for loop

* Cleanup

* tuple 2 list

* max_size=1920

* bold logging results to

* tolist()

* im = annotator.im

* PIL save in detect.py

* Smart asarray in detect.py

* revert to cv2.imwrite

* Cleanup

* Return result asarray

* Add `Profile()` profiler

* CamelCase Timeout

* Resize after mosaic

* pillow>=8.0.0

* daemon imwrite

* Add cv2 support

* Remove plot_wh_methods and plot_one_box

* pil=False for hubconf.py annotations

* im.shape bug fix

* colorstr common.py

* join daemons

* Update t.daemon

* Removed daemon saving
2021-08-29 16:46:13 +02:00
Glenn Jocher 2da6444c92
Fix for `python models/yolo.py --profile` (#4541)
Profiling fix copies input to Detect layer to circumvent inplace changes to the feature maps.
2021-08-25 21:23:28 +02:00
Jiacong Fang 808bcad3bb
Add TensorFlow and TFLite export (#1127)
* 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()

* 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

* Add --agnostic-nms for TF class-agnostic NMS

* Cleanup after merge

* Cleanup2 after merge

* Cleanup3 after merge

* Add tf.py docstring with credit and usage

* pb saved_model and tflite use only one model in detect.py

* Add use cases in docstring of tf.py

* Remove redundant `stride` definition

* Remove keras direct import

* Fix `check_requirements(('tensorflow>=2.4.1',))`

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-08-17 13:18:16 +02:00
Glenn Jocher 01cdb7671b
Add `SPPF()` layer (#4420)
* Add `SPPF()` layer

* Cleanup

* Add credit
2021-08-15 14:28:35 +02:00
Glenn Jocher 24bea5e4b7
Standardize headers and docstrings (#4417)
* Implement new headers

* Reformat 1

* Reformat 2

* Reformat 3 - math

* Reformat 4 - yaml
2021-08-14 21:17:51 +02:00
Glenn Jocher 2da4e7acf7
Merge PIL and OpenCV in `plot_one_box(use_pil=False)` (#4416)
* Merge PIL and OpenCV box plotting functions

* Add ASCII check to plot_one_box

* Cleanup

* Cleanup2
2021-08-14 17:44:15 +02:00
Glenn Jocher 4e8c81a368
Add `yolov5s-ghost.yaml` (#4412)
* Add yolov5s-ghost.yaml

* Finish C3Ghost

* Add C3Ghost to list

* Add C3Ghost to number of repeats if statement

* Fixes

* Cleanup
2021-08-14 12:55:22 +02:00
Yuantao Yang e7fc27406a
Fix module count in parse_model (#4379)
Co-authored-by: yangyuantao <yangyuantao@transai.cn>
2021-08-11 17:38:34 +02:00
Yonghye Kwon e96c74b5a1
Simpler code for DWConvClass (#4310)
* more simpler code for DWConvClass

more simpler code for DWConvClass

* remove DWConv function

* Replace DWConvClass with DWConv
2021-08-05 10:54:16 +02:00
Glenn Jocher 587c4b4b81
Add `DWConvClass()` (#4274)
* Add `DWConvClass()`

* Cleanup

* Cleanup2
2021-08-02 15:36:30 +02:00
Glenn Jocher 9c6732f61c
Update variables (#4273) 2021-08-02 15:13:55 +02:00
Glenn Jocher 306fc0119a
Update Autoshape forward header (#4271) 2021-08-02 12:42:23 +02:00
Glenn Jocher 18f6ba77cf
Suppress torch 1.9.0 max_pool2d() warning (#4227) 2021-07-30 00:37:55 +02:00
Glenn Jocher b60b62e874
PyCharm reformat (#4209)
* PyCharm reformat

* YAML reformat

* Markdown reformat
2021-07-28 23:35:14 +02:00
Glenn Jocher e016b15555
Update yolov5-bifpn.yaml (#4208) 2021-07-28 21:25:20 +02:00
Glenn Jocher 2683b18079
Update Hub Path inputs (#4200) 2021-07-28 16:55:39 +02:00
Glenn Jocher 1f31b7c503
Create yolov5-bifpn.yaml (#4195) 2021-07-28 15:04:30 +02:00
Glenn Jocher 5d66e48723
Train from `--data path/to/dataset.zip` feature (#4185)
* Train from `--data path/to/dataset.zip` feature

* Update dataset_stats()

* cleanup

* cleanup2
2021-07-28 02:04:10 +02:00
Glenn Jocher b1be685005
Module `super().__init__()` (#4065)
* Module `super().__init__()`

* remove NMS
2021-07-19 12:41:15 +02:00
Glenn Jocher f7d8562060
`val.py` refactor (#4053)
* val.py refactor

* cleanup

* cleanup

* cleanup

* cleanup

* save after eval

* opt.imgsz bug fix

* wandb refactor

* dataloader to train_loader

* capitalize global variables

* runs/hub/exp to runs/detect/exp

* refactor wandb logging

* Refactor wandb operations (#4061)

Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com>
2021-07-19 10:43:01 +02:00
Glenn Jocher 9dd33fd20f
AutoShape PosixPath support (#4047)
* AutoShape PosixPath support

Usage example:

````python
from pathlib import Path

model = ...
file = Path('data/images/zidane.jpg')

results = model(file)
```

* Update common.py
2021-07-18 15:25:37 +02:00
Glenn Jocher 720aaa65c8
Rename `test.py` to `val.py` (#4000) 2021-07-14 15:43:54 +02:00
Glenn Jocher d204a61834
Alert (no detections) (#3984)
* `Detections()` class `print()` overload

* Update common.py
2021-07-12 19:48:47 +02:00
Glenn Jocher b3dabdcc38
Update `probability` to `p` (#3980) 2021-07-12 15:54:43 +02:00
KEN 647223a7a8
`Ensemble()` visualize fix (#3973)
* fix visualize error

* Revert "fix visualize error"

* add visualise profile
2021-07-11 19:47:08 +02:00
jmiranda-laplateforme 588094eb7a
Update `setattr()` default for Hub PIL images (#3923)
Fix inference from PIL source.
2021-07-07 16:13:12 +02:00
Glenn Jocher 87b094bcbc
Feature visualization update (#3920)
* Feature visualization update

* Save to jpg (faster)

* Save to png
2021-07-07 15:41:58 +02:00
Glenn Jocher 3c3f8fbd5d
Improved BGR2RGB speeds (#3880)
* Update BGR2RGB ops

* speed improvements

* cleanup
2021-07-04 20:12:32 +02:00
Glenn Jocher 81b31824f5
Models `*.yaml` reformat (#3875) 2021-07-04 16:55:08 +02:00
Valentin Aliferov 831773f5a2
Add EXIF rotation to YOLOv5 Hub inference (#3852)
* rotating an image according to its exif tag

* Update common.py

* Update datasets.py

* Update datasets.py

faster

* delete extraneous gpg file

* Update common.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-07-02 13:25:54 +02:00
Glenn Jocher 25d1f2932c
Plot `AutoShape()` detections in ascending order (#3843) 2021-06-30 15:10:40 +02:00
Glenn Jocher 57c5d02bbe
Concise `TransformerBlock()` (#3821) 2021-06-29 16:03:10 +02:00
Zigarss 20d45aa4f1
Add feature map visualization (#3804)
* Add feature map visualization

Add a feature_visualization function to visualize the mid feature map of the model.

* Update yolo.py

* remove boolean from forward and reorder if statement

* remove print from forward

* General cleanup

* Indent

* Update plots.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-06-28 13:18:45 +02:00
Glenn Jocher 1f69d12591
Update 4 main ops for paths and .run() (#3715)
* Add yolov5/ to path

* rename functions to run()

* cleanup

* rename fix

* CI fix

* cleanup find models/export.py
2021-06-21 17:25:04 +02:00
Glenn Jocher fad27c0046
Update DDP for `torch.distributed.run` with `gloo` backend (#3680)
* Update DDP for `torch.distributed.run`

* Add LOCAL_RANK

* remove opt.local_rank

* backend="gloo|nccl"

* print

* print

* debug

* debug

* os.getenv

* gloo

* gloo

* gloo

* cleanup

* fix getenv

* cleanup

* cleanup destroy

* try nccl

* return opt

* add --local_rank

* add timeout

* add init_method

* gloo

* move destroy

* move destroy

* move print(opt) under if RANK

* destroy only RANK 0

* move destroy inside train()

* restore destroy outside train()

* update print(opt)

* cleanup

* nccl

* gloo with 60 second timeout

* update namespace printing
2021-06-19 16:30:25 +02:00
lb-desupervised bfb2276b1d
Slightly modify CLI execution (#3687)
* Slightly modify CLI execution

This simple change makes it easier to run the primary functions of this
repo (train/detect/test) from within Python. An object which represents
`opt` can be constructed and fed to the `main` function of each of these
modules, rather than having to call the lower level functions directly,
or run the module as a script.

* Update export.py

Add CLI parsing update for more convenient module usage within Python.

Co-authored-by: Lewis Belcher <lb@desupervised.io>
2021-06-19 12:06:59 +02:00
Glenn Jocher 53ed872c28
Update export.py, yolo.py `sys.path.append()` (#3579) 2021-06-10 15:35:22 +02:00
Glenn Jocher 0e5cfdbea7
Refactor models/export.py arguments (#3564)
* Refactor models/export.py arguments

* cleanup

* cleanup
2021-06-09 22:43:46 +02:00
Glenn Jocher f3c3d2ce5d
Merge `develop` branch into `master` (#3518)
* update ci-testing.yml (#3322)

* update ci-testing.yml

* update greetings.yml

* bring back os matrix

* update ci-testing.yml (#3322)

* update ci-testing.yml

* update greetings.yml

* bring back os matrix

* Enable direct `--weights URL` definition (#3373)

* Enable direct `--weights URL` definition

@KalenMike this PR will enable direct --weights URL definition. Example use case:
```
python train.py --weights https://storage.googleapis.com/bucket/dir/model.pt
```

* cleanup

* bug fixes

* weights = attempt_download(weights)

* Update experimental.py

* Update hubconf.py

* return bug fix

* comment mirror

* min_bytes

* Update tutorial.ipynb (#3368)

add Open in Kaggle badge

* `cv2.imread(img, -1)` for IMREAD_UNCHANGED (#3379)

* Update datasets.py

* comment

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* COCO evolution fix (#3388)

* COCO evolution fix

* cleanup

* update print

* print fix

* Create `is_pip()` function (#3391)

Returns `True` if file is part of pip package. Useful for contextual behavior modification.

```python
def is_pip():
    # Is file in a pip package?
    return 'site-packages' in Path(__file__).absolute().parts
```

* Revert "`cv2.imread(img, -1)` for IMREAD_UNCHANGED (#3379)" (#3395)

This reverts commit 21a9607e00.

* Update FLOPs description (#3422)

* Update README.md

* Changing FLOPS to FLOPs.

Co-authored-by: BuildTools <unconfigured@null.spigotmc.org>

* Parse URL authentication (#3424)

* Parse URL authentication

* urllib.parse.unquote()

* improved error handling

* improved error handling

* remove %3F

* update check_file()

* Add FLOPs title to table (#3453)

* Suppress jit trace warning + graph once (#3454)

* Suppress jit trace warning + graph once

Suppress harmless jit trace warning on TensorBoard add_graph call. Also fix multiple add_graph() calls bug, now only on batch 0.

* Update train.py

* Update MixUp augmentation `alpha=beta=32.0` (#3455)

Per VOC empirical results https://github.com/ultralytics/yolov5/issues/3380#issuecomment-853001307 by @developer0hye

* Add `timeout()` class (#3460)

* Add `timeout()` class

* rearrange order

* Faster HSV augmentation (#3462)

remove datatype conversion process that can be skipped

* Add `check_git_status()` 5 second timeout (#3464)

* Add check_git_status() 5 second timeout

This should prevent the SSH Git bug that we were discussing @KalenMike

* cleanup

* replace timeout with check_output built-in timeout

* Improved `check_requirements()` offline-handling (#3466)

Improve robustness of `check_requirements()` function to offline environments (do not attempt pip installs when offline).

* Add `output_names` argument for ONNX export with dynamic axes (#3456)

* Add output names & dynamic axes for onnx export

Add output_names and dynamic_axes names for all outputs in torch.onnx.export. The first four outputs of the model will have names output0, output1, output2, output3

* use first output only + cleanup

Co-authored-by: Samridha Shrestha <samridha.shrestha@g42.ai>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Revert FP16 `test.py` and `detect.py` inference to FP32 default (#3423)

* fixed inference bug ,while use half precision

* replace --use-half with --half

* replace space and PEP8 in detect.py

* PEP8 detect.py

* update --half help comment

* Update test.py

* revert space

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Add additional links/resources to stale.yml message (#3467)

* Update stale.yml

* cleanup

* Update stale.yml

* reformat

* Update stale.yml HUB URL (#3468)

* Stale `github.actor` bug fix (#3483)

* Explicit `model.eval()` call `if opt.train=False` (#3475)

* call model.eval() when opt.train is False

call model.eval() when opt.train is False

* single-line if statement

* cleanup

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* check_requirements() exclude `opencv-python` (#3495)

Fix for 3rd party or contrib versions of installed OpenCV as in https://github.com/ultralytics/yolov5/issues/3494.

* Earlier `assert` for cpu and half option (#3508)

* early assert for cpu and half option

early assert for cpu and half option

* Modified comment

Modified comment

* Update tutorial.ipynb (#3510)

* Reduce test.py results spacing (#3511)

* Update README.md (#3512)

* Update README.md

Minor modifications

* 850 width

* Update greetings.yml

revert greeting change as PRs will now merge to master.

Co-authored-by: Piotr Skalski <SkalskiP@users.noreply.github.com>
Co-authored-by: SkalskiP <piotr.skalski92@gmail.com>
Co-authored-by: Peretz Cohen <pizzaz93@users.noreply.github.com>
Co-authored-by: tudoulei <34886368+tudoulei@users.noreply.github.com>
Co-authored-by: chocosaj <chocosaj@users.noreply.github.com>
Co-authored-by: BuildTools <unconfigured@null.spigotmc.org>
Co-authored-by: Yonghye Kwon <developer.0hye@gmail.com>
Co-authored-by: Sam_S <SamSamhuns@users.noreply.github.com>
Co-authored-by: Samridha Shrestha <samridha.shrestha@g42.ai>
Co-authored-by: edificewang <609552430@qq.com>
2021-06-08 10:22:10 +02:00
WangChaofeng ef4d53818d
ONNX export in .train() mode fix (#3362) 2021-05-27 14:10:14 +02:00
Glenn Jocher 1f8d716ec9
yolo.py header (#3347) 2021-05-26 12:06:08 +02:00
Glenn Jocher 7b36e38cf8
Check CoreML models.train() mode (#3262)
* Check CoreML models.train() mode

* Update export.py
2021-05-20 15:22:36 +02:00
Adrian Holovaty 3f74cd9ed1
Parameterize max_det + inference default at 1000 (#3215)
* Added max_det parameters in various places

* 120 character line

* PEP8

* 120 character line

* Update inference default to 1000 instances

* Update inference default to 1000 instances

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-05-17 22:47:44 +02:00
Cristi Fati 9ab561dbfc
Parameterize ONNX `--opset-version` (#3154) 2021-05-16 16:13:03 +02:00
Yonghye Kwon be86c21c73
rename class autoShape -> AutoShape (#3173)
* rename class autoShape -> AutoShape

follow other class naming convention

* rename class autoShape -> AutoShape

follow other classes' naming convention

* rename class autoShape -> AutoShape
2021-05-16 15:46:45 +02:00
Cristi Fati d9b4e6b748
Add `--include torchscript onnx coreml` argument (#3137)
* Allow users to skip exporting in formats that they don't care about

* Correct comments

* Update export.py

renamed --skip-format to --exclude

* Switched format from exclude to include (as instructed by @glenn-jocher)

* cleanup

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-05-12 19:46:32 +02:00
Glenn Jocher 525f4f86a9
Add --optimize argument (#3093)
Fix for c++ runtime errors in https://github.com/ultralytics/yolov5/issues/2973
2021-05-10 12:13:44 +02:00
Glenn Jocher 251aeafcb1
Update P5 + P6 model ensembling (#3082) 2021-05-08 19:06:12 +02:00
Glenn Jocher e97d129db4
Update export.py with --train mode argument (#3066) 2021-05-07 13:10:07 +02:00
Glenn Jocher 3ef3a95cfa
Do not optimize CoreML TorchScript model (#3055) 2021-05-06 17:23:33 +02:00
jylink b292837e36
Fix ONNX export using --grid --simplify --dynamic simultaneously (#2982)
* Update yolo.py

* Update export.py

* fix export grid

* Update export.py, remove detect export attribute

* rearrange if order

* remove --grid, default inplace=False

* rename exp_dynamic to onnx_dynamic, comment

* replace bs with 1 in anchor_grid[i] index 0

* Update export.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-05-03 19:01:29 +02:00
Hodovo e2a80c6c0f
Add support for FP16 (half) to export.py (#3010)
* Added support for fp16 (half) to export.py

* minimize code additions

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-05-02 22:42:33 +02:00
jluntamazon 41f5cc5637
YOLOv5 AWS Inferentia Inplace compatibility updates (#2953)
* Added flag to enable/disable all inplace and assignment operations

* Removed shape print statements

* Scope Detect/Model import to avoid circular dependency

* PEP8

* create _descale_pred()

* replace lost space

* replace list with tuple

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-04-30 12:54:48 +02:00
Glenn Jocher 57812df68c
New Colors() class (#2963) 2021-04-28 16:05:14 +02:00
Glenn Jocher 4200674a13
Add yolov5/ to sys.path() for *.py subdir exec (#2949)
* Add yolov5/ to sys.path() for *.py subdir exec

* Update export.py
2021-04-27 17:02:07 +02:00
Glenn Jocher 4890499344
Improved yolo.py profiling (#2940)
* Improved yolo.py profiling

Improved column order and labelling.

* Update yolo.py
2021-04-26 23:58:21 +02:00
NanoCode012 c0d3f80544
Add verbose option to pytorch hub models (#2926)
* Add verbose and update print to logging

* Fix positonal param

* Revert auto formatting changes

* Update hubconf.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-04-25 22:01:05 +02:00
Glenn Jocher 1b1ab4cca2
Add file_size() function (#2911)
* Add file_size() function

* Update export.py
2021-04-24 01:31:11 +02:00
Glenn Jocher 646386ff09
Update export.py for 2 dry runs (#2910)
* Update export.py for 2 dry runs

* Update export.py
2021-04-24 00:10:38 +02:00