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
3年前
Glenn Jocher
c47be26f34
Replace `path.absolute()` with `path.resolve()` ( #4763 )
3年前
Zegorax
2d9411dbb8
Scope `onnx-simplifier` requirements check ( #4730 )
* Changed onnx-simplifier check behavior
Export.py has been updated to check for onnx-simplifier requirement only when the --simplify argument is added.
Allows for better flexibility and one less requirement if simplify is not needed.
* Fix single-element tuples
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
3年前
Glenn Jocher
8b18b66304
ONNX opset 13 ( #4566 )
3年前
Glenn Jocher
d1182c4f29
`check_requirements(('coremltools',))` ( #4478 )
* `check_requirements(('coremltools',))`
* Update ci-testing.yml
* Update ci-testing.yml
3年前
Glenn Jocher
24bea5e4b7
Standardize headers and docstrings ( #4417 )
* Implement new headers
* Reformat 1
* Reformat 2
* Reformat 3 - math
* Reformat 4 - yaml
3年前
Glenn Jocher
57c342a6a5
Simplify ONNX inference command ( #4405 )
3年前
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>
3年前
Glenn Jocher
388016e9e3
Update 'results saved to' string ( #4275 )
3年前
Glenn Jocher
6e4358f3f3
Add `export.py` ONNX inference suggestion ( #4146 )
3年前
Glenn Jocher
264be1a616
Rename `opset_version` to `opset` ( #4135 )
3年前
Glenn Jocher
3bef77f5cb
Addition refactor `export.py` ( #4089 )
* Addition refactor `export.py`
* Update export.py
3年前
Glenn Jocher
442a7abdf2
Refactor `export.py` ( #4080 )
* Refactor `export.py`
* cleanup
* Update check_requirements()
* Update export.py
3年前
fcakyon
0e2d0d54d7
Fix typo ( #3729 )
3年前
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
3年前
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
3年前
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>
3年前
Glenn Jocher
53ed872c28
Update export.py, yolo.py `sys.path.append()` ( #3579 )
3年前
Glenn Jocher
0e5cfdbea7
Refactor models/export.py arguments ( #3564 )
* Refactor models/export.py arguments
* cleanup
* cleanup
3年前
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>
3年前
Yonghye Kwon
8d1ddc93c7
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
3年前
Yonghye Kwon
a1c3572bc9
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>
3年前
Sam_S
044daafd9d
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>
3年前
WangChaofeng
ef4d53818d
ONNX export in .train() mode fix ( #3362 )
3年前
Glenn Jocher
7b36e38cf8
Check CoreML models.train() mode ( #3262 )
* Check CoreML models.train() mode
* Update export.py
3年前
Cristi Fati
9ab561dbfc
Parameterize ONNX `--opset-version` ( #3154 )
3年前
Cristi Fati
d9b4e6b748
Add `--include torchscript onnx coreml` argument ( #3137 )
* Allow users to skip exporting in formats that they don't care about
* Correct comments
* Update export.py
renamed --skip-format to --exclude
* Switched format from exclude to include (as instructed by @glenn-jocher )
* cleanup
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
3年前
Glenn Jocher
525f4f86a9
Add --optimize argument ( #3093 )
Fix for c++ runtime errors in https://github.com/ultralytics/yolov5/issues/2973
3年前
Glenn Jocher
e97d129db4
Update export.py with --train mode argument ( #3066 )
3年前
Glenn Jocher
3ef3a95cfa
Do not optimize CoreML TorchScript model ( #3055 )
3年前
jylink
b292837e36
Fix ONNX export using --grid --simplify --dynamic simultaneously ( #2982 )
* Update yolo.py
* Update export.py
* fix export grid
* Update export.py, remove detect export attribute
* rearrange if order
* remove --grid, default inplace=False
* rename exp_dynamic to onnx_dynamic, comment
* replace bs with 1 in anchor_grid[i] index 0
* Update export.py
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
3年前
Hodovo
e2a80c6c0f
Add support for FP16 (half) to export.py ( #3010 )
* Added support for fp16 (half) to export.py
* minimize code additions
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
3年前
Glenn Jocher
4200674a13
Add yolov5/ to sys.path() for *.py subdir exec ( #2949 )
* Add yolov5/ to sys.path() for *.py subdir exec
* Update export.py
3年前
Glenn Jocher
1b1ab4cca2
Add file_size() function ( #2911 )
* Add file_size() function
* Update export.py
3年前
Glenn Jocher
646386ff09
Update export.py for 2 dry runs ( #2910 )
* Update export.py for 2 dry runs
* Update export.py
3年前
Glenn Jocher
a2a514dec8
Update export.py ( #2909 )
3年前
Glenn Jocher
28db237639
Default optimize_for_mobile() on TorchScript models ( #2908 )
Per https://pytorch.org/tutorials/recipes/script_optimized.html this should improve performance on torchscript models (and maybe coreml models also since coremltools operates on a torchscript model input, though this still requires testing).
3年前
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>
3年前
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
3年前
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
3年前
Jan Hajek
7a0a81fd1d
GPU export options ( #2297 )
* option for skip last layer and cuda export support
* added parameter device
* fix import
* cleanup 1
* cleanup 2
* opt-in grid
--grid will export with grid computation, default export will skip grid (same as current)
* default --device cpu
GPU export causes ONNX and CoreML errors.
Co-authored-by: Jan Hajek <jan.hajek@gmail.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
3年前
Aditya Lohia
95aefea493
Dynamic ONNX engine generation ( #2208 )
* add: dynamic onnx export
* delete: test onnx inference
* fix dynamic output axis
* Code reduction
* fix: dynamic output axes, dynamic input naming
* Remove fixed axes
Co-authored-by: Shivam Swanrkar <ss8464@nyu.edu>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
3年前
Glenn Jocher
6bd5e8bca7
nn.SiLU() export support ( #1713 )
3年前
Glenn Jocher
d45e349a1e
Rearrange export input after checks ( #1118 )
img size checks are warnings rather than errors, so current implementation allows improperly formed model inputs.
4年前
Glenn Jocher
883924d9dc
classifier, export, torch seed updates
4年前
Glenn Jocher
a12698f4c9
Update ci-testing.yml reflecting sys.path additions ( #869 )
* Update ci-testing.yml
* Update yolo.py
* Update ci-testing.yml
* Update export.py
* Update yolo.py
4年前
PetrDvoracek
d55c326dda
export.py folder sys.path addition ( #1052 )
4年前
Glenn Jocher
d68179953d
Update export.py
4年前
Glenn Jocher
1e7674d4dd
Update export.py --img-size comment
4年前
Glenn Jocher
4fb8cb353f
Update export.py with v3.0 Hardswish() support ( #831 )
4年前