ultralytics 8.0.204 Segment ONNX Runtime example (#6088)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: Kapil Raj <103250862+raj-kapil@users.noreply.github.com> Co-authored-by: jamjamjon <51357717+jamjamjon@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: snyk-bot <snyk-bot@snyk.io>
This commit is contained in:
parent
465df3024f
commit
ff0aba10c5
20 changed files with 563 additions and 37 deletions
|
|
@ -34,7 +34,7 @@ def autobatch(model, imgsz=640, fraction=0.60, batch_size=DEFAULT_CFG.batch):
|
|||
Args:
|
||||
model (torch.nn.module): YOLO model to compute batch size for.
|
||||
imgsz (int, optional): The image size used as input for the YOLO model. Defaults to 640.
|
||||
fraction (float, optional): The fraction of available CUDA memory to use. Defaults to 0.67.
|
||||
fraction (float, optional): The fraction of available CUDA memory to use. Defaults to 0.60.
|
||||
batch_size (int, optional): The default batch size to use if an error is detected. Defaults to 16.
|
||||
|
||||
Returns:
|
||||
|
|
|
|||
|
|
@ -262,6 +262,14 @@ def safe_download(url,
|
|||
min_bytes (float, optional): The minimum number of bytes that the downloaded file should have, to be considered
|
||||
a successful download. Default: 1E0.
|
||||
progress (bool, optional): Whether to display a progress bar during the download. Default: True.
|
||||
|
||||
Example:
|
||||
```python
|
||||
from ultralytics.utils.downloads import safe_download
|
||||
|
||||
link = "https://ultralytics.com/assets/bus.jpg"
|
||||
path = safe_download(link)
|
||||
```
|
||||
"""
|
||||
|
||||
# Check if the URL is a Google Drive link
|
||||
|
|
@ -269,11 +277,8 @@ def safe_download(url,
|
|||
if gdrive:
|
||||
url, file = get_google_drive_file_info(url)
|
||||
|
||||
f = dir / (file if gdrive else url2file(url)) if dir else Path(file) # URL converted to filename
|
||||
if '://' not in str(url) and Path(url).is_file(): # URL exists ('://' check required in Windows Python<3.10)
|
||||
f = Path(url) # filename
|
||||
elif not f.is_file(): # URL and file do not exist
|
||||
assert dir or file, 'dir or file required for download'
|
||||
f = Path(dir or '.') / (file or url2file(url)) # URL converted to filename
|
||||
if not f.is_file(): # URL and file do not exist
|
||||
desc = f"Downloading {url if gdrive else clean_url(url)} to '{f}'"
|
||||
LOGGER.info(f'{desc}...')
|
||||
f.parent.mkdir(parents=True, exist_ok=True) # make directory if missing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue