Skip to content

Commit a01fae5

Browse files
xupengaowang-xinyu
andauthored
yolov6 6.0 Modification and optimization (wang-xinyu#764)
* Add files via upload * check_file * remove invalid data * remove data * Optimization and modification add all yolo model Co-authored-by: Wang Xinyu <[email protected]>
1 parent bcc01fa commit a01fae5

File tree

2 files changed

+464
-425
lines changed

2 files changed

+464
-425
lines changed

yolov5/common.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,26 @@ ILayer* SPPF(INetworkDefinition *network, std::map<std::string, Weights>& weight
283283

284284

285285

286+
// SPPF
287+
ILayer* SPPF(INetworkDefinition *network, std::map<std::string, Weights>& weightMap, ITensor& input, int c1, int c2, int k, std::string lname) {
288+
int c_ = c1 / 2;
289+
auto cv1 = convBlock(network, weightMap, input, c_, 1, 1, 1, lname + ".cv1");
290+
291+
auto pool1 = network->addPoolingNd(*cv1->getOutput(0), PoolingType::kMAX, DimsHW{ k, k });
292+
pool1->setPaddingNd(DimsHW{ k / 2, k / 2 });
293+
pool1->setStrideNd(DimsHW{ 1, 1 });
294+
auto pool2 = network->addPoolingNd(*pool1->getOutput(0), PoolingType::kMAX, DimsHW{ k, k });
295+
pool2->setPaddingNd(DimsHW{ k / 2, k / 2 });
296+
pool2->setStrideNd(DimsHW{ 1, 1 });
297+
auto pool3 = network->addPoolingNd(*pool2->getOutput(0), PoolingType::kMAX, DimsHW{ k, k });
298+
pool3->setPaddingNd(DimsHW{ k / 2, k / 2 });
299+
pool3->setStrideNd(DimsHW{ 1, 1 });
300+
ITensor* inputTensors[] = { cv1->getOutput(0), pool1->getOutput(0), pool2->getOutput(0), pool3->getOutput(0) };
301+
auto cat = network->addConcatenation(inputTensors, 4);
302+
auto cv2 = convBlock(network, weightMap, *cat->getOutput(0), c2, 1, 1, 1, lname + ".cv2");
303+
return cv2;
304+
}
305+
286306
std::vector<std::vector<float>> getAnchors(std::map<std::string, Weights>& weightMap, std::string lname) {
287307
std::vector<std::vector<float>> anchors;
288308
Weights wts = weightMap[lname + ".anchor_grid"];

0 commit comments

Comments
 (0)