|
| 1 | +#pragma once |
| 2 | + |
| 3 | +#include <map> |
| 4 | +#include <string> |
| 5 | +#include <vector> |
| 6 | +#include "NvInfer.h" |
| 7 | + |
| 8 | +using namespace std; |
| 9 | +std::map<std::string, nvinfer1::Weights> loadWeights(const std::string file); |
| 10 | + |
| 11 | +nvinfer1::IScaleLayer* addBatchNorm2d(nvinfer1::INetworkDefinition* network, |
| 12 | + std::map<std::string, nvinfer1::Weights> weightMap, nvinfer1::ITensor& input, |
| 13 | + std::string lname, float eps); |
| 14 | + |
| 15 | +nvinfer1::IElementWiseLayer* convBnSiLU(nvinfer1::INetworkDefinition* network, |
| 16 | + std::map<std::string, nvinfer1::Weights> weightMap, nvinfer1::ITensor& input, |
| 17 | + int ch, std::vector<int> k, int s, std::string lname, int p = 0, int g = 1, |
| 18 | + int d = 1); |
| 19 | + |
| 20 | +nvinfer1::ILayer* Conv(nvinfer1::INetworkDefinition* network, std::map<std::string, nvinfer1::Weights> weightMap, |
| 21 | + nvinfer1::ITensor& input, int c_out, std::string lname, int k = 1, int s = 1, int padding = 0, |
| 22 | + int g = 1, bool act = true); |
| 23 | + |
| 24 | +nvinfer1::IShuffleLayer* DFL(nvinfer1::INetworkDefinition* network, std::map<std::string, nvinfer1::Weights> weightMap, |
| 25 | + nvinfer1::ITensor& input, int ch, int grid, int k, int s, int p, std::string lname); |
| 26 | + |
| 27 | +nvinfer1::IPluginV2Layer* addYoLoLayer(nvinfer1::INetworkDefinition* network, |
| 28 | + std::vector<nvinfer1::IConcatenationLayer*> dets, const int* px_arry, |
| 29 | + int px_arry_num); |
| 30 | + |
| 31 | +nvinfer1::IElementWiseLayer* C3k(nvinfer1::INetworkDefinition* network, |
| 32 | + std::map<std::string, nvinfer1::Weights> weightMap, nvinfer1::ITensor& input, int c2, |
| 33 | + std::string lname, int n = 1, bool shortcut = true, int g = 1, float e = 0.5, |
| 34 | + int k = 3); |
| 35 | + |
| 36 | +nvinfer1::IElementWiseLayer* C3K2(nvinfer1::INetworkDefinition* network, |
| 37 | + std::map<std::string, nvinfer1::Weights>& weightMap, nvinfer1::ITensor& input, int c2, |
| 38 | + int n, std::string lname, bool c3k = false, float e = 0.5, int g = 1, |
| 39 | + bool shortcut = true); |
| 40 | + |
| 41 | +nvinfer1::ILayer* AAttn(nvinfer1::INetworkDefinition* network, std::map<std::string, nvinfer1::Weights> weightMap, |
| 42 | + nvinfer1::ITensor& input, int dim, int num_heads, std::string lname, int area = 1); |
| 43 | + |
| 44 | +nvinfer1::ILayer* DWConv(nvinfer1::INetworkDefinition* network, std::map<std::string, nvinfer1::Weights> weightMap, |
| 45 | + nvinfer1::ITensor& input, int ch, std::vector<int> k, int s, std::string lname); |
| 46 | + |
| 47 | +nvinfer1::IElementWiseLayer* ABlock(nvinfer1::INetworkDefinition* network, |
| 48 | + std::map<std::string, nvinfer1::Weights> weightMap, nvinfer1::ITensor& input, |
| 49 | + int dim, int num_heads, std::string lname, float mlp_ratio = 1.2, int area = 1); |
| 50 | + |
| 51 | +nvinfer1::ILayer* A2C2f(nvinfer1::INetworkDefinition* network, std::map<std::string, nvinfer1::Weights>, |
| 52 | + nvinfer1::ITensor& input, int c2, int n, std::string lname, bool a2 = true, int area = 1, |
| 53 | + bool residual = false, float mlp_ratio = 2.0, float e = 0.5, int g = 1, bool shortcut = true); |
| 54 | + |
| 55 | +nvinfer1::IElementWiseLayer* DSConv(nvinfer1::INetworkDefinition* network, |
| 56 | + std::map<std::string, nvinfer1::Weights> weightMap, nvinfer1::ITensor& input, |
| 57 | + int c_in, int c_out, std::string lname, int k = 3, int s = 1, int p = 0, int d = 1, |
| 58 | + bool bias = false); |
| 59 | + |
| 60 | +nvinfer1::ILayer* DSBottleneck(nvinfer1::INetworkDefinition* network, |
| 61 | + std::map<std::string, nvinfer1::Weights> weightMap, nvinfer1::ITensor& input, int c1, |
| 62 | + int c2, std::string lname, bool shortcut = true, float e = 0.5, int k1 = 3, int k2 = 5, |
| 63 | + int d2 = 1); |
| 64 | + |
| 65 | +nvinfer1::ILayer* DSC3k(nvinfer1::INetworkDefinition* network, std::map<std::string, nvinfer1::Weights> weightMap, |
| 66 | + nvinfer1::ITensor& input, int c2, int n, std::string lname, bool shortcut = true, int g = 1, |
| 67 | + float e = 0.5, int k1 = 3, int k2 = 5, int d2 = 1); |
| 68 | + |
| 69 | +nvinfer1::ILayer* DSC3K2(nvinfer1::INetworkDefinition* network, std::map<std::string, nvinfer1::Weights> weightMap, |
| 70 | + nvinfer1::ITensor& input, int c2, std::string lname, int n = 1, bool dsc3k = false, |
| 71 | + float e = 0.5, int g = 1, bool shortcut = true, int k1 = 3, int k2 = 7, int d2 = 1); |
| 72 | + |
| 73 | +nvinfer1::ILayer* FuseModule(nvinfer1::INetworkDefinition* network, std::map<std::string, nvinfer1::Weights> weightMap, |
| 74 | + std::vector<nvinfer1::ITensor*>& input, int c_in, bool channel_adjust, std::string lname); |
| 75 | + |
| 76 | +// nvinfer1::ILayer* FuseModule(nvinfer1::INetworkDefinition* network, std::map<std::string, nvinfer1::Weights> weightMap, |
| 77 | +// std::vector<nvinfer1::ITensor*>input, int c_in, bool channel_adjust, std::string lname); |
| 78 | + |
| 79 | +nvinfer1::ISoftMaxLayer* AdaHyperedgeGen(nvinfer1::INetworkDefinition* network, |
| 80 | + std::map<std::string, nvinfer1::Weights> weightMap, nvinfer1::ITensor& input, |
| 81 | + int node_dim, int num_hyperedges, std::string lname, int num_heads = 4, |
| 82 | + std::string context = "both"); |
| 83 | + |
| 84 | +nvinfer1::IElementWiseLayer* GELU(nvinfer1::INetworkDefinition* network, nvinfer1::ITensor& input); |
| 85 | + |
| 86 | +nvinfer1::IElementWiseLayer* AdaHGConv(nvinfer1::INetworkDefinition* network, |
| 87 | + std::map<std::string, nvinfer1::Weights> weightMap, nvinfer1::ITensor& input, |
| 88 | + int embed_dim, std::string lname, int num_hyperedges = 16, int num_heads = 4, |
| 89 | + std::string context = "both"); |
| 90 | + |
| 91 | +nvinfer1::IShuffleLayer* AdaHGComputation(nvinfer1::INetworkDefinition* network, |
| 92 | + std::map<std::string, nvinfer1::Weights> weightMap, nvinfer1::ITensor& input, |
| 93 | + int embed_dim, std::string lname, int num_hyperedges = 16, int num_heads = 8, |
| 94 | + std::string context = "both"); |
| 95 | + |
| 96 | +nvinfer1::ILayer* C3AH(nvinfer1::INetworkDefinition* network, std::map<std::string, nvinfer1::Weights> weightMap, |
| 97 | + nvinfer1::ITensor& input, int c2, std::string lname, float e = 1.0, int num_hyperedges = 8, |
| 98 | + std::string context = "both"); |
| 99 | + |
| 100 | +nvinfer1::ILayer* HyperACE(nvinfer1::INetworkDefinition* network, std::map<std::string, nvinfer1::Weights> weightMap, |
| 101 | + std::vector<nvinfer1::ITensor*> input, int c1, int c2, std::string lname, int n = 1, |
| 102 | + int num_hyperedges = 8, bool dsc3k = false, bool shortcut = false, float e1 = 0.5, |
| 103 | + float e2 = 1, std::string context = "both", bool channel_adjust = true); |
| 104 | + |
| 105 | +nvinfer1::ILayer* DownsampleConv(nvinfer1::INetworkDefinition* network, |
| 106 | + std::map<std::string, nvinfer1::Weights> weightMap, nvinfer1::ITensor& input, |
| 107 | + int in_channels, std::string lname, bool channel_adjust); |
| 108 | + |
| 109 | +nvinfer1::IElementWiseLayer* FullPad_Tunnel(nvinfer1::INetworkDefinition* network, |
| 110 | + std::map<std::string, nvinfer1::Weights> weightMap, |
| 111 | + std::vector<nvinfer1::ITensor*> input, std::string lname); |
| 112 | + |
| 113 | +nvinfer1::ILayer* DownsampleConv(nvinfer1::INetworkDefinition* network, |
| 114 | + std::map<std::string, nvinfer1::Weights> weightMap, nvinfer1::ITensor& input, |
| 115 | + int in_channels, std::string lname, bool channel_adjust = true); |
| 116 | + |
| 117 | +void cout_dim(nvinfer1::ITensor& input); |
0 commit comments