src.yolov5.models package

Submodules

src.yolov5.models.common module

class src.yolov5.models.common.AutoShape(model)[source]

Bases: Module

autoshape()[source]
classes = None
conf = 0.25
forward(imgs, size=640, augment=False, profile=False)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

iou = 0.45
max_det = 1000
training: bool
class src.yolov5.models.common.Bottleneck(c1, c2, shortcut=True, g=1, e=0.5)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.common.BottleneckCSP(c1, c2, n=1, shortcut=True, g=1, e=0.5)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.common.C3(c1, c2, n=1, shortcut=True, g=1, e=0.5)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.common.C3TR(c1, c2, n=1, shortcut=True, g=1, e=0.5)[source]

Bases: C3

training: bool
class src.yolov5.models.common.Classify(c1, c2, k=1, s=1, p=None, g=1)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.common.Concat(dimension=1)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.common.Contract(gain=2)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.common.Conv(c1, c2, k=1, s=1, p=None, g=1, act=True)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

fuseforward(x)[source]
training: bool
src.yolov5.models.common.DWConv(c1, c2, k=1, s=1, act=True)[source]
class src.yolov5.models.common.Detections(imgs, pred, files, times=None, names=None, shape=None)[source]

Bases: object

crop(save_dir='runs/hub/exp')[source]
display(pprint=False, show=False, save=False, crop=False, render=False, save_dir=PosixPath('.'))[source]
pandas()[source]
print()[source]
render()[source]
save(save_dir='runs/hub/exp')[source]
show()[source]
tolist()[source]
class src.yolov5.models.common.Expand(gain=2)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.common.Focus(c1, c2, k=1, s=1, p=None, g=1, act=True)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.common.NMS[source]

Bases: Module

classes = None
conf = 0.25
forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

iou = 0.45
max_det = 1000
training: bool
class src.yolov5.models.common.SPP(c1, c2, k=(5, 9, 13))[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.common.TransformerBlock(c1, c2, num_heads, num_layers)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.common.TransformerLayer(c, num_heads)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
src.yolov5.models.common.autopad(k, p=None)[source]

src.yolov5.models.experimental module

class src.yolov5.models.experimental.CrossConv(c1, c2, k=3, s=1, g=1, e=1.0, shortcut=False)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.experimental.Ensemble[source]

Bases: ModuleList

forward(x, augment=False)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.experimental.GhostBottleneck(c1, c2, k=3, s=1)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.experimental.GhostConv(c1, c2, k=1, s=1, g=1, act=True)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.experimental.MixConv2d(c1, c2, k=(1, 3), s=1, equal_ch=True)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class src.yolov5.models.experimental.Sum(n, weight=False)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
src.yolov5.models.experimental.attempt_load(weights, map_location=None, inplace=True)[source]

src.yolov5.models.export module

Exports a YOLOv5 *.pt model to TorchScript, ONNX, CoreML formats

Usage:

$ python path/to/models/export.py –weights yolov5s.pt –img 640 –batch 1

src.yolov5.models.yolo module

YOLOv5-specific modules

Usage:

$ python path/to/models/yolo.py –cfg yolov5s.yaml

class src.yolov5.models.yolo.Detect(nc=80, anchors=(), ch=(), inplace=True)[source]

Bases: Module

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

onnx_dynamic = False
stride = None
training: bool
class src.yolov5.models.yolo.Model(cfg='yolov5s.yaml', ch=3, nc=None, anchors=None)[source]

Bases: Module

autoshape()[source]
forward(x, augment=False, profile=False)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

forward_augment(x)[source]
forward_once(x, profile=False)[source]
fuse()[source]
info(verbose=False, img_size=640)[source]
nms(mode=True)[source]
training: bool
src.yolov5.models.yolo.parse_model(d, ch)[source]

Module contents