-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5869720
commit 5cd9fa5
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import torch | ||
from model import YOLOv4 | ||
|
||
dependencies = ['torch'] | ||
|
||
def yolov4(pretrained=False, n_classes=80): | ||
""" | ||
YOLOv4 model | ||
pretrained (bool): kwargs, load pretrained weights into the model | ||
n_classes(int): amount of classes | ||
""" | ||
m = YOLOv4(n_classes=n_classes) | ||
if pretrained: | ||
try: #If we change input or output layers amount, we will have an option to use pretrained weights | ||
m.load_state_dict(torch.hub.load_state_dict_from_url("https://github.com/VCasecnikovs/Yet-Another-YOLOv4-Pytorch/releases/download/V1.0/yolov4.pth"), strict=False) | ||
except RuntimeError as e: | ||
print(f'[Warning] Ignoring {e}') | ||
|
||
return m | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters