Commit Graph

1250 Commits (63060910a68bfde238872d629ab88e2e7bc736e8)
 

Author SHA1 Message Date
Glenn Jocher 14d2d2d75f
Update google_utils.py (#2900) 2021-04-22 20:27:32 +02:00
Glenn Jocher cdb678f418
Update yolo.py (#2899) 2021-04-22 19:27:21 +02:00
fcakyon b40dd99167
Explicit opt function arguments (#2817)
* more explicit function arguments

* fix typo in detect.py

* revert import order

* revert import order

* remove default value
2021-04-22 18:17:30 +02:00
Glenn Jocher 264d860f8d
ACON activation function (#2893)
* ACON Activation Function

## 🚀 Feature

There is a new activation function [ACON (CVPR 2021)](https://arxiv.org/pdf/2009.04759.pdf) that unifies ReLU and Swish. 
ACON is simple but very effective, code is here: https://github.com/nmaac/acon/blob/main/acon.py#L19

![image](https://user-images.githubusercontent.com/5032208/115676962-a38dfe80-a382-11eb-9883-61fa3216e3e6.png)

The improvements are very significant:
![image](https://user-images.githubusercontent.com/5032208/115680180-eac9be80-a385-11eb-9c7a-8643db552c69.png)

## Alternatives

It also has an enhanced version meta-ACON that uses a small network to learn beta explicitly, which may influence the speed a bit.

## Additional context

[Code](https://github.com/nmaac/acon) and [paper](https://arxiv.org/pdf/2009.04759.pdf).

* Update activations.py
2021-04-22 17:26:05 +02:00
r-blmnr 0395e39fd0
Uppercase model filenames enabled (#2890) 2021-04-22 16:51:21 +02:00
Glenn Jocher 78fd077657
VisDrone2019-DET Dataset Auto-Download (#2882)
* VisDrone Dataset Auto-Download

* add visdrone.yaml

* cleanup

* add VisDrone2019-DET-test-dev

* cleanup VOC
2021-04-22 12:10:26 +02:00
Michael Heilig d48a34dca7
bug fix: switched rows and cols for correct detections in confusion matrix (#2883) 2021-04-22 00:49:55 +02:00
JoshSong 5f7d39fede
Cleanup load_image() (#2871)
* don't resize up in load_image if augmenting

* cleanup

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-04-21 15:50:28 +02:00
Glenn Jocher f7bc685c2c
Implement yaml.safe_load() (#2876)
* Implement yaml.safe_load()

* yaml.safe_dump()
2021-04-21 14:34:45 +02:00
Burhan c949fc86d1
Detection cropping+saving feature addition for detect.py and PyTorch Hub (#2827)
* Update detect.py

* Update detect.py

* Update greetings.yml

* Update cropping

* cleanup

* Update increment_path()

* Update common.py

* Update detect.py

* Update detect.py

* Update detect.py

* Update common.py

* cleanup

* Update detect.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-04-20 23:51:08 +02:00
Glenn Jocher c5c647e281
Update increment_path() to handle file paths (#2867) 2021-04-20 19:47:07 +02:00
Tim Stokman 1df8c6c963
Fix ONNX dynamic axes export support with onnx simplifier, make onnx simplifier optional (#2856)
* Ensure dynamic export works succesfully, onnx simplifier optional

* Update export.py

* add dashes

Co-authored-by: Tim <tim.stokman@hal24k.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-04-20 13:54:03 +02:00
Glenn Jocher 238583b7d5
Update FUNDING.yml (#2833)
* Update FUNDING.yml

* move FUNDING.yml to ./github
2021-04-18 14:40:58 +02:00
Glenn Jocher 803f51bcee
Create FUNDING.yml (#2832) 2021-04-18 14:28:27 +02:00
Glenn Jocher c15e25c40f
PyTorch Hub cv2 .save() .show() bug fix (#2831)
* PyTorch Hub cv2 .save() .show() bug fix

cv2.rectangle() was failing on non-contiguous np array inputs. This checks for contiguous arrays and applies is necessary:
```python
imgs[i] = im if im.data.contiguous else np.ascontiguousarray(im)  # update
```

* Update plots.py

```python
assert im.data.contiguous, 'Image not contiguous. Apply np.ascontiguousarray(im) to plot_on_box() input image.'
```

* Update hubconf.py

Expand CI tests to OpenCV image.
2021-04-18 13:47:40 +02:00
Glenn Jocher aff03be35a
YouTube Bug Fix (#2818)
Fix for #2810
```shell
python detect.py --source 0
```
introduced by YouTube Livestream Detection PR #2752
2021-04-16 17:58:28 +02:00
Glenn Jocher 1f3e482bce
ONNX Simplifier (#2815)
* ONNX Simplifier

Add ONNX Simplifier to ONNX export pipeline in export.py. Will auto-install onnx-simplifier if onnx is installed but onnx-simplifier is not.

* Update general.py
2021-04-16 14:03:27 +02:00
Glenn Jocher e5d71223b8
Update README.md 2021-04-15 16:45:50 +02:00
Robin 1479737064
Flask REST API Example (#2732)
* add files

* Update README.md

* Update README.md

* Update restapi.py

pretrained=True and model.eval() are used by default when loading a model now, so no need to call them manually.

* PEP8 reformat

* PEP8 reformat

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-04-15 13:26:08 +02:00
Glenn Jocher 1487bc84ff
Update README.md 2021-04-12 13:27:40 +02:00
Glenn Jocher 860ca98832 Created using Colaboratory 2021-04-12 13:10:08 +02:00
Glenn Jocher cac8a765c8 Created using Colaboratory 2021-04-12 13:02:40 +02:00
Glenn Jocher 2eab46e2cf
Update tutorial.ipynb 2021-04-12 12:33:04 +02:00
Glenn Jocher 6b718e9127 Created using Colaboratory 2021-04-12 12:31:28 +02:00
Glenn Jocher 54d65160b7
Update tutorial.ipynb 2021-04-12 12:26:28 +02:00
Glenn Jocher 0f395b3e3b
YOLOv5 v5.0 Release patch 1 (#2764)
* torch.jit.trace(model, img, strict=False)

* Update check_file()

* Update hubconf.py

* Update README.md
2021-04-11 23:11:43 +02:00
Glenn Jocher f5b8f7d54c
YOLOv5 v5.0 Release (#2762) 2021-04-11 19:23:47 +02:00
Ben Milanko e2b7bc0b32
YouTube Livestream Detection (#2752)
* Youtube livestream detection

* dependancy update to auto install pafy

* Remove print

* include youtube_dl in deps

* PEP8 reformat

* youtube url check fix

* reduce lines

* add comment

* update check_requirements

* stream framerate fix

* Update README.md

* cleanup

* PEP8

* remove cap.retrieve() failure code

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-04-11 18:53:40 +02:00
Glenn Jocher 9029759cb3 Created using Colaboratory 2021-04-11 16:28:32 +02:00
Glenn Jocher 6dd1083bbb
Tensorboard model visualization bug fix (#2758)
This fix should allow for visualizing YOLOv5 model graphs correctly in Tensorboard by uncommenting line 335 in train.py:
```python
                    if tb_writer:
                        tb_writer.add_graph(torch.jit.trace(model, imgs, strict=False), [])  # add model graph
```

The problem was that the detect() layer checks the input size to adapt the grid if required, and tracing does not seem to like this shape check (even if the shape is fine and no grid recomputation is required). The following will warn:
0cae7576a9/train.py (L335)

Solution is below. This is a YOLOv5s model displayed in TensorBoard. You can see the Detect() layer merging the 3 layers into a single output for example, and everything appears to work and visualize correctly.
```python
tb_writer.add_graph(torch.jit.trace(model, imgs, strict=False), [])
```
<img width="893" alt="Screenshot 2021-04-11 at 01 10 09" src="https://user-images.githubusercontent.com/26833433/114286928-349bd600-9a63-11eb-941f-7139ee6cd602.png">
2021-04-11 01:33:55 +02:00
Glenn Jocher 0cae7576a9
utils/wandb_logging PEP8 reformat (#2755)
* wandb_logging PEP8 reformat

* Update wandb_utils.py
2021-04-10 21:09:23 +02:00
Glenn Jocher b5de52c4cd
torch.cuda.amp bug fix (#2750)
PR https://github.com/ultralytics/yolov5/pull/2725 introduced a very specific bug that only affects multi-GPU trainings. Apparently the cause was using the torch.cuda.amp decorator in the autoShape forward method. I've implemented amp more traditionally in this PR, and the bug is resolved.
2021-04-09 18:19:49 +02:00
Glenn Jocher fca5e2a48f
autocast enable=torch.cuda.is_available() (#2748) 2021-04-09 13:34:49 +02:00
Glenn Jocher c03d590320
Add Hub results.pandas() method (#2725)
* Add Hub results.pandas() method

New method converts results from torch tensors to pandas DataFrames with column names.

This PR may partially resolve issue https://github.com/ultralytics/yolov5/issues/2703

```python
results = model(imgs)

print(results.pandas().xyxy[0])
         xmin        ymin        xmax        ymax  confidence  class    name
0   57.068970  391.770599  241.383545  905.797852    0.868964      0  person
1  667.661255  399.303589  810.000000  881.396667    0.851888      0  person
2  222.878387  414.774231  343.804474  857.825073    0.838376      0  person
3    4.205386  234.447678  803.739136  750.023376    0.658006      5     bus
4    0.000000  550.596008   76.681190  878.669922    0.450596      0  person
```

* Update comments 

torch example input now shown resized to size=640 and also now a multiple of P6 stride 64 (see https://github.com/ultralytics/yolov5/issues/2722#issuecomment-814785930)

* apply decorators

* PEP8

* Update common.py

* pd.options.display.max_columns = 10

* Update common.py
2021-04-07 16:28:07 +02:00
Glenn Jocher c8c8da6079
Update README with collapsable notes (#2721)
* Update README with collapsable notes.

* cleanup

* center table
2021-04-06 17:54:47 +02:00
Ayush Chaurasia 3067429307
Add support for list-of-directory data format for wandb (#2719) 2021-04-06 16:57:13 +02:00
Glenn Jocher ec8979f1d2
Updated filename attributes for YOLOv5 Hub BytesIO (#2718)
Fix 2 for 'Model predict with forward will fail if PIL image does not have filename attribute' #2702
2021-04-06 13:18:56 +02:00
Glenn Jocher 74276d5189
Updated filename attributes for YOLOv5 Hub results (#2708)
Proposed fix for 'Model predict with forward will fail if PIL image does not have filename attribute' #2702
2021-04-05 22:20:09 +02:00
Glenn Jocher 9ccfa85249
pip install coremltools onnx (#2690)
Requested in https://github.com/ultralytics/yolov5/issues/2686
2021-04-02 13:00:46 +02:00
Glenn Jocher 17300a4c7b
autoShape forward im = np.asarray(im) # to numpy (#2689)
Slight speedup.
2021-04-02 12:36:38 +02:00
Glenn Jocher 2af059c0d8
PyTorch Hub model.save() increment as runs/hub/exp (#2684)
* PyTorch Hub model.save() increment as runs/hub/exp

This chane will align PyTorch Hub results saving with the existing unified results saving directory structure of

runs/
  /train
  /detect
  /test
  /hub
    /exp
    /exp2
    ...

* cleanup
2021-04-02 11:55:10 +02:00
Ayush Chaurasia 514ebcdf33
Fix: #2674 (#2683)
* Set resume flag to false

* Check existance of val dataset
2021-04-02 11:54:50 +02:00
Ding Yiwei 1148e2ea63
Add TransformerLayer, TransformerBlock, C3TR modules (#2333)
* yolotr

* transformer block

* Remove bias in Transformer

* Remove C3T

* Remove a deprecated class

* put the 2nd LayerNorm into the 2nd residual block

* move example model to models/hub, rename to -transformer

* Add module comments and TODOs

* Remove LN in Transformer

* Add comments for Transformer

* Solve the problem of MA with DDP

* cleanup

* cleanup find_unused_parameters

* PEP8 reformat

Co-authored-by: DingYiwei <846414640@qq.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-04-01 17:26:53 +02:00
Glenn Jocher b8b862993d
Update README with Tips for Best Results tutorial (#2682)
* Update README with Tips for Best Results tutorial

* Update README.md
2021-04-01 15:01:00 +02:00
Glenn Jocher 877b826e3a Created using Colaboratory 2021-04-01 11:31:27 +02:00
Glenn Jocher 51cc0962b5
Update README.md 2021-04-01 11:16:56 +02:00
Ayush Chaurasia 2a28ef374b
Set resume flag to false (#2657) 2021-03-31 13:47:54 +02:00
Glenn Jocher 1b475c1797 Created using Colaboratory 2021-03-30 20:07:18 +02:00
Phat Tran 9c803f2f7e
Add --label-smoothing eps argument to train.py (default 0.0) (#2344)
* Add label smoothing option

* Correct data type

* add_log

* Remove log

* Add log

* Update loss.py

remove comment (too versbose)

Co-authored-by: phattran <phat.tranhoang@cyberlogitec.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-03-29 18:45:46 +02:00
Benjamin Fineran fd1679975b
add option to disable half precision in test.py (#2507)
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-03-29 17:15:26 +02:00