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

This should fix hubconf.py #367

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions hubconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
raise Exception(s) from e


def yolov9c(pretrained=True, channels=3, classes=80, autoshape=True, _verbose=True, device=None):
"""Creates YOLOv9-compact model with options for pretraining, input channels, class count, autoshaping, verbosity, and
device.
"""
return _create("yolov9-c", pretrained, channels, classes, autoshape, _verbose, device)


def yolov9e(pretrained=True, channels=3, classes=80, autoshape=True, _verbose=True, device=None):
"""Creates YOLOv9-extended model with options for pretraining, input channels, class count, autoshaping, verbosity, and
device.
"""
return _create("yolov9-e", pretrained, channels, classes, autoshape, _verbose, device)


def custom(path='path/to/model.pt', autoshape=True, _verbose=True, device=None):
# YOLO custom or local model
return _create(path, autoshape=autoshape, verbose=_verbose, device=device)
Expand Down
6 changes: 3 additions & 3 deletions utils/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def safe_download(file, url, url2=None, min_bytes=1E0, error_msg=''):
LOGGER.info('')


def attempt_download(file, repo='ultralytics/yolov5', release='v7.0'):
def attempt_download(file, repo='WongKinYiu/yolov9', release='latest'):
# Attempt file download from GitHub release assets if not found locally. release = 'latest', 'v7.0', etc.
from utils.general import LOGGER

Expand All @@ -79,7 +79,7 @@ def github_assets(repository, version='latest'):
return file

# GitHub assets
assets = [f'yolov5{size}{suffix}.pt' for size in 'nsmlx' for suffix in ('', '6', '-cls', '-seg')] # default
assets = [f'yolov9{size}{suffix}.pt' for size in ('', '-c', '-e', '-relu') for suffix in ('', '-cls', '-seg')] # default
try:
tag, assets = github_assets(repo, release)
except Exception:
Expand All @@ -93,7 +93,7 @@ def github_assets(repository, version='latest'):

file.parent.mkdir(parents=True, exist_ok=True) # make parent dir (if required)
if name in assets:
url3 = 'https://drive.google.com/drive/folders/1EFQTEUeXWSFww0luse2jB9M1QNZQGwNl' # backup gdrive mirror
url3 = 'https://drive.google.com/drive/folders/1EFQTEUeXWSFww0luse2jB9M1QNZQGwNl' # backup gdrive mirror DOES NOT EXIST!
safe_download(
file,
url=f'https://github.com/{repo}/releases/download/{tag}/{name}',
Expand Down