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
Glenn Jocher
57812df68c
New Colors() class ( #2963 )
2021-04-28 16:05:14 +02:00
Burhan
c949fc86d1
Detection cropping+saving feature addition for detect.py and PyTorch Hub ( #2827 )
...
* Update detect.py
* Update detect.py
* Update greetings.yml
* Update cropping
* cleanup
* Update increment_path()
* Update common.py
* Update detect.py
* Update detect.py
* Update detect.py
* Update common.py
* cleanup
* Update detect.py
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-04-20 23:51:08 +02:00
Glenn Jocher
c15e25c40f
PyTorch Hub cv2 .save() .show() bug fix ( #2831 )
...
* PyTorch Hub cv2 .save() .show() bug fix
cv2.rectangle() was failing on non-contiguous np array inputs. This checks for contiguous arrays and applies is necessary:
```python
imgs[i] = im if im.data.contiguous else np.ascontiguousarray(im) # update
```
* Update plots.py
```python
assert im.data.contiguous, 'Image not contiguous. Apply np.ascontiguousarray(im) to plot_on_box() input image.'
```
* Update hubconf.py
Expand CI tests to OpenCV image.
2021-04-18 13:47:40 +02:00
Glenn Jocher
b5de52c4cd
torch.cuda.amp bug fix ( #2750 )
...
PR https://github.com/ultralytics/yolov5/pull/2725 introduced a very specific bug that only affects multi-GPU trainings. Apparently the cause was using the torch.cuda.amp decorator in the autoShape forward method. I've implemented amp more traditionally in this PR, and the bug is resolved.
2021-04-09 18:19:49 +02:00
Glenn Jocher
fca5e2a48f
autocast enable=torch.cuda.is_available() ( #2748 )
2021-04-09 13:34:49 +02:00
Glenn Jocher
c03d590320
Add Hub results.pandas() method ( #2725 )
...
* Add Hub results.pandas() method
New method converts results from torch tensors to pandas DataFrames with column names.
This PR may partially resolve issue https://github.com/ultralytics/yolov5/issues/2703
```python
results = model(imgs)
print(results.pandas().xyxy[0])
xmin ymin xmax ymax confidence class name
0 57.068970 391.770599 241.383545 905.797852 0.868964 0 person
1 667.661255 399.303589 810.000000 881.396667 0.851888 0 person
2 222.878387 414.774231 343.804474 857.825073 0.838376 0 person
3 4.205386 234.447678 803.739136 750.023376 0.658006 5 bus
4 0.000000 550.596008 76.681190 878.669922 0.450596 0 person
```
* Update comments
torch example input now shown resized to size=640 and also now a multiple of P6 stride 64 (see https://github.com/ultralytics/yolov5/issues/2722#issuecomment-814785930 )
* apply decorators
* PEP8
* Update common.py
* pd.options.display.max_columns = 10
* Update common.py
2021-04-07 16:28:07 +02:00
Glenn Jocher
ec8979f1d2
Updated filename attributes for YOLOv5 Hub BytesIO ( #2718 )
...
Fix 2 for 'Model predict with forward will fail if PIL image does not have filename attribute' #2702
2021-04-06 13:18:56 +02:00
Glenn Jocher
74276d5189
Updated filename attributes for YOLOv5 Hub results ( #2708 )
...
Proposed fix for 'Model predict with forward will fail if PIL image does not have filename attribute' #2702
2021-04-05 22:20:09 +02:00
Glenn Jocher
17300a4c7b
autoShape forward im = np.asarray(im) # to numpy ( #2689 )
...
Slight speedup.
2021-04-02 12:36:38 +02:00
Glenn Jocher
2af059c0d8
PyTorch Hub model.save() increment as runs/hub/exp ( #2684 )
...
* PyTorch Hub model.save() increment as runs/hub/exp
This chane will align PyTorch Hub results saving with the existing unified results saving directory structure of
runs/
/train
/detect
/test
/hub
/exp
/exp2
...
* cleanup
2021-04-02 11:55:10 +02:00