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

Method YOLOLossImpl

lesson7-Detection/src/models/yolo_training.cpp:157–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155
156
157YOLOLossImpl::YOLOLossImpl(torch::Tensor anchors_, int num_classes_, int img_size_[],
158 float label_smooth_, torch::Device device_, bool normalize) {
159 this->anchors = anchors_;
160 this->num_anchors = anchors_.sizes()[0];
161 this->num_classes = num_classes_;
162 this->bbox_attrs = 5 + num_classes;
163 memcpy(image_size, img_size_, 2 * sizeof(int));
164 std::vector<int> feature_length_ = { int(image_size[0] / 32),int(image_size[0] / 16),int(image_size[0] / 8) };
165 std::copy(feature_length_.begin(), feature_length_.end(), feature_length.begin());
166 this->label_smooth = label_smooth_;
167 this->device = device_;
168 this->normalize = normalize;
169}
170
171std::vector<torch::Tensor> YOLOLossImpl::forward(torch::Tensor input, std::vector<torch::Tensor> targets)
172{

Callers

nothing calls this directly

Calls 2

beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected