Commit Graph

100 Commits (da9a1b719ba7d10e209ff89efe28b074fb9a5f16)

Author SHA1 Message Date
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
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
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 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
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 a820b43aca
Automatic Chinese fonts plotting (#4951)
* Automatic Chinese fonts plotting

* Default PIL=False
2021-09-27 13:48:15 -07: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 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 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
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 2683b18079
Update Hub Path inputs (#4200) 2021-07-28 16:55:39 +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 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
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 3c3f8fbd5d
Improved BGR2RGB speeds (#3880)
* Update BGR2RGB ops

* speed improvements

* cleanup
2021-07-04 20:12:32 +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
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
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