Commit Graph

380 Commits (f1214f237dab515be92efeec890a66a8ab394dc5)

Author SHA1 Message Date
Glenn Jocher 93cc015748
Add EarlyStopping feature (#4576)
* Add EarlyStopping feature

* Add comment

* Cleanup

* Cleanup2

* debug

* debug2

* debug3

* debug3

* debug4

* debug5

* debug6

* debug7

* debug8

* debug9

* debug10

* debug11

* debug12

* Cleanup

* Add TODO for known DDP issue
2021-08-28 19:03:52 +02:00
Glenn Jocher 19d03a955c
Remove DDP process group timeout (#4422) 2021-08-15 18:32:41 +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 ce7deec440
`int(mlc)` (#4385) 2021-08-11 17:32:13 +02:00
Glenn Jocher 86c7150cfd
Update newline (#4308) 2021-08-04 17:41:38 +02:00
Glenn Jocher e78aeac973
Evolve in CSV format (#4307)
* Update evolution to CSV format

* Update

* Update

* Update

* Update

* Update

* reset args

* reset args

* reset args

* plot_results() fix

* Cleanup

* Cleanup2
2021-08-04 17:13:38 +02:00
junji hashimoto 2d99063201
Feature `python train.py --cache disk` (#4049)
* Add cache-on-disk and cache-directory to cache images on disk

* Fix load_image with cache_on_disk

* Add no_cache flag for load_image

* Revert the parts('logging' and a new line) that do not need to be modified

* Add the assertion for shapes of cached images

* Add a suffix string for cached images

* Fix boundary-error of letterbox for load_mosaic

* Add prefix as cache-key of cache-on-disk

* Update cache-function on disk

* Add psutil in requirements.txt

* Update train.py

* Cleanup1

* Cleanup2

* Skip existing npy

* Include re-space

* Export return character fix

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-08-02 18:47:24 +02:00
Kalen Michael b74929c910
Add `train.py` and `val.py` callbacks (#4220)
* added callbacks

* Update callbacks.py

* Update train.py

* Update val.py

* Fix CamlCase add staticmethod

* Refactor logger into callbacks

* Cleanup

* New callback on_val_image_end()

* Add curves and results images to TensorBoard

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-08-01 00:18:07 +02:00
IneovaAI bceb57b910
Add `python train.py --freeze N` argument (#4238)
* Add freeze as an argument

I train on different platforms and sometimes I want to freeze some layers. I have to go into the code and change it and also keep track of how many layers I froze on what platform. Please add the number of layers to freeze as an argument in future versions thanks.

* Update train.py

* Update train.py

* Cleanup

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-07-30 17:39:48 +02:00
Glenn Jocher 8d3c3ef45c
Fix weight decay comment (#4228) 2021-07-30 01:35:39 +02:00
Glenn Jocher c2c958c350
Explicit `requirements.txt` location (#4225) 2021-07-29 17:29:39 +02:00
Glenn Jocher b60b62e874
PyCharm reformat (#4209)
* PyCharm reformat

* YAML reformat

* Markdown reformat
2021-07-28 23:35:14 +02:00
Ayush Chaurasia e88e8f7a98
W&B: Restructure code to support the new dataset_check() feature (#4197)
* Improve docstrings and run names

* default wandb login prompt with timeout

* return key

* Update api_key check logic

* Properly support zipped dataset feature

* update docstring

* Revert tuorial change

* extend changes to log_dataset

* add run name

* bug fix

* bug fix

* Update comment

* fix import check

* remove unused import

* Hardcore .yaml file extension

* reduce code

* Reformat using pycharm

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-07-28 17:40:08 +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 0ad6301c96
Update script headers (#4163)
* Update download script headers

* cleanup

* bug fix attempt

* bug fix attempt2

* bug fix attempt3

* cleanup
2021-07-26 15:23:33 +02:00
Glenn Jocher 96e36a7c91
New CSV Logger (#4148)
* New CSV Logger

* cleanup

* move batch plots into Logger

* rename comment

* Remove total loss from progress bar

* mloss :-1 bug fix

* Update plot_results()

* Update plot_results()

* plot_results bug fix
2021-07-25 19:06:37 +02:00
Glenn Jocher efe60b5681
Refactor train.py and val.py `loggers` (#4137)
* Update loggers

* Config

* Update val.py

* cleanup

* fix1

* fix2

* fix3 and reformat

* format sweep.py

* Logger() class

* cleanup

* cleanup2

* wandb package import fix

* wandb package import fix2

* txt fix

* fix4

* fix5

* fix6

* drop wandb into utils/loggers

* fix 7

* rename loggers/wandb_logging to loggers/wandb

* Update message

* Update message

* Update message

* cleanup

* Fix x axis bug

* fix rank 0 issue

* cleanup
2021-07-25 01:18:39 +02:00
Glenn Jocher 63dd65e7ed
Update train.py (#4136)
* Refactor train.py

* Update imports

* Update imports

* Update optimizer

* cleanup
2021-07-24 16:11:39 +02:00
Glenn Jocher 2c073cd207
Add train.py ``--img-size` floor (#4099) 2021-07-21 16:50:47 +02:00
Glenn Jocher f7d8562060
`val.py` refactor (#4053)
* val.py refactor

* cleanup

* cleanup

* cleanup

* cleanup

* save after eval

* opt.imgsz bug fix

* wandb refactor

* dataloader to train_loader

* capitalize global variables

* runs/hub/exp to runs/detect/exp

* refactor wandb logging

* Refactor wandb operations (#4061)

Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com>
2021-07-19 10:43:01 +02:00
Glenn Jocher 951922c735
Add `--sync-bn` known issue (#4032)
* Add `--sync-bn` known issue

* Update train.py
2021-07-17 13:07:19 +02:00
Glenn Jocher 720aaa65c8
Rename `test.py` to `val.py` (#4000) 2021-07-14 15:43:54 +02:00
Eldar Kurtic e7888af94c
Fix inconsistent NMS IoU value for COCO (#3934)
Evaluation of 'best' and 'last' models will use the same params as the evaluation during the training phase. 
This PR fixes https://github.com/ultralytics/yolov5/issues/3907
2021-07-08 15:29:02 +02:00
Glenn Jocher 8930e22cce
Evolution commented `hyp['anchors']` fix (#3887)
Fix for `KeyError: 'anchors'` error when start hyperparameter evolution:
```bash
python train.py --evolve
```

```bash
Traceback (most recent call last):
  File "E:\yolov5\train.py", line 623, in <module>
    hyp[k] = max(hyp[k], v[1])  # lower limit
KeyError: 'anchors'
```
2021-07-05 12:48:27 +02:00
san-soucie d3e9d69850
`--evolve 300` generations CLI argument (#3863)
* evolve command accepts argument for number of generations

* evolve generations argument used in evolve for loop

* evolve argument boolean fixes

* default to 300 evolve generations

* Update train.py

Co-authored-by: John San Soucie <jsansoucie@whoi.edu>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-07-04 12:14:35 +02:00
Glenn Jocher c6c88dc601
Copy-Paste augmentation for YOLOv5 (#3845)
* Copy-paste augmentation initial commit

* if any segments

* Add obscuration rejection

* Add copy_paste hyperparameter

* Update comments
2021-07-01 00:35:04 +02:00
yellowdolphin 3974d725b6
Fix warmup `accumulate` (#3722)
* gradient accumulation during warmup in train.py

Context:
`accumulate` is the number of batches/gradients accumulated before calling the next optimizer.step().
During warmup, it is ramped up from 1 to the final value nbs / batch_size. 
Although I have not seen this in other libraries, I like the idea. During warmup, as grads are large, too large steps are more of on issue than gradient noise due to small steps.

The bug:
The condition to perform the opt step is wrong
> if ni % accumulate == 0:
This produces irregular step sizes if `accumulate` is not constant. It becomes relevant when batch_size is small and `accumulate` changes many times during warmup.

This demo also shows the proposed solution, to use a ">=" condition instead:
https://colab.research.google.com/drive/1MA2z2eCXYB_BC5UZqgXueqL_y1Tz_XVq?usp=sharing

Further, I propose not to restrict the number of warmup iterations to >= 1000. If the user changes hyp['warmup_epochs'], this causes unexpected behavior. Also, it makes evolution unstable if this parameter was to be optimized.

* replace last_opt_step tracking by do_step(ni)

* add docstrings

* move down nw

* Update train.py

* revert math import move

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-06-28 12:25:13 +02:00
Glenn Jocher 92d49fde35
Update seeds for single-GPU reproducibility (#3789)
For seed=0 on single-GPU.
2021-06-26 15:42:40 +02:00
Piotr Skalski 09246a5a33
fix/incorrect_fitness_import (#3770) 2021-06-25 16:16:18 +02:00
Glenn Jocher f2d97ebb25
Remove DDP MultiHeadAttention fix (#3768) 2021-06-25 12:52:05 +02:00
Glenn Jocher f79d7479da
Add optional dataset.yaml `path` attribute (#3753)
* Add optional dataset.yaml `path` attribute

@KalenMike

* pass locals to python scripts

* handle lists

* update coco128.yaml

* Capitalize first letter

* add test key

* finalize GlobalWheat2020.yaml

* finalize objects365.yaml

* finalize SKU-110K.yaml

* finalize SKU-110K.yaml

* finalize VisDrone.yaml

* NoneType fix

* update download comment

* voc to VOC

* update

* update VOC.yaml

* update VOC.yaml

* remove dashes

* delete get_voc.sh

* force coco and coco128 to ../datasets

* Capitalize Argoverse_HD.yaml

* Capitalize Objects365.yaml

* update Argoverse_HD.yaml

* coco segments fix

* VOC single-thread

* update Argoverse_HD.yaml

* update data_dict in test handling

* create root
2021-06-25 01:25:03 +02:00
Glenn Jocher ae4261c774
Force non-zero hyp evolution weights `w` (#3748)
Fix for https://github.com/ultralytics/yolov5/issues/3741
2021-06-23 12:56:22 +02:00
Glenn Jocher fdc22398fa
Create `data/hyps` directory (#3747) 2021-06-23 12:49:38 +02:00
Glenn Jocher 1f69d12591
Update 4 main ops for paths and .run() (#3715)
* Add yolov5/ to path

* rename functions to run()

* cleanup

* rename fix

* CI fix

* cleanup find models/export.py
2021-06-21 17:25:04 +02:00
Ayush Chaurasia 75c0ff43af
[x]W&B: Don't resume transfer learning runs (#3604)
* Allow config cahnge

* Allow val change in wandb config

* Don't resume transfer learning runs

* Add entity in log dataset
2021-06-21 14:00:25 +02:00
Glenn Jocher e8810a53e8
Update DDP backend `if dist.is_nccl_available()` (#3705) 2021-06-20 17:15:42 +02:00
Glenn Jocher fbf41e0913
Add `train.run()` method (#3700)
* Update train.py explicit arguments

* Update train.py

* Add run method
2021-06-20 15:06:58 +02:00
Glenn Jocher c1af67dcd4
Add torch DP warning (#3698) 2021-06-19 19:50:46 +02:00
Glenn Jocher b3e2f4e08d
Eliminate `total_batch_size` variable (#3697)
* Eliminate `total_batch_size` variable

* cleanup

* Update train.py
2021-06-19 19:14:59 +02:00
Glenn Jocher fad27c0046
Update DDP for `torch.distributed.run` with `gloo` backend (#3680)
* Update DDP for `torch.distributed.run`

* Add LOCAL_RANK

* remove opt.local_rank

* backend="gloo|nccl"

* print

* print

* debug

* debug

* os.getenv

* gloo

* gloo

* gloo

* cleanup

* fix getenv

* cleanup

* cleanup destroy

* try nccl

* return opt

* add --local_rank

* add timeout

* add init_method

* gloo

* move destroy

* move destroy

* move print(opt) under if RANK

* destroy only RANK 0

* move destroy inside train()

* restore destroy outside train()

* update print(opt)

* cleanup

* nccl

* gloo with 60 second timeout

* update namespace printing
2021-06-19 16:30:25 +02:00
lb-desupervised bfb2276b1d
Slightly modify CLI execution (#3687)
* Slightly modify CLI execution

This simple change makes it easier to run the primary functions of this
repo (train/detect/test) from within Python. An object which represents
`opt` can be constructed and fed to the `main` function of each of these
modules, rather than having to call the lower level functions directly,
or run the module as a script.

* Update export.py

Add CLI parsing update for more convenient module usage within Python.

Co-authored-by: Lewis Belcher <lb@desupervised.io>
2021-06-19 12:06:59 +02:00
Glenn Jocher 2296f1546f
Update `WORLD_SIZE` and `RANK` retrieval (#3670) 2021-06-17 23:24:30 +02:00
Glenn Jocher 045d5d8629
Update TensorBoard (#3669) 2021-06-17 22:12:42 +02:00
Glenn Jocher fa201f968e
Update `train(hyp, *args)` to accept `hyp` file or dict (#3668) 2021-06-17 22:03:25 +02:00
Glenn Jocher 6d6e2ca65f
Update train.py (#3667) 2021-06-17 21:32:39 +02:00
Wei Quan 4c5d9bff80
Fix incorrect end epoch comment (#3612) 2021-06-15 11:24:56 +02:00
Glenn Jocher 4984cf54be
train.py GPU memory fix (#3590)
* train.py GPU memory fix

* ema

* cuda

* cuda

* zeros input

* to device

* batch index 0
2021-06-11 20:24:03 +02:00
Glenn Jocher 4695ca8314
Refactoring cleanup (#3565)
* Refactoring cleanup

* Update test.py
2021-06-09 22:50:27 +02:00
Glenn Jocher 5948f20a3d
Update test.py profiling (#3555)
* Update test.py profiling

* half_precision to half

* inplace
2021-06-09 16:25:17 +02:00
Glenn Jocher 63157d214d
Remove `is_coco` argument from `test()` (#3553) 2021-06-09 15:09:51 +02:00
Glenn Jocher 958ab92dc1
Remove `opt` from `create_dataloader()`` (#3552) 2021-06-09 13:14:56 +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 aad99b63d6
TensorBoard DP/DDP graph fix (#3325) 2021-05-25 11:45:24 +02:00
Charles Frye 19100ba007
Improves docs and handling of entities and resuming by WandbLogger (#3264)
* adds latest tag to match wandb defaults

* adds entity handling, 'last' tag

* fixes bug causing finished runs to resume

* removes redundant "last" tag for wandb artifact
2021-05-21 23:42:53 +02:00
Glenn Jocher dd7f0b7e05
Fix TypeError: 'PosixPath' object is not iterable (#3285) 2021-05-21 23:35:31 +02:00
Glenn Jocher 10d56d784e
Assert `--image-weights` not combined with DDP (#3275) 2021-05-21 14:46:42 +02:00
Glenn Jocher b7cd1f540d
TensorBoard add_graph() fix (#3236) 2021-05-19 13:51:55 +02:00
Glenn Jocher 60fe54449d
Update train.py (#3099) 2021-05-10 15:26:23 +02:00
Glenn Jocher a833ee2a46
Update check_requirements() exclude list (#2974) 2021-04-29 21:16:23 +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 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
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
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
Ayush Chaurasia 518c09578e
W&B resume ddp from run link fix (#2579)
* W&B resume ddp from run link fix

* Native DDP W&B support for training, resuming
2021-03-28 16:11:36 +02:00
Ayush Chaurasia dc51e80b00
Fix: evolve with wandb (#2634) 2021-03-28 16:09:35 +02:00
Glenn Jocher 9f98201dd9
W&B DDP fix 2 (#2587)
Revert unintentional change to test batch sizes caused by PR https://github.com/ultralytics/yolov5/pull/2125
2021-03-24 15:43:32 +01:00
Glenn Jocher e5b0200cd2
Update tensorboard>=2.4.1 (#2576)
* Update tensorboard>=2.4.1 

Update tensorboard version to attempt to address https://github.com/ultralytics/yolov5/issues/2573 (tensorboard logging fail in Docker image).

* cleanup
2021-03-24 01:29:00 +01:00
Ayush Chaurasia 1bf9365280
W&B DDP fix (#2574) 2021-03-23 16:54:34 +01:00
Ayush Chaurasia e8fc97aa38
Improved W&B integration (#2125)
* Init Commit

* new wandb integration

* Update

* Use data_dict in test

* Updates

* Update: scope of log_img

* Update: scope of log_img

* Update

* Update: Fix logging conditions

* Add tqdm bar, support for .txt dataset format

* Improve Result table Logger

* Init Commit

* new wandb integration

* Update

* Use data_dict in test

* Updates

* Update: scope of log_img

* Update: scope of log_img

* Update

* Update: Fix logging conditions

* Add tqdm bar, support for .txt dataset format

* Improve Result table Logger

* Add dataset creation in training script

* Change scope: self.wandb_run

* Add wandb-artifact:// natively

you can now use --resume with wandb run links

* Add suuport for logging dataset while training

* Cleanup

* Fix: Merge conflict

* Fix: CI tests

* Automatically use wandb config

* Fix: Resume

* Fix: CI

* Enhance: Using val_table

* More resume enhancement

* FIX : CI

* Add alias

* Get useful opt config data

* train.py cleanup

* Cleanup train.py

* more cleanup

* Cleanup| CI fix

* Reformat using PEP8

* FIX:CI

* rebase

* remove uneccesary changes

* remove uneccesary changes

* remove uneccesary changes

* remove unecessary chage from test.py

* FIX: resume from local checkpoint

* FIX:resume

* FIX:resume

* Reformat

* Performance improvement

* Fix local resume

* Fix local resume

* FIX:CI

* Fix: CI

* Imporve image logging

* (:(:Redo CI tests:):)

* Remember epochs when resuming

* Remember epochs when resuming

* Update DDP location

Potential fix for #2405

* PEP8 reformat

* 0.25 confidence threshold

* reset train.py plots syntax to previous

* reset epochs completed syntax to previous

* reset space to previous

* remove brackets

* reset comment to previous

* Update: is_coco check, remove unused code

* Remove redundant print statement

* Remove wandb imports

* remove dsviz logger from test.py

* Remove redundant change from test.py

* remove redundant changes from train.py

* reformat and improvements

* Fix typo

* Add tqdm tqdm progress when scanning files, naming improvements

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-03-23 00:44:50 +01:00
Glenn Jocher 08d4918d7f
labels.jpg class names (#2454)
* labels.png class names

* fontsize=10
2021-03-12 22:15:41 -08:00
Glenn Jocher f01f3223d5
Integer printout (#2450)
* Integer printout

* test.py 'Labels'

* Update train.py
2021-03-12 13:35:44 -08:00
Glenn Jocher 886f1c03d8
DDP after autoanchor reorder (#2421) 2021-03-09 23:43:46 -08:00
Glenn Jocher e931b9da33
Resume with custom anchors fix (#2361)
* Resume with custom anchors fix

* Update train.py
2021-03-03 21:06:36 -08:00
Glenn Jocher a3ecf0fd64
Anchor override (#2350) 2021-03-02 23:08:21 -08:00
Glenn Jocher fab5085674
EMA bug fix 2 (#2330)
* EMA bug fix 2

* update
2021-03-01 17:13:34 -08:00
Glenn Jocher dfeec198cb
final_epoch EMA bug fix (#2317) 2021-02-27 12:51:33 -08:00
Jan Hajek efa4946d15
W&B entity support (#2298)
* W&B entity support

* shorten wandb_entity to entity

Co-authored-by: Jan Hajek <jan.hajek@gmail.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2021-02-25 19:18:19 -08:00
Glenn Jocher 71dd2768f2
Improved model+EMA checkpointing 2 (#2295) 2021-02-24 21:03:21 -08:00
Glenn Jocher ec1d8496ba
Improved model+EMA checkpointing (#2292)
* Enhanced model+EMA checkpointing

* update

* bug fix

* bug fix 2

* always save optimizer

* ema half

* remove model.float()

* model half

* carry ema/model in fp32

* rm model.float()

* both to float always

* cleanup

* cleanup
2021-02-24 18:26:46 -08:00
Glenn Jocher ca5b10b759
Update train.py (#2290)
* Update train.py

* Update train.py

* Update train.py

* Update train.py

* Create train.py
2021-02-24 13:31:20 -08:00
Glenn Jocher e27ca0d845
Update minimum stride to 32 (#2266) 2021-02-21 21:46:42 -08:00
Glenn Jocher 6b634c6b87
Linear LR scheduler option (#2150)
* Linear LR scheduler option

* Update train.py
2021-02-06 11:26:54 -08:00
Glenn Jocher ad839eda38
Update train.py (#2149) 2021-02-06 11:21:04 -08:00
Glenn Jocher 86897e3663
Update train.py test batch_size (#2148)
* Update train.py

* Update loss.py
2021-02-06 10:29:32 -08:00
Glenn Jocher 2acbe9699a
W&B epoch logging update (#2073) 2021-01-28 18:57:24 -08:00
Glenn Jocher f639e14e4d
Metric-Confidence plots feature addition (#2057)
* Metric-Confidence plots feature addition

* cleanup

* Metric-Confidence plots feature addition

* cleanup

* Update run-once lines

* cleanup

* save all 4 curves to wandb
2021-01-27 17:10:53 -08:00
Glenn Jocher 59c21c7bcb
W&B log epoch (#1946)
* W&B log epoch

* capitalize

* W&B log epoch

* capitalize

* Update train.py

New try using https://docs.wandb.ai/library/log#incremental-logging

* Update train.py

* Update test.py

* Update train.py

* Update plots.py

* Update train.py

* Update train.py

* label plot step -1

* update

* update

* update

* update

* update

* update

* Update train.py

* Update train.py
2021-01-26 21:16:01 -08:00
Glenn Jocher 046c37e465
verbose on final_epoch (#1997) 2021-01-20 18:27:38 -08:00
Abhiram V e9941d50fa
Update train.py with yaml.SafeLoader (#1972) 2021-01-18 10:49:08 -08:00
huntr.dev | the place to protect open source b5d851d653
Security Fix for Arbitrary Code Execution - huntr.dev (#1962)
Co-authored-by: Anon-Artist <61599526+Anon-Artist@users.noreply.github.com>
Co-authored-by: Jamie Slome <jamie@418sec.com>
2021-01-17 14:10:16 -08:00
Glenn Jocher ca9babb8e6
Add ComputeLoss() class (#1950) 2021-01-15 13:50:24 -08:00
Glenn Jocher f4a78e1b40
W&B mosaic log bug fix (#1949) 2021-01-15 12:09:53 -08:00
Glenn Jocher 777032efbc
Daemon thread mosaic plots fix (#1943) 2021-01-14 13:16:48 -08:00
NanoCode012 3a56cac414
Fix batch-size on resume for multi-gpu (#1942) 2021-01-14 09:53:13 -08:00
Glenn Jocher 509dd51aca
check_git_status() improvements (#1916)
* check_online()

* Update general.py

* update check_git_status()

* reverse rev-parse order

* fetch

* improved responsiveness

* comment

* comment

* remove hyp['giou'] compat warning
2021-01-12 21:51:49 -08:00
Glenn Jocher dd03b20ba5
colorstr() updates (#1909)
* W&B ImportError message fix

* colorstr() updates

* colorstr() updates

* colorstr() default to 'blue', 'bold'

* train: magenta

* train: blue
2021-01-12 10:33:15 -08:00
Glenn Jocher 1d1c0567a4
PyTorch Hub results.render() (#1897) 2021-01-10 20:06:11 -08:00
Glenn Jocher 6ab589583c
Add colorstr() (#1887)
* Add colorful()

* update

* newline fix

* add git description

* --always

* update loss scaling

* update loss scaling 2

* rename to colorstr()
2021-01-09 15:24:18 -08:00
Glenn Jocher e77c77f580
Add check_requirements() (#1853)
* Add check_requirements()

* add import

* parameterize filename

* add to detect, test
2021-01-06 16:35:40 -08:00
Glenn Jocher 69be8e738f
YOLOv5 v4.0 Release (#1837)
* Update C3 module

* Update C3 module

* Update C3 module

* Update C3 module

* update

* update

* update

* update

* update

* update

* update

* update

* update

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* update

* update

* update

* update

* updates

* updates

* updates

* updates

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update datasets

* update

* update

* update

* update attempt_downlaod()

* merge

* merge

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* parameterize eps

* comments

* gs-multiple

* update

* max_nms implemented

* Create one_cycle() function

* update

* update

* update

* update

* update

* update

* update

* update study.png

* update study.png

* Update datasets.py
2021-01-04 19:54:09 -08:00
Glenn Jocher 0e341c5660
Create one_cycle() function (#1836) 2021-01-04 15:49:08 -08:00
Glenn Jocher 7180b22e2d
DDP Multi-GPU --resume bug fix (#1810) 2020-12-30 12:40:45 -08:00
Glenn Jocher 685d601308
Increase plot_labels() speed (#1736) 2020-12-18 18:05:38 -08:00
Glenn Jocher 7e161d9774
Single class train update (#1719) 2020-12-17 12:02:03 -08:00
Glenn Jocher c923fbff90
W&B artifacts feature addition (#1712)
* Log artifacts

* cleanup
2020-12-16 17:52:12 -08:00
Glenn Jocher 8bc0027afc
Update loss criteria constructor (#1711) 2020-12-16 08:39:35 -08:00
Glenn Jocher 7947c86b57
Update COCO train postprocessing (#1702) 2020-12-15 21:50:28 -08:00
Glenn Jocher 791dadb51c
Pycocotools best.pt after COCO train (#1616)
* Pycocotools best.pt after COCO train

* cleanup
2020-12-06 14:58:33 +01:00
Glenn Jocher b6ed1104a6
Daemon thread plotting (#1561)
* Daemon thread plotting

* remove process_batch

* plot after print
2020-11-30 16:44:14 +01:00
Glenn Jocher 9728e2b8ae
--image_weights bug fix (#1524) 2020-11-26 11:49:01 +01:00
Glenn Jocher bde5d9aaaa Update caching (#1496) 2020-11-24 16:23:00 +01:00
Glenn Jocher 0822cda781 Update caching (#1496) 2020-11-24 16:22:02 +01:00
Glenn Jocher 0a3ff71ae0
Confusion matrix (#1474)
* initial commit

* add plotting

* matrix to cpu

* bug fix

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* seaborn pandas to requirements.txt

* seaborn pandas to requirements.txt

* update wandb plotting

* remove pandas

* if plots

* if plots

* if plots

* if plots

* if plots

* initial commit

* add plotting

* matrix to cpu

* bug fix

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* update plot

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* seaborn pandas to requirements.txt

* seaborn pandas to requirements.txt

* update wandb plotting

* remove pandas

* if plots

* if plots

* if plots

* if plots

* if plots

* Cat apriori to autolabels

* cleanup
2020-11-23 15:27:14 +01:00
asim266 9ef4760b74
Rename precision_recall_curve.png bug fix (#1431)
* fix error in train.py line 400, changed precision-recall_curve.png to precision_recall_curve.png and fix error in test.py of {wandb.init() before wandb.log()} by importing wand and initializing it before wand.log()

* Update test.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2020-11-17 23:47:27 +01:00
Glenn Jocher 9c91aeae10
W&B logging add hyperparameters (#1399)
* W&B logging add hyperparameters

* hyp bug fix and image logging updates

* if plots and wandb:

* cleanup

* wandb/ gitignore add

* cleanup 2

* cleanup 3

* move wandb import to top of file

* wandb evolve

* update import

* wandb.run.finish()

* default anchors: 3
2020-11-16 13:35:34 +01:00
Glenn Jocher 0c26c4e831 Increase pycocotools robustness (#1396) 2020-11-14 13:53:58 +01:00
Glenn Jocher fe341fa44d
Utils reorganization (#1392)
* Utils reorganization

* Add new utils files

* cleanup

* simplify

* reduce datasets.py

* remove evolve.sh

* loadWebcam cleanup
2020-11-14 11:50:32 +01:00
Glenn Jocher 379396e896
Yaml constructor posixpath --resume bug fix (#1390)
* resume fix for yaml constructor posixpath error

* fix update

* remove weights/ dir backup
2020-11-13 19:03:02 +01:00
Glenn Jocher c4addd7761
Unified '/project/name' results saving (#1377)
* Project/name update

* Update ci-testing.yml

* address project with path separator failure mode

* Project/name update

* address project with path separator failure mode

* Update ci-testing.yml

* detect.py default --name bug fix

* missing rstrip PR

* train/exp0 to train/exp
2020-11-12 23:37:46 +01:00
Glenn Jocher ce3872f86c
W&B evolution bug fix (#1373) 2020-11-12 12:55:52 +01:00
Khiem Doan 1c8464e199
Use pathlib instead of low-level module (#1329)
* Use pathlib instead of low-level module

* Use pathlib instead of low-level module

* Update detect.py

* Update test.py

* reformat

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2020-11-10 13:01:19 +01:00
Glenn Jocher 4821d076e2
Increment train, test, detect runs/ (#1322)
* Increment train, test, detect runs/

* Update ci-testing.yml

* inference/images to data/images

* move images

* runs/exp to runs/train/exp

* update 'results saved to %s' str
2020-11-08 19:39:05 +01:00
Junghoon Kim 187f7c2ed1
Change optimizer parameters group method (#1239)
* Change optimizer parameters group method

* Add torch nn

* Change isinstance method(torch.Tensor to nn.Parameter)

* parameter freeze fix, PEP8 reformat

* freeze bug fix

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2020-11-02 00:08:36 +01:00
Ayush Chaurasia 96fcde40b8
W&B feature improvements (#1258)
* W&B feature improvements

This PR add:
* Class to id labels. Now, the caption of bounding boxes will display the class name and the class confidence score.
* The project name is set to "Yolov5" and the run name will be set to opt.logdir

* cleanup

* remove parenthesis on caption

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2020-11-01 20:54:29 +01:00
Ayush Chaurasia ca290dca24
Weights & Biases (W&B) Feature Addition (#1235)
* Add wandb metric logging and bounding box debugging

* Improve formatting, readability

* Remove mutliple path for init, improve formatting

* Add wandb params

* Remove typecasting in bbox coordinates and reformat

* Cleanup

* add wandb to requirements.txt

* minor updates to test.py

* general reorg

* reduce --log-imgs to 10

* clean wandb import

* reverse wandb import assert

* add except AssertionError to try import

* move wandb init to all global ranks

* replace print() with logger.info()

* replace print() with logger.info()

* move wandb.init() bug fix

* project PosixPath to basename bug fix

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2020-10-31 20:16:35 +01:00
Glenn Jocher 453acdec67 Update tensorboard logging 2020-10-26 01:08:33 +01:00
Jirka Borovec c67e72200e
fix compatibility for hyper config (#1146)
* fix/hyper

* Hyp giou check to train.py

* restore general.py

* train.py overwrite fix

* restore general.py and pep8 update

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2020-10-15 15:05:58 +02:00
Glenn Jocher 4d3680c81d
Minor import and spelling updates (#1133) 2020-10-13 17:24:27 +02:00
Jirka Borovec 00917a6225
update expt name comment and folder parsing for training (#978)
* comment

* fix parsing

* fix evolve

* folder

* tqdm

* Update train.py

* Update train.py

* reinstate anchors into meta dict

anchor evolution is working correctly now

* reinstate logger

prefer the single line readout for concise logging, which helps simplify notebook and tutorials etc.

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2020-10-13 14:10:21 +02:00
Glenn Jocher 0ada058f63
Generalized regression criterion renaming (#1120) 2020-10-11 17:25:17 +02:00
Glenn Jocher 5fac5ad165
Precision-Recall Curve Feature Addition (#1107)
* initial commit

* Update general.py

Indent update

* Update general.py

refactor duplicate code

* 200 dpi
2020-10-09 14:50:59 +02:00
Glenn Jocher 66676eb039 init_torch_seeds >> init_seeds bug fix 2020-10-06 15:00:47 +02:00
Glenn Jocher f1c63e2784 add mosaic and warmup to hyperparameters (#931) 2020-09-13 14:03:54 -07:00
Glenn Jocher a62a45b2dd prevent testloader caching on --notest 2020-09-11 16:59:13 -07:00
Glenn Jocher c8e51812a5 hyp evolution force-autoanchor fix 2020-09-04 13:13:10 -07:00
Glenn Jocher c687d5c129 reorganize train initialization steps 2020-09-04 12:25:53 -07:00
Glenn Jocher 44cdcc7e0b hyp['anchors'] evolution update 2020-09-03 12:54:22 -07:00
NanoCode012 d8274d0434
Fix results_file not renaming (#903) 2020-09-03 00:47:50 -07:00
Glenn Jocher 281d78c105
Update train.py (#902)
* Update train.py with simplified ckpt names

* Return default hyps to hyp.scratch.yaml

Leave line commented for future use once mystery of best finetuning hyps to apply becomes clearer.

* Force test_batch*_pred.jpg replot on final epoch

This will allow you to see predictions final testing run after training completes in runs/exp0
2020-09-02 15:08:43 -07:00
Naman Gupta 6f3db5e662
Remove autoanchor and class checks on resumed training (#889)
* Class frequency not calculated on resuming training

Calculation of class frequency is not needed when resuming training.
Anchors can still be recalculated whether resuming or not.

* Check rank for autoanchor

* Update train.py

no autoanchor checks on resume

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2020-09-02 09:05:31 -07:00
Glenn Jocher f06e2d518c opt.image_weights bug fix (#885) 2020-08-31 11:05:37 -07:00
Glenn Jocher 69ff781ca5 opt.img_weights bug fix (#885) 2020-08-31 10:33:07 -07:00
Glenn Jocher 08e97a2f88 Update hyperparameters to add lrf, anchors 2020-08-28 14:58:43 -07:00
Glenn Jocher a21bd0687c Update train.py forward simplification 2020-08-25 13:48:03 -07:00
Glenn Jocher 09402a2174 torch.from_tensor() bug fix 2020-08-25 03:14:17 -07:00
Glenn Jocher 83dc540b1d remove ema.ema hasattr(ema, 'module') check 2020-08-22 15:18:39 -07:00
Glenn Jocher 4447f4b937
--resume to same runs/exp directory (#765)
* initial commit

* add weight backup dir on resume
2020-08-20 18:24:33 -07:00
NanoCode012 fb4fc8cd02
Fix ema attribute error in DDP mode (#775)
* Fix ema error in DDP mode

* Update train.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
2020-08-18 09:52:21 -07:00