MCPcopy Create free account
hub / github.com/AllentDan/LibtorchTutorials / YoloBody_tinyImpl

Method YoloBody_tinyImpl

lesson7-Detection/src/models/yolo4_tiny.cpp:26–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26YoloBody_tinyImpl::YoloBody_tinyImpl(int num_anchors, int num_classes) {
27 backbone = CSPdarknet53_tiny();
28 conv_for_P5 = BasicConv(512, 256, 1);
29 yolo_headP5 = yolo_head({ 512, num_anchors * (5 + num_classes) }, 256);
30 upsample = Upsample(256, 128);
31 yolo_headP4 = yolo_head({ 256, num_anchors * (5 + num_classes) }, 384);
32
33 register_module("backbone", backbone);
34 register_module("conv_for_P5", conv_for_P5);
35 register_module("yolo_headP5", yolo_headP5);
36 register_module("upsample", upsample);
37 register_module("yolo_headP4", yolo_headP4);
38}
39std::vector<torch::Tensor> YoloBody_tinyImpl::forward(torch::Tensor x) {
40 //return feat1 with shape of {26,26,256} and feat2 of {13, 13, 512}
41 auto backbone_out = backbone->forward(x);

Callers

nothing calls this directly

Calls 1

yolo_headFunction · 0.85

Tested by

no test coverage detected