Commit Graph

177 Commits (cfecd903a3399ef4529a244303d8807edd6abae4)

Author SHA1 Message Date
johnk2hawaii 9708cf56ea
New environment variable `VERBOSE` (#6353)
New environment variable `VERBOSE`
2022-01-19 14:32:19 -10:00
Glenn Jocher af001349e4
Add `is_kaggle()` function (#6285)
* Add `is_kaggle()` function

Return True if environment is Kaggle Notebook.

* Remove root loggers only if is_kaggle() == True

* Update general.py
2022-01-13 12:39:42 -10:00
Glenn Jocher b4a29b5a8d
Update NMS `max_wh=7680` for 8k images (#6178) 2022-01-03 10:54:52 -08:00
Glenn Jocher b8a4babd60
Simplify `set_logging()` indexing (#6042) 2021-12-20 17:42:52 +01:00
Glenn Jocher 0db9d5b6a2
Kaggle `LOGGER` fix (#6041) 2021-12-20 17:30:46 +01:00
Glenn Jocher 407a905747
Check TensorRT>=8.0.0 version (#6021)
* Check TensorRT>=8.0.0 version

* [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-12-17 14:59:46 +01:00
Glenn Jocher 8f875d93a2
Refactor NUM_THREADS (#5954) 2021-12-11 14:32:18 +01:00
iumyx2612 a42af30d8a
Update `strip_optimizer()` (#5949)
Replace 'training_result' with 'best_fitness' in strip_optimizer() to match key with ckpt from train.py
2021-12-10 18:06: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 7c6bae0ae6
Remove NCOLS from tqdm (#5804)
* Remove NCOLS from tqdm

* [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-26 13:37:28 +01:00
Glenn Jocher 4ca4aec46f
Do not save hyp.yaml and opt.yaml on evolve (#5775)
* Do not save hyp.yaml and opt.yaml on evolve

* Update general.py
2021-11-24 23:25:51 +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 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
Glenn Jocher e189fa15ea
`intersect_dicts()` in hubconf.py fix (#5542) 2021-11-06 15:41:17 +01:00
Glenn Jocher 32b8738735
Update `check_file()` avoid repeat URL downloads (#5526) 2021-11-05 19:22:47 +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 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
Glenn Jocher 5866646cc8
Fix float zeros format (#5491)
* Fix float zeros format

* 255 to integer
2021-11-03 23:36:53 +01:00
Mrinal Jain 7476012a4d
Update `check_git_status()` to run under `ROOT` working directory (#5441)
* Updating check_git_status() to switch to the repository root before performing git ops

* More pythonic

* Linting

* Remove redundant Path() call

* Generalizing the context manager

* Fixing error in context manager

* Cleanup

* Change to decorator

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-11-02 22:16:01 +01:00
Glenn Jocher 7b1f7aec46
Update `get_loggers()` (#4854)
* Update `set_logging()`

* Update export.py

* pre-commit fixes

* Update LoadImages

* Update LoadStreams

* Update print_args

* Single LOGGER definition

* yolo.py fix

Co-authored-by: pre-commit <pre-commit@example.com>
2021-11-01 18:22:13 +01:00
Glenn Jocher 8c326a1edf
Meshgrid `indexing='ij'` for PyTorch 1.10 (#5309)
* Meshgrid `indexing='ij'` for PyTorch 1.10

Will not merge currently as breaks backwards compatibility.

* Meshgrid `indexing='ij'` for PyTorch 1.10

Will not merge currently as breaks backwards compatibility.

* Add check_version hard argument

* Update comment
2021-11-01 14:33:08 +01: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 7ee5aed0b3
Improved check_suffix() robustness to `''` and `""` (#5192)
* Improved check_suffix() robustness to `''` and `""`

* Cleanup
2021-10-14 12:00:39 -07:00
Zhiqiang Wang 1922ddeac0
Fix pylint: do not use bare 'except' (#5025)
* Fix E722, do not use bare 'except'

* Remove used codes

* Add FileNotFoundError in LoadImagesAndLabels

* Remove AssertionError

* Ignore LoadImagesAndLabels

* Ignore downloads.py

* Ignore torch_utils.py

* Ignore train.py

* Ignore datasets.py

* Enable utils/download.py

* Fixing exception in thop

* Remove unused code

* Fixing exception in LoadImagesAndLabels

* Fixing exception in exif_size

* Fixing exception in parse_model

* Ignore exceptions in requests

* Revert the exception as suggested

* Revert the exception as suggested
2021-10-03 17:54:40 -07:00
Kalen Michael 76d301bd21
Fix URL parsing bug (#4998)
* added callbacks

* added back callback to main

* added save_dir to callback output

* merged in upstream

* removed ghost code

* fixed parsing error for google temp links

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-09-29 10:48:45 -07:00
Diego Montes c1bed601e9
Fix `isascii()` method calls for python 3.6 (#4958)
* fix isascii for python3.6

* update comment with python 3.7 note

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-09-27 20:16:23 -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
Glenn Jocher 5a8e4343d8
Scope `check_file()` search space (#4933)
`check_file()` is now limited to searching opt-in directories: /data, /models, /utils. This prevents large non-project directories like /.git and /venv from being searched, which may cause `check_file()` to slow significantly.
2021-09-26 17:11:46 -07:00
Glenn Jocher 39c17ce0b9
Fix `root` referenced before assignment (#4920)
* Fix `root` referenced before assignment

Fix for bug introduced by #4919 discovered on VOC autodownload:
```
python train.py --data VOC.yaml
```

* Cleanup
2021-09-25 09:16:14 -07:00
Glenn Jocher a64a4c839f
Replace `os.system('unzip file.zip')` -> `ZipFile.extractall()` (#4919)
* Replace `os.system('unzip file.zip')` -> `ZipFile.extractall()`

* Cleanup
2021-09-25 08:52:36 -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 3732f9ac8a
Refactor argparser printing to `print_args()` (#4850)
* Refactor argparser printing to `print_args()`

* Cleanup
2021-09-18 14:16:19 +02:00
Glenn Jocher 84bfa89236
Consolidate `init_seeds()` (#4849) 2021-09-18 13:28:42 +02:00
Kalen Michael 43b2817f6e
Feature/fix export on url (#4823)
* added callbacks

* added back callback to main

* added save_dir to callback output

* merged in upstream

* removed ghost code

* added url check

* Add url2file()

* Update file-only

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-09-16 13:33:54 +02:00
Glenn Jocher c3a93d783d
Add TensorFlow formats to `export.py` (#4479)
* Initial commit

* Remove unused export_torchscript return

* ROOT variable

* Add prefix to fcn arg

* fix ROOT

* check_yaml into run()

* interim fixes

* imgsz=(320, 320)

* Hardcode tf_raw_resize False

* Finish opt elimination

* Update representative_dataset_gen()

* Update export.py with TF methods

* SiLU and GraphDef fixes

* file_size() directory handling feature

* export fixes

* add lambda: to representative_dataset

* Detect training False default

* Fuse false for TF models

* Embed agnostic NMS arguments

* Remove lambda

* TensorFlow.js export success

* Add pb to Usage

* Add *_tfjs_model/ to ignore files

* prepend YOLOv5 to function headers

* Remove end --- comments

* parameterize tfjs export pb file

* update run() data default /ROOT

* update --include help

* update imports

* return ct_model

* Consolidate TFLite export

* pb prerequisite to tfjs

* TF modules CamelCase

* Remove exports from tf.py and cleanup

* pass agnostic NMS arguments

* CI

* CI

* ignore *_web_model/

* Add tensorflow to CI dependencies

* CI tensorflow-cpu

* Update requirements.txt

* Remove tensorflow check_requirement

* CI coreml tfjs

* export only onnx torchscript

* reorder exports torchscript first
2021-09-12 15:52:24 +02:00
Glenn Jocher c47be26f34
Replace `path.absolute()` with `path.resolve()` (#4763) 2021-09-11 22:46:33 +02:00
Glenn Jocher cd810c8286
Centralize `user_config_dir()` decision making (#4755) 2021-09-11 16:32:08 +02:00
Glenn Jocher 22ee6fb7c1
Update `is_writeable()` for 2 methods (#4744)
* Writeable test

* Fix

* Cleanup
2021-09-10 17:52:33 +02:00
Glenn Jocher a144536f88
Fix `is_writeable()` for 3 OS support (#4743)
* Fix `is_writeable()` for 3 OS support

* Update general.py
2021-09-10 17:06:22 +02:00
Glenn Jocher 4a025ae97f
Fix `user_config_dir()` for GCP/AWS functions (#4726)
* Fix `user_config_dir()` for GCP/AWS functions

Compatability fix for GCP functions and AWS lambda for user config directory in https://github.com/ultralytics/yolov5/pull/4628

* Windows skip check
2021-09-09 17:57:46 +02:00
Glenn Jocher 8e94bf62d9
Add `user_config_dir('Ultralytics')` (#4715)
* Add `user_config_dir`

* Linux to .config
2021-09-08 18:13:59 +02:00
Glenn Jocher 25a7e1dae5
Update `check_yaml()` comment (#4713)
* Update `check_yaml()` comment

* Cleanup
2021-09-08 16:01:03 +02:00
Glenn Jocher f984cce52a
Fix `check_suffix()` (#4712)
Fix a bug when `file=''`
2021-09-08 15:06:31 +02:00
Glenn Jocher a2b3c71636
Add suffix checks (#4711)
* Add suffix checks

* Cleanup

* Cleanup2

* Cleanup3
2021-09-08 14:36:12 +02:00
Glenn Jocher 3a72d4a7e3
Update `check_git_status()` warning (#4610) 2021-08-30 17:05:45 +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