Commit Graph

89 Commits (e1a6a0b10008b91d9970d22c397a0f03533ebca5)

Author SHA1 Message Date
Glenn Jocher d8b5beb0b0
Fix2 `select_device()` for Multi-GPU (#6461)
* Fix2 select_device() for Multi-GPU

* Cleanup

* Cleanup

* Simplify error message

* Improve assert

* Update torch_utils.py
2022-01-28 08:18:01 +01:00
Glenn Jocher 856d4e5733
Fix `select_device()` for Multi-GPU (#6434)
* Fix `select_device()` for Multi-GPU

Possible fix for https://github.com/ultralytics/yolov5/issues/6431

* Update torch_utils.py

* Update torch_utils.py

* Update torch_utils.py

* Update torch_utils.py

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update
2022-01-26 23:47:00 +01:00
imyhxy 4e841b9b16
Reuse `de_parallel()` rather than `is_parallel()` (#6354) 2022-01-20 10:50:17 -10:00
Glenn Jocher 436ffc417a
`select_device()` cleanup (#6302)
* `select_device()` cleanup

* Update torch_utils.py

* Update torch_utils.py

* Update torch_utils.py

* Update torch_utils.py

* Update torch_utils.py
2022-01-14 15:48:15 -10:00
Henry a1a9c6884c
Fixing bug multi-gpu training (#6299)
* Fixing bug multi-gpu training

This solves this issue: https://github.com/ultralytics/yolov5/issues/6297#issue-1103853348

* Update torch_utils.py for pep8
2022-01-14 10:11:06 -10:00
Glenn Jocher e7bf38277f
Fix `device` count check (#6290)
* Fix device count check()

* Update torch_utils.py

* Update torch_utils.py

* Update hubconf.py
2022-01-13 21:23:03 -10:00
Felix You c45f9f678d
Make `select_device()` robust to `batch_size=-1` (#5940)
* Find out a bug. When set batch_size = -1 to use the autobatch.

reproduce:

* Fix type conflict

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-12-10 15:27:20 +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 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 e189fa15ea
`intersect_dicts()` in hubconf.py fix (#5542) 2021-11-06 15:41:17 +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 84a8099b75
Update torch_utils.py import `LOGGER` (#5483) 2021-11-03 17:17:38 +01:00
Glenn Jocher df30426c03
Improve GPU name (#5478)
* Improve GPU name

* Update torch_utils.py

* Update torch_utils.py

* Update torch_utils.py

* Update torch_utils.py
2021-11-03 16:59: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 ca19df5f7f
Add `autobatch` feature for best `batch-size` estimation (#5092)
* Autobatch

* fix mem

* fix mem2

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update train.py

* print result

* Cleanup print result

* swap fix in call

* to 64

* use total

* fix

* fix

* fix

* fix

* fix

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Cleanup printing

* Update final printout

* Update autobatch.py

* Update autobatch.py

* Update autobatch.py
2021-10-25 13:56:13 +02:00
Glenn Jocher 441b47c443
More informative `EarlyStopping()` message (#5303) 2021-10-22 20:02:19 +02:00
Glenn Jocher 84bfa89236
Consolidate `init_seeds()` (#4849) 2021-09-18 13:28:42 +02:00
Glenn Jocher 548745181a
EarlyStopper updates (#4679) 2021-09-05 19:09:53 +02:00
Glenn Jocher 93cc015748
Add EarlyStopping feature (#4576)
* Add EarlyStopping feature

* Add comment

* Cleanup

* Cleanup2

* debug

* debug2

* debug3

* debug3

* debug4

* debug5

* debug6

* debug7

* debug8

* debug9

* debug10

* debug11

* debug12

* Cleanup

* Add TODO for known DDP issue
2021-08-28 19:03:52 +02:00
Glenn Jocher 19d03a955c
Remove DDP process group timeout (#4422) 2021-08-15 18:32:41 +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
imyhxy 771ac6c53d
Fixed logging level in distributed mode (#4284)
Co-authored-by: fkwong <huangfuqiang@transai.cn>
2021-08-03 13:11:42 +02:00
Glenn Jocher d8f18834a2
Update `profile()` for CUDA Memory allocation (#4239)
* Update profile()

* Update profile()

* Update profile()

* Update profile()

* Update profile()

* Update profile()

* Update profile()

* Update profile()

* Update profile()

* Update profile()

* Update profile()

* Update profile()

* Cleanup
2021-07-30 18:17:19 +02:00
Glenn Jocher 9468657502
Update profiler (#4236) 2021-07-30 16:00:47 +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 6a3ee7cf03
Hub models `map_location=device` (#3894)
* Hub models `map_location=device`

* cleanup
2021-07-05 16:20:46 +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
Glenn Jocher 8b5086c21b
Multi-GPU default to single device 0 (#3554)
* Multi-GPU default to single device 0

* Multi-GPU default to single device 0

* add space
2021-06-09 15:31:47 +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
Glenn Jocher aad99b63d6
TensorBoard DP/DDP graph fix (#3325) 2021-05-25 11:45:24 +02:00
Glenn Jocher f3402353fb
check `batch_size % utilized_device_count` (#3276)
Bug fix to check batch_size divisibility of utilized CUDA device count vs total system CUDA device count.
2021-05-21 15:20:03 +02:00
Glenn Jocher 866bc7d640
Speed profiling improvements (#2648)
* Speed profiling improvements

* Update torch_utils.py

deepcopy() required to avoid adding elements to model.

* Update torch_utils.py
2021-03-29 15:19:07 +02:00
Glenn Jocher 2e95cf3d79
Improve git_describe() fix 1 (#2635)
Add stderr=subprocess.STDOUT to catch error messages.
2021-03-28 17:09:06 +02:00
Glenn Jocher 6e8c5b7678
Improve git_describe() (#2633)
Catch 'fatal: not a git repository' returns and return '' instead (observed in GCP Hub checks).
2021-03-28 15:39:31 +02:00
Glenn Jocher 0ff5aeca61
Create date_modified() (#2616)
Updated device selection string with fallback for non-git directories.
```python
def select_device(device='', batch_size=None):
    # device = 'cpu' or '0' or '0,1,2,3'
    s = f'YOLOv5 🚀 {git_describe() or date_modified()} torch {torch.__version__} '  # string
...
```
2021-03-26 12:52:47 +01:00
Glenn Jocher 77415a42e5
Update git_describe() for remote dir usage (#2606) 2021-03-26 01:44:00 +01:00
Glenn Jocher 9b11f0c58b
PyTorch Hub models default to CUDA:0 if available (#2472)
* PyTorch Hub models default to CUDA:0 if available

* device as string bug fix
2021-03-14 23:16:17 -07:00
Glenn Jocher f01f3223d5
Integer printout (#2450)
* Integer printout

* test.py 'Labels'

* Update train.py
2021-03-12 13:35:44 -08:00
xiaowo1996 83dc1b4484
FLOPS min stride 32 (#2276)
Signed-off-by: xiaowo1996 <429740343@qq.com>
2021-02-23 09:38:56 -08:00
Glenn Jocher ffef77124e
Update torch_utils.py (#1895) 2021-01-10 12:26:29 -08:00
Glenn Jocher 6ab589583c
Add colorstr() (#1887)
* Add colorful()

* update

* newline fix

* add git description

* --always

* update loss scaling

* update loss scaling 2

* rename to colorstr()
2021-01-09 15:24:18 -08:00
Glenn Jocher 69be8e738f
YOLOv5 v4.0 Release (#1837)
* Update C3 module

* Update C3 module

* Update C3 module

* Update C3 module

* update

* update

* update

* update

* update

* update

* update

* update

* update

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* update

* update

* update

* update

* updates

* updates

* updates

* updates

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update datasets

* update

* update

* update

* update attempt_downlaod()

* merge

* merge

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* parameterize eps

* comments

* gs-multiple

* update

* max_nms implemented

* Create one_cycle() function

* update

* update

* update

* update

* update

* update

* update

* update study.png

* update study.png

* Update datasets.py
2021-01-04 19:54:09 -08:00
Glenn Jocher 9f5a18bb80
Torch CUDA synchronize update (#1826)
* torch.cuda.synchronize() update

* torch.cuda.synchronize() update

* torch.cuda.synchronize() update

* newline
2021-01-03 11:23:12 -08:00
Glenn Jocher c0ffcdf998
Display correct CUDA devices (#1776)
* Display correct CUDA devices

* cleanup
2020-12-24 13:01:35 -08:00
Glenn Jocher 3004fb5bc1
Automatic m.half() profile on x.half() 2020-12-21 15:20:33 -08:00
Glenn Jocher 0bd9c48609
Update torch_utils.py
FLOPS to GFLOPS
2020-12-21 13:29:52 -08:00
Glenn Jocher 394d1c89f3
Input channel yaml['ch'] addition (#1741) 2020-12-19 10:54:01 -08:00
Glenn Jocher 8bc0027afc
Update loss criteria constructor (#1711) 2020-12-16 08:39:35 -08:00