src.yolov5.models package
Submodules
src.yolov5.models.common module
- class src.yolov5.models.common.AutoShape(model)[source]
Bases:
Module
- 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.
- training: bool
- class src.yolov5.models.common.Detections(imgs, pred, files, times=None, names=None, shape=None)[source]
Bases:
object
- 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.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.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
- 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.
- training: bool