YOLOv5 v5.0 Release (#2762)
This commit is contained in:
1 parent
e2b7bc0b32
commit
f5b8f7d54c
3 files changed
+68
-77
No files matched your search
+41
-57
@@ -55,64 +55,8 @@ def create(name, pretrained, channels, classes, autoshape):
|
||||
raise Exception(s) from e
|
||||
|
||||
|
||||
def yolov5s(pretrained=True, channels=3, classes=80, autoshape=True):
|
||||
"""YOLOv5-small model from https://github.com/ultralytics/yolov5
|
||||
|
||||
Arguments:
|
||||
pretrained (bool): load pretrained weights into the model, default=False
|
||||
channels (int): number of input channels, default=3
|
||||
classes (int): number of model classes, default=80
|
||||
|
||||
Returns:
|
||||
pytorch model
|
||||
"""
|
||||
return create('yolov5s', pretrained, channels, classes, autoshape)
|
||||
|
||||
|
||||
def yolov5m(pretrained=True, channels=3, classes=80, autoshape=True):
|
||||
"""YOLOv5-medium model from https://github.com/ultralytics/yolov5
|
||||
|
||||
Arguments:
|
||||
pretrained (bool): load pretrained weights into the model, default=False
|
||||
channels (int): number of input channels, default=3
|
||||
classes (int): number of model classes, default=80
|
||||
|
||||
Returns:
|
||||
pytorch model
|
||||
"""
|
||||
return create('yolov5m', pretrained, channels, classes, autoshape)
|
||||
|
||||
|
||||
def yolov5l(pretrained=True, channels=3, classes=80, autoshape=True):
|
||||
"""YOLOv5-large model from https://github.com/ultralytics/yolov5
|
||||
|
||||
Arguments:
|
||||
pretrained (bool): load pretrained weights into the model, default=False
|
||||
channels (int): number of input channels, default=3
|
||||
classes (int): number of model classes, default=80
|
||||
|
||||
Returns:
|
||||
pytorch model
|
||||
"""
|
||||
return create('yolov5l', pretrained, channels, classes, autoshape)
|
||||
|
||||
|
||||
def yolov5x(pretrained=True, channels=3, classes=80, autoshape=True):
|
||||
"""YOLOv5-xlarge model from https://github.com/ultralytics/yolov5
|
||||
|
||||
Arguments:
|
||||
pretrained (bool): load pretrained weights into the model, default=False
|
||||
channels (int): number of input channels, default=3
|
||||
classes (int): number of model classes, default=80
|
||||
|
||||
Returns:
|
||||
pytorch model
|
||||
"""
|
||||
return create('yolov5x', pretrained, channels, classes, autoshape)
|
||||
|
||||
|
||||
def custom(path_or_model='path/to/model.pt', autoshape=True):
|
||||
"""YOLOv5-custom model from https://github.com/ultralytics/yolov5
|
||||
"""YOLOv5-custom model https://github.com/ultralytics/yolov5
|
||||
|
||||
Arguments (3 options):
|
||||
path_or_model (str): 'path/to/model.pt'
|
||||
@@ -135,6 +79,46 @@ def custom(path_or_model='path/to/model.pt', autoshape=True):
|
||||
return hub_model.to(device)
|
||||
|
||||
|
||||
def yolov5s(pretrained=True, channels=3, classes=80, autoshape=True):
|
||||
# YOLOv5-small model https://github.com/ultralytics/yolov5
|
||||
return create('yolov5s', pretrained, channels, classes, autoshape)
|
||||
|
||||
|
||||
def yolov5m(pretrained=True, channels=3, classes=80, autoshape=True):
|
||||
# YOLOv5-medium model https://github.com/ultralytics/yolov5
|
||||
return create('yolov5m', pretrained, channels, classes, autoshape)
|
||||
|
||||
|
||||
def yolov5l(pretrained=True, channels=3, classes=80, autoshape=True):
|
||||
# YOLOv5-large model https://github.com/ultralytics/yolov5
|
||||
return create('yolov5l', pretrained, channels, classes, autoshape)
|
||||
|
||||
|
||||
def yolov5x(pretrained=True, channels=3, classes=80, autoshape=True):
|
||||
# YOLOv5-xlarge model https://github.com/ultralytics/yolov5
|
||||
return create('yolov5x', pretrained, channels, classes, autoshape)
|
||||
|
||||
|
||||
def yolov5s6(pretrained=True, channels=3, classes=80, autoshape=True):
|
||||
# YOLOv5-small model https://github.com/ultralytics/yolov5
|
||||
return create('yolov5s6', pretrained, channels, classes, autoshape)
|
||||
|
||||
|
||||
def yolov5m6(pretrained=True, channels=3, classes=80, autoshape=True):
|
||||
# YOLOv5-medium model https://github.com/ultralytics/yolov5
|
||||
return create('yolov5m6', pretrained, channels, classes, autoshape)
|
||||
|
||||
|
||||
def yolov5l6(pretrained=True, channels=3, classes=80, autoshape=True):
|
||||
# YOLOv5-large model https://github.com/ultralytics/yolov5
|
||||
return create('yolov5l6', pretrained, channels, classes, autoshape)
|
||||
|
||||
|
||||
def yolov5x6(pretrained=True, channels=3, classes=80, autoshape=True):
|
||||
# YOLOv5-xlarge model https://github.com/ultralytics/yolov5
|
||||
return create('yolov5x6', pretrained, channels, classes, autoshape)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
model = create(name='yolov5s', pretrained=True, channels=3, classes=80, autoshape=True) # pretrained example
|
||||
# model = custom(path_or_model='path/to/model.pt') # custom example
|
||||
|
||||
Reference in new issue
Block a user