Commit Graph

1789 Commits (a45e472358d5051a6cb857483b8fb357b2634db2)
 

Author SHA1 Message Date
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
Zengyf-CVer f17c86b7f0
Save *.npy features on detect.py `--visualize` (#5701)
* Add feature map to save npy files

Add feature map to save npy files,export npy files with 32 feature maps per layer.

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

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

* Update plots.py

* Update plots.py

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

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

* Update plots.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>
2021-11-21 20:21:44 +01:00
Glenn Jocher d6ae1c835a Created using Colaboratory 2021-11-21 19:26:07 +01:00
IL2006 5185981993
SECURITY.md (#5695)
* SECURITY_1.md

* Delete SECURITY.md

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-11-20 01:26:48 +01:00
Glenn Jocher 46daa7b78d
Remove `.autoshape()` method (#5694) 2021-11-20 01:11:36 +01:00
Glenn Jocher 36d12a500e
Explicitly compute TP, FP in val.py (#5727) 2021-11-20 01:04:56 +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
Glenn Jocher 8df64a9122
`NUM_THREADS` leave at least 1 CPU free (#5706)
Updated strategy leaves at least 1 cpu free to avoid system overloads. Partially addresses https://github.com/ultralytics/yolov5/issues/5685
2021-11-18 14:53:42 +01:00
Glenn Jocher 562191f575
Update export.py docstring (#5689) 2021-11-17 15:18:50 +01:00
Glenn Jocher 47fac9ff73
Update train.py comment to 'Model attributes' (#5670) 2021-11-16 13:58:15 +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
Glenn Jocher e80a09bbfa
Update ci-testing.yml to Python 3.9 (#5660) 2021-11-15 20:15:50 +01:00
dependabot[bot] fb19561f98
Bump pip from 19.2 to 21.1 in /utils/google_app_engine (#5661)
Bumps [pip](https://github.com/pypa/pip) from 19.2 to 21.1.
- [Release notes](https://github.com/pypa/pip/releases)
- [Changelog](https://github.com/pypa/pip/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/pip/compare/19.2...21.1)

---
updated-dependencies:
- dependency-name: pip
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-15 20:10:29 +01:00
Ding Yiwei c2523be634
Replace 2 `transpose()` with 1 `permute` in TransformerBlock()` (#5645) 2021-11-15 10:06:18 +01:00
Ayush Chaurasia 540ef0dd30
W&B refactor, handle exceptions, CI example (#5618)
* handle exceptions| attempt CI

* update

* Pre-commit manual run

* yaml one-liner

* Update ci-testing.yml

* Comment W&B CI

Leave as example for future separate CI

* Update ci-testing.yml

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-11-14 13:26:53 +01:00
Glenn Jocher 80cfaf40ef
AutoAnchor and AutoBatch `LOGGER` (#5635)
* AutoBatch, AutoAnchor `LOGGER`

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

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

* Update autoanchor.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-11-13 15:40:18 +01:00
Werner Duvaud 09d170381c
Default DataLoader `shuffle=True` for training (#5623)
* Fix shuffle DataLoader argument

* Add shuffle argument

* Disable shuffle when rect

* Cleanup, add rect warning

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

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

* Cleanup2

* Cleanup3

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-11-13 13:07:32 +01:00
Glenn Jocher 7473f0f95d
DDP `WORLD_SIZE`-safe dataloader workers (#5631)
* WORLD_SIZE-safe workers

* Update with DDP comment
2021-11-12 14:48:55 +01:00
Glenn Jocher d5b21b1ecb
HUB dataset previews to JPEG (#5627)
@kalenmike per our convo yesterday.
2021-11-12 12:05:25 +01:00
Glenn Jocher def7a0fd19
Improve plots.py robustness (#5616)
* Improve plots.py robustness

Addresses issues #5374, #5395, #5611

* [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-11 12:56:38 +01:00
Glenn Jocher 69032519bc
`np.unique()` sort fix for segments (#5609)
* `np.unique()` sort fix for segments

* Update datasets.py
2021-11-11 00:15:17 +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
Ayman Saleh 27bf4282d3
Fix `check_requirements()` resource warning allocation open file (#5602)
* Fix to resource warning allocation; utilize file.open within a context manager

* rename fh to f

in keeping with naming convention

Co-authored-by: Ayman Saleh <aymansaleh@Aymans-MacBook-Pro-2.local>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-11-10 12:51:30 +01:00
Glenn Jocher 7ebb5e5da6
Add `notebook_init()` to utils/__init__.py (#5488)
* Update __init__.py

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

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

* notebook_init

* notebook_init

* notebook_init

* notebook_init

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

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

* notebook_init

* Created using Colaboratory

* [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-09 23:03:19 +01:00
Glenn Jocher 7207fe95e5
FROM nvcr.io/nvidia/pytorch:21.10-py3 (#5592) 2021-11-09 17:55:57 +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 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
Glenn Jocher b8f979bafa
Inside Ultralytics video https://youtu.be/Zgi9g1ksQHc (#5546)
* Update detect.py Usage examples

* Inside Ultralytics at https://youtu.be/Zgi9g1ksQHc
2021-11-06 20:34:54 +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 e189fa15ea
`intersect_dicts()` in hubconf.py fix (#5542) 2021-11-06 15:41:17 +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
Glenn Jocher 76d90d899a
Update Issue Templates with 💡 ProTip! (#5539)
* Update bug-report.yml

* Update question.yml

* Update bug-report.yml
2021-11-06 13:58:12 +01:00
Glenn Jocher cb18cac33d
Update autobatch.py (#5538)
* Update autobatch.py

* Update autobatch.py

* Update autobatch.py
2021-11-06 13:49:00 +01:00
Glenn Jocher 60e42e16c2
Update autobatch.py (#5536) 2021-11-06 12:21:17 +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
Wonbeom Jang d895a7f70d
Update train.py (#5451)
* correct --resume True error

* delete temp file

* Update train.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-11-05 19:28:53 +01:00
nanmi 98a3fd7e8f
Update export.py (#5471)
* fix export onnx bug

* Update export.py

* Update export.py

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

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

* Update yolo.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-11-05 19:26:45 +01:00
Glenn Jocher 32b8738735
Update `check_file()` avoid repeat URL downloads (#5526) 2021-11-05 19:22:47 +01:00
Glenn Jocher 5f603a9dba
Fix detect.py URL inference (#5525)
* Fix detect.py URL inference

Allows detect.py to run inference on remote URL sources, i.e.:

```python
!python detect.py --weights yolov5s.pt --source https://ultralytics.com/assets/zidane.jpg  # image URL
!python detect.py --weights yolov5s.pt --source https://ultralytics.com/assets/decelera_landscape.mov  # video URL
```

* [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-05 18:43:03 +01:00
Glenn Jocher 853505339a
Fix `increment_path()` explicit file vs dir handling (#5523)
Resolves https://github.com/ultralytics/yolov5/pull/5341#issuecomment-961774729

Tests:
```python
import glob
import re
from pathlib import Path


def increment_path(path, exist_ok=False, sep='', mkdir=False):
    # Increment file or directory path, i.e. runs/exp --> runs/exp{sep}2, runs/exp{sep}3, ... etc.
    path = Path(path)  # os-agnostic
    if path.exists() and not exist_ok:
        path, suffix = (path.with_suffix(''), path.suffix) if path.is_file() else (path, '')
        dirs = glob.glob(f"{path}{sep}*")  # similar paths
        matches = [re.search(rf"%s{sep}(\d+)" % path.stem, d) for d in dirs]
        i = [int(m.groups()[0]) for m in matches if m]  # indices
        n = max(i) + 1 if i else 2  # increment number
        path = Path(f"{path}{sep}{n}{suffix}")  # increment path
    if mkdir:
        path.mkdir(parents=True, exist_ok=True)  # make directory
    return path


print(increment_path('runs'))
print(increment_path('export.py'))
print(increment_path('abc.def.dir'))
print(increment_path('abc.def.file'))
```
2021-11-05 15:46:20 +01:00
Glenn Jocher bcc085d83f
Common `is_coco` logic betwen train.py and val.py (#5521) 2021-11-05 13:32:46 +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
ys31jp 36a4de184f
Update plots.py feature_visualization path issues (#5519)
* Update plots.py

Error running python detect.py --visualize
#5503

* Update plots.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-11-05 13:08:07 +01:00
Yonghye Kwon 99a45bad81
Write date in checkpoint file (#5514)
* write date in checkpoint file

write date in checkpoint file

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

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

* isoformat

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-05 11:48:10 +01:00
Glenn Jocher 17b5f5b974
Fix `increment_path()` with periods (#5518)
Fix for https://github.com/ultralytics/yolov5/issues/5503
```
python detect.py --visualize --source path/to/file.suffix1.jpg
```
2021-11-05 11:16:19 +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
Nam Vu ac2c49a2bb
Handle edgetpu model inference (#5372)
* Handle edgetpu model inference

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

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

* Cleanup

Rename `tflite_runtime.interpreter as tflite` to `tflite_runtime.interpreter as tflri` to avoid conflict with existing `tflite` boolean

Co-authored-by: Nam Vu <nam@glodonusa.com>
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 11:33:25 +01:00