Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update detect.py for torchscript support #1

Merged
merged 12 commits into from
Oct 12, 2021

Conversation

andreiionutdamian
Copy link
Owner

Simple update for torchscript support. Assumes the torchscript file has been generated with export.py

andreiionutdamian and others added 12 commits October 9, 2021 11:13
Simple update for torchscript support. Assumes the torchscript file has been generated with `export.py`
* Requirements updated

1. Requests added to requirements.txt. That might not be included in all docker base images, adding it to the requirements is safer.
2. Added a minimum version to Pandas. It's a good practice to have versions for all dependencies.

* Sort alphabetically

* Update requirements.txt

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: qiningonline <qiningonline@gmail.com>
…ics#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>
* Update val.py `pad = 0.0 if task == speed else 0.5`

* Cleanup
* use os.path.relpath instead of relative_to

* use os.path.relpath instead of relative_to

* Remove os.path from val.py

* Remove os.path from train.py

* Update detect.py import to os

* Update export.py import to os

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
…ralytics#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>
* Add OpenCV DNN option for ONNX inference

Usage:

```bash
python detect.py --weights yolov5s.onnx  # ONNX Runtime inference
python detect.py --weights yolov5s.onnx -dnn  # OpenCV DNN inference
```

* DNN prediction to tensor

* Update detect.py
@andreiionutdamian andreiionutdamian merged commit 0587735 into patch-1 Oct 12, 2021
@andreiionutdamian andreiionutdamian deleted the feature/detect-torchscript branch October 12, 2021 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants