Commit Graph

2167 Commits (2e10909905b1e0e7eb7bac086600fe7ee2c0e6a5)
 

Author SHA1 Message Date
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
pre-commit-ci[bot] b7635efb6e
[pre-commit.ci] pre-commit suggestions (#8828)
updates:
- [github.com/asottile/pyupgrade: v2.34.0 → v2.37.3](https://github.com/asottile/pyupgrade/compare/v2.34.0...v2.37.3)
- [github.com/PyCQA/flake8: 4.0.1 → 5.0.2](https://github.com/PyCQA/flake8/compare/4.0.1...5.0.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-08-01 21:48:59 +02:00
Glenn Jocher ba140e5685
RUN git clone instead of COPY to `/usr/src/app` (#8827)
Update
2022-08-01 21:45:31 +02:00
Glenn Jocher f3c78a387e
Remove hook `torch.nan_to_num(x)` (#8826)
* Remove hook `torch.nan_to_num(x)`

Observed erratic training behavior (green line) with the nan_to_num hook in classifier branch. I'm going to remove it from master.

* Update train.py
2022-08-01 21:39:04 +02:00
Glenn Jocher 59578f2782
Update README.md with contributors.png (#8820)
* Update README.md with contributors.png

Replace dynamic svg from opencollective with static png for improved stability and lighter size (400kB vs 2MB).

@AyushExel

* Update README.md

* Update README.md

* Update README_cn.md

* [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-08-01 20:28:24 +02:00
UnglvKitDe 0669f1b27b
Add tensor hooks and 10.0 gradient clipping (#8598)
* Add tensor hooks and gradient clipping https://github.com/ultralytics/yolov5/issues/8578

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

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

* Remove retain_grad(), because its not necessary

* Update train.py

* Simplify

* Update train.py

* Update train.py

* Update train.py

* Update train.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-08-01 12:08:46 +02:00
Glenn Jocher 7b9cc3205a
Add .git to .dockerignore (#8815) 2022-08-01 03:33:28 +02:00
Glenn Jocher 39ce8ca19a
Remove `assert not is_docker()` from GitHub checks (#8813)
* Update

* Update
2022-08-01 03:01:44 +02:00
Glenn Jocher 6717519635
Update .pre-commit-config.yaml (#8812)
* Update .pre-commit-config.yaml

Comment EOF fixer

* [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-08-01 02:09:36 +02:00
Glenn Jocher 0e165c50f7 Created using Colaboratory 2022-07-31 20:34:03 +02:00
Glenn Jocher 685332ede4
Update .pre-commit-config.yaml (#8811) 2022-07-31 20:06:35 +02:00
Glenn Jocher 40c41e4269
Fix Colab-update pre-commit EOF bug (#8810) 2022-07-31 19:57:40 +02:00
Amir Pourmand afa403a809
Check git status on upstream `ultralytics` or `origin` dynamically (#8694)
* Add remote ultralytics and check git status with that

* Simplify

* Update general.py

* Update general.py

* s fix

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-07-31 18:17:38 +02:00
Glenn Jocher 7b72d9a607
Update ci-testing.yml streamlined tests (#8809)
* Update ci-testing.yml streamlined tests

* Update ci-testing.yml

* Update ci-testing.yml
2022-07-31 16:12:32 +02:00
Glenn Jocher 555976b346
FROM nvcr.io/nvidia/pytorch:22.07-py3 (#8808) 2022-07-31 15:23:57 +02:00
Glenn Jocher 9559601b9a
Update requirements.txt with tf-cpu and tf-aarch64 (#8807) 2022-07-31 14:54:55 +02:00
Glenn Jocher 34cb277dc5
Fix val.py 'no labels found bug' (#8806)
Resolves https://github.com/ultralytics/yolov5/issues/8791

Bug first introduced in #8782
2022-07-31 14:17:23 +02:00
Glenn Jocher 59595c1365
Update train.py for `val.run(half=amp)` (#8804)
Disable FP16 validation if AMP checks fail or amp=False.
2022-07-31 04:17:39 +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 7921351b4e
Deprecate torch 1.6.0 `compat _non_persistent_buffers_set` (#8797)
Deprecate torch 1.6.0 compat _non_persistent_buffers_set
2022-07-30 21:25:16 +02:00
Glenn Jocher ec4de43a8a
Update Colab Notebook CI (#8798)
* Update Colab Notebook CI

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

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

* Created using Colaboratory

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

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

* Update tutorial.ipynb

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-07-30 21:11:19 +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 e34ae8837b
ci-testing.yml Windows-friendly ENV variables (#8794)
Per https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
2022-07-30 14:04:03 +02:00
Glenn Jocher 52d3a9aee1
Fix `detect.py --update` list bug (#8783)
Fix detect.py --update

Resolves https://github.com/ultralytics/yolov5/issues/8776
2022-07-29 17:07:24 +02:00
Glenn Jocher e309a85586
Add val.py no label warning (#8782)
Help resolve confusion around zero-metrics val.py results when no labels are found in https://github.com/ultralytics/yolov5/issues/8753
2022-07-29 14:45:29 +02:00
jbutle55 567397d67a
Fix confusion matrix update when no predictions are made (#8748)
* Fix confusion matrix update when no predictions are made

* Update metrics.py

* Simply confusion matrix changes

* Simply confusion matrix fix

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-07-29 14:06:23 +02:00
Colin Wong 587a3a37c5
Dynamic batch size support for TensorRT (#8526)
* Dynamic batch size support for TensorRT

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

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

* Update export.py

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

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

* Fix optimization profile when batch size is 1

* Warn users if they use batch-size=1 with dynamic

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

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

* More descriptive assertion error

* Fix syntax

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

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

* pre-commit formatting sucked

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

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

* Update export.py

Co-authored-by: Colin Wong <noreply@brains4drones.com>
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-07-29 13:51:16 +02:00
Glenn Jocher 3e858633b2
Revert protobuf<=3.20.1 (#8742)
Resolve #8012 (again)
2022-07-27 17:27:44 +02:00
Max Strobel 0b5ac224ae
fix: broken ``is_docker`` check (#8711)
Checking if ``/workspace`` exists is not a reliable method to check if
the process runs in a docker container.

Reusing the logic from the npm "is-docker" package to check if the
process runs in a container.
References: https://github.com/sindresorhus/is-docker/blob/main/index.js

Fixes #8710.

Co-authored-by: Maximilian Strobel <Maximilian.Strobel@infineon.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-07-26 19:02:44 +02:00
Glenn Jocher c775a296a7
Revert "Fix BGR->RGB Bug in albumentations #8641" (#8727)
Revert "Fix BGR->RGB Bug in albumentations #8641 (#8695)"

This reverts commit 2e1291fdce.
2022-07-26 19:00:48 +02:00
Glenn Jocher d5116bbe9c
coremltools>=5.2 for CoreML export (#8725) 2022-07-26 17:50:49 +02:00
UnglvKitDe 2e1291fdce
Fix BGR->RGB Bug in albumentations #8641 (#8695)
* Fix BGR->RGB Bug in albumentations https://github.com/ultralytics/yolov5/issues/8641

* Change transform methode from cv2 to numpy

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

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

* Simplify

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

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

* Update augmentations.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-07-26 13:52:56 +02:00
Glenn Jocher b367860196
New `HUBDatasetStats()` class (#8716)
* New `HUBDatasetStats()` class

Usage examples:
```
from utils.dataloaders import *

stats = HUBDatasetStats('coco128.yaml', autodownload=True)  # method 1
stats = HUBDatasetStats('path/to/coco128_with_yaml.zip')  # method 1

stats.get_json(save=False)
stats.process_images()
```

@kalenmike

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

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

* Update dataloaders.py

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

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

* Update dataloaders.py

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

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

* Update dataloaders.py

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

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

* Update dataloaders.py

* [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-07-25 18:20:01 +02:00
Glenn Jocher a6f197ae79
Update dataloaders.py (#8714)
* Update dataloaders.py

* Update dataloaders.py
2022-07-25 16:52:28 +02:00
Glenn Jocher 7215a0fb41
Avoid cv2 window init code on Windows (#8712)
Resolves https://github.com/ultralytics/yolov5/issues/8642
2022-07-25 13:57:05 +02:00
Glenn Jocher 0ab303b044
Remove `else:` from load_image() (#8692) 2022-07-25 00:02:09 +02:00
Glenn Jocher 916bdb1d61
Faster crop saving (#8696)
Faster crops

Following https://github.com/ultralytics/yolov5/issues/8641#issuecomment-1193190325
2022-07-23 23:30:30 +02:00
Glenn Jocher b510957650
Move .dockerignore to root (#8690) 2022-07-23 18:50:19 +02:00
Glenn Jocher 7f7bd6fbcd
Set `torch.cuda.manual_seed_all()` for DDP (#8688)
* Set `torch.cuda.manual_seed_all()` for DDP

* Update general.py

* Update general.py
2022-07-23 18:24:14 +02:00
UnglvKitDe 1c5e92aba1
Add generator and worker seed (#8602)
* Add generator and worker seed

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

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

* Update dataloaders.py

* Update dataloaders.py

* Update dataloaders.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-07-23 01:25:17 +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 b17629e54f
Update warning emojis (#8678) 2022-07-22 15:23:22 +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 4c1784bd15
Use contextlib's suppress method to silence an error (#8668) 2022-07-21 23:12:49 +02:00
Rüdiger Busche 602d7ffb0e
Check TensorBoard logger before adding graph (#8664)
Otherwise, an error is thrown if the tensorboard logger is not included.
2022-07-21 17:40:53 +02:00
daquexian 92e47b85d9
Upgrade onnxsim to v0.4.1 (#8632)
* upgrade onnxsim to v0.4.1

Signed-off-by: daquexian <daquexian566@gmail.com>

* Update export.py

* Update export.py

* Update export.py

* Update export.py

* Update export.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2022-07-19 19:01:24 +02:00
Glenn Jocher fbe67e4653
Fix `OMP_NUM_THREADS=1` for macOS (#8624)
Resolves https://github.com/ultralytics/yolov5/issues/8623
2022-07-18 17:53:30 +02:00
Glenn Jocher 9cf5fd5ac3
assert torch!=1.12.0 for DDP training (#8621)
* assert torch!=1.12.0 for DDP training

* [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-07-18 15:05:58 +02:00
Glenn Jocher 51fb467b63
Refactor optimizer initialization (#8607)
* Refactor optimizer initialization

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

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

* Update train.py

* Update train.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-07-17 11:43:52 +02:00