Commit Graph

91 Commits (a2de5c5bf61f1165ffeb4af51dc5b24e8d04bff6)

Author SHA1 Message Date
Glenn Jocher f1482b0667
Remove ipython from `check_requirements` exclude list (#9841)
May resolve e3ff780676 (commitcomment-87136818)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-10-18 13:54:33 +02:00
Glenn Jocher 15b75659dd
Update hubconf.py local repo Usage example (#9803)
* Update hubconf.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update hubconf.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-10-13 15:27:16 +02:00
Glenn Jocher 799e3d0cc9
Add SegmentationModel unsupported warning (#9632)
* Add SegmentationModel unsupported warning

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update hubconf.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update hubconf.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-09-28 16:43:11 +02:00
Glenn Jocher ca9c993d6c
Standardize warnings with `WARNING ⚠️ ...` (#9467)
* Standardize warnings

* [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-09-18 16:15:25 +02:00
Glenn Jocher cafdd18939
Exclude `ipython` from hubconf.py `check_requirements()` (#9362)
Exclude ipython from hubconf.py `check_requirements()`

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-09-10 22:58:24 +03:00
Glenn Jocher 91a81d48fa
Default AutoBatch 0.8 fraction (#9212) 2022-08-29 20:41:54 +02:00
Glenn Jocher 06831aa9e9
Improved Usage example docstrings (#9075)
* Updated Usage examples

* Update detect.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update predict.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-08-22 01:06:29 +02:00
Glenn Jocher 262187e95d
Two dimensional `size=(h,w)` AutoShape support (#9072)
* Two dimensional `size=(h,w)` AutoShape support

May resolve https://github.com/ultralytics/yolov5/issues/9039

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update hubconf.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

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

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

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-08-21 23:26:07 +02:00
Glenn Jocher eb359c3a22
Add PyTorch Hub classification CI checks (#9027)
* Add PyTorch Hub classification CI checks

Add PyTorch Hub loading of official and custom trained classification models to CI checks. 

May help resolve https://github.com/ultralytics/yolov5/issues/8790#issuecomment-1219840718

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* Update hubconf.py

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-08-18 21:45:11 +02:00
Jackson Argo 2e10909905
Fix missing attr model.model when loading custom yolov model (#8830)
* Update hubconf.py

Loading a custom yolov model causes this line to fail. Adding a test to check if the model actually has a model.model field. With this check, I'm able to load the model no prob.

Loading model via

```py
    model = torch.hub.load(
        'ultralytics/yolov5', 'custom', 'models/frozen_backbone_coco_unlabeled_best.onnx',
        autoshape=True, force_reload=False
    )
```

Causes traceback:

```
Traceback (most recent call last):
  File "/Users/jackson/Documents/GitHub/w210-capstone/.venv/lib/python3.10/site-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/jackson/Documents/GitHub/w210-capstone/.venv/lib/python3.10/site-packages/flask/app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/jackson/Documents/GitHub/w210-capstone/.venv/lib/python3.10/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/jackson/Documents/GitHub/w210-capstone/.venv/lib/python3.10/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/Users/jackson/Documents/GitHub/w210-capstone/api/endpoints/predictions.py", line 26, in post_predictions
    yolov_predictions = predict_bounding_boxes_for_collection(collection_id)
  File "/Users/jackson/Documents/GitHub/w210-capstone/api/predictions/predict_bounding_boxes.py", line 43, in predict_bounding_boxes_for_collection
    model = torch.hub.load(
  File "/Users/jackson/Documents/GitHub/w210-capstone/.venv/lib/python3.10/site-packages/torch/hub.py", line 404, in load
    model = _load_local(repo_or_dir, model, *args, **kwargs)
  File "/Users/jackson/Documents/GitHub/w210-capstone/.venv/lib/python3.10/site-packages/torch/hub.py", line 433, in _load_local
    model = entry(*args, **kwargs)
  File "/Users/jackson/.cache/torch/hub/ultralytics_yolov5_master/hubconf.py", line 72, in custom
    return _create(path, autoshape=autoshape, verbose=_verbose, device=device)
  File "/Users/jackson/.cache/torch/hub/ultralytics_yolov5_master/hubconf.py", line 67, in _create
    raise Exception(s) from e
Exception: 'DetectMultiBackend' object has no attribute 'model'. Cache may be out of date, try `force_reload=True` or see https://github.com/ultralytics/yolov5/issues/36 for help.
Exception on /api/v1/predictions [POST]
Traceback (most recent call last):
  File "/Users/jackson/.cache/torch/hub/ultralytics_yolov5_master/hubconf.py", line 58, in _create
    model.model.model[-1].inplace = False  # Detect.inplace=False for safe multithread inference
  File "/Users/jackson/Documents/GitHub/w210-capstone/.venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1185, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'DetectMultiBackend' object has no attribute 'model'
```

* Update hubconf.py

* Update common.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-08-02 01:46:08 +02:00
Glenn Jocher 1e89807d9a
`Detect.inplace=False` for multithread-safe inference (#8801)
Detect.inplace=False for safe multithread inference
2022-07-30 22:19:40 +02:00
Glenn Jocher 56f5cb5a28
Print hubconf.py args (#8800) 2022-07-30 21:02:26 +02:00
Glenn Jocher 9111246208
Add hubconf.py argparser (#8799)
* Add hubconf.py argparser

* Add hubconf.py argparser
2022-07-30 21:00:28 +02:00
Glenn Jocher b92430a83b
Update hubconf.py to reset logging level to INFO (#8680) 2022-07-22 19:01:16 +02:00
Glenn Jocher 38721de7ef
Update hubconf.py to reset LOGGER.level after load (#8674)
Resolves silent outputs after model load
2022-07-22 11:54:31 +02:00
Glenn Jocher a34b376d0f
Link fuse() to AutoShape() for Hub models (#8599) 2022-07-16 23:46:23 +02:00
Glenn Jocher 303f3785ae
Prefer MPS over CPU if available (#8210)
* Prefer MPS over CPU if available

* Update torch_utils.py
2022-06-17 18:28:29 +02:00
Glenn Jocher 1e112ced79
YOLOv5 OpenVINO PyTorch Hub inference fix (#7826)
Resolves bug report #7817
2022-05-16 00:56:44 +02:00
Glenn Jocher 7043872f25
PyTorch Hub `_verbose=False` fix2 (#7550)
* PyTorch Hub `_verbose=False` fix2

* Update downloads.py

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

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

* Update hubconf.py

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

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

* Update

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

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

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-04-23 11:26:25 -07:00
Jirka Borovec c3d5ac151e
precommit: yapf (#5494)
* precommit: yapf

* align isort

* fix

# Conflicts:
#	utils/plots.py

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

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

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

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

* Update setup.cfg

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

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

* Update setup.cfg

* Update setup.cfg

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

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

* Update wandb_utils.py

* Update augmentations.py

* Update setup.cfg

* Update yolo.py

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

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

* Update val.py

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

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

* simplify colorstr

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

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

* val run fix

* export.py last comma

* Update export.py

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

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

* Update hubconf.py

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

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

* PyTorch Hub tuple fix

* PyTorch Hub tuple fix2

* PyTorch Hub tuple fix3

* Update setup

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-03-31 16:52:34 +02:00
RcINS d115bbf509
Fix `cv2.imwrite` on non-ASCII paths (#7139)
* Fix imwrite on non-ASCII paths

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

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

* Update general.py

* Update __init__.py

* Update __init__.py

* Update datasets.py

* Update hubconf.py

* Update detect.py

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

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

* Update general.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>
2022-03-25 13:25:30 +01:00
Glenn Jocher d5966c93f1
Namespace `VERBOSE` env variable to `YOLOv5_VERBOSE` (#6428)
* Verbose updates

* Verbose updates
2022-01-25 17:57:27 -05: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
Glenn Jocher e8ef8fb1ca
`pretrained=False` fix (#5966)
* `pretriained=False` fix

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

* CI speed improvement
2021-12-13 13:32:27 +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 46daa7b78d
Remove `.autoshape()` method (#5694) 2021-11-20 01:11:36 +01:00
Glenn Jocher e189fa15ea
`intersect_dicts()` in hubconf.py fix (#5542) 2021-11-06 15:41:17 +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 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
Glenn Jocher 4c839eeb10
Simplify `check_requirements()` usage (#4855)
* Simplify `check_requirements()` usage

* remove assert, print()
2021-09-18 18:34:30 +02:00
Glenn Jocher c47be26f34
Replace `path.absolute()` with `path.resolve()` (#4763) 2021-09-11 22:46:33 +02:00
Omid Sadeghnezhad dbc06ce292
Update hubconf.py attempt_load import (#4428) 2021-08-16 10:58:02 +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 2683b18079
Update Hub Path inputs (#4200) 2021-07-28 16:55:39 +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 411842e058
Fix `torch.hub.list('ultralytics/yolov5')` pathlib bug (#3921) 2021-07-07 16:08:42 +02:00
johnohagan 61047a2b4f
Save PyTorch Hub models to `/root/hub/cache/dir` (#3904)
* Create hubconf.py

* Add save_dir variable

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-07-07 13:41:46 +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 ef0b5c9d29
On-demand `pycocotools` pip install (#3547) 2021-06-09 11:22:21 +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 3f03acb3db
check_requirements() exclude `opencv-python` (#3507)
Duplicate of #3495 merged to `develop`. This PR will be merged to `master`.

Fixes https://github.com/ultralytics/yolov5/issues/3494.
2021-06-07 15:38:51 +02:00
Christoph Gerum b133baa336
Add `device` argument to PyTorch Hub models (#3104)
* Allow to manual selection of device for torchhub models

* single line device

nested torch.device(torch.device(device)) ok

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-05-16 17:41:26 +02:00
Glenn Jocher 06372b1465
Scope all hubconf.py imports for torch.hub.list() (#3145)
* Scope all hubconf.py imports for torch.hub.list()

* Update hubconf.py
2021-05-12 20:28:26 +02:00
Glenn Jocher 1935266951
Scope imports for torch.hub.list() improvement (#3144) 2021-05-12 20:18:32 +02:00
Glenn Jocher 31ee54c28c
Hubconf.py bug fix (#3007) 2021-05-01 18:15:17 +02:00
Glenn Jocher 7c89c829e3 cleanup 2021-05-01 17:48:12 +02:00
Glenn Jocher c1a44ed9c5
Update hubconf.py for unified loading (#3005) 2021-05-01 17:35:02 +02:00
Glenn Jocher d08575ee5e
PyTorch Hub load directly when possible (#2986) 2021-04-30 14:59:51 +02:00
Glenn Jocher a833ee2a46
Update check_requirements() exclude list (#2974) 2021-04-29 21:16:23 +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