From 5f496f8095ef199b2e19d31d0d6a930b1deaad3f Mon Sep 17 00:00:00 2001 From: Alberto Pasqualetto <39854348+albertopasqualetto@users.noreply.github.com> Date: Wed, 17 Apr 2024 20:22:04 +0200 Subject: [PATCH 1/3] Actually download yolov9 --- utils/downloads.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/downloads.py b/utils/downloads.py index a108313b3..7e7e3493b 100644 --- a/utils/downloads.py +++ b/utils/downloads.py @@ -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 @@ -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: From 189a1170cd88a7b898af63e9b652cc82efcb367f Mon Sep 17 00:00:00 2001 From: Alberto Pasqualetto <39854348+albertopasqualetto@users.noreply.github.com> Date: Wed, 17 Apr 2024 20:27:39 +0200 Subject: [PATCH 2/3] Update hubconf.py to accept yolov9c and yolov9e --- hubconf.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hubconf.py b/hubconf.py index b4d6b6e41..6594d1213 100644 --- a/hubconf.py +++ b/hubconf.py @@ -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) From dce994c2719d354f3f61e916f86490f291c0537c Mon Sep 17 00:00:00 2001 From: Alberto Pasqualetto <39854348+albertopasqualetto@users.noreply.github.com> Date: Wed, 17 Apr 2024 20:44:35 +0200 Subject: [PATCH 3/3] GDrive url does not exist anymore --- utils/downloads.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/downloads.py b/utils/downloads.py index 7e7e3493b..4a45c3594 100644 --- a/utils/downloads.py +++ b/utils/downloads.py @@ -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}',