Fixes for running master branch on windows
This commit has fixes in the form of __declspec(dllexport) and __declspec(dllimport) to run the tkdnn master branch on windows along with removing cmake_export_all_symbols and solely using __declspec(dllexport)
This commit is contained in:
+6
-1
@@ -61,7 +61,6 @@ if(WIN32)
|
||||
set(CMAKE_CXX_FLAGS "/Od /FS /EHsc /MDd")
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --maxrregcount=32 -G -g)
|
||||
endif()
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
endif(WIN32)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/tkDNN)
|
||||
@@ -82,7 +81,13 @@ endif()
|
||||
#-------------------------------------------------------------------------------
|
||||
# CUDA
|
||||
#-------------------------------------------------------------------------------
|
||||
if(UNIX)
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" --compiler-options '-fPIC')
|
||||
endif(UNIX)
|
||||
|
||||
if(WIN32)
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" --compiler-options)
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
find_package(CUDNN REQUIRED)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +1,9 @@
|
||||
# video input
|
||||
input : "../demo/yolo_test.mp4"
|
||||
win_input : "..\\..\\..\\demo\\yolo_test.mp4"
|
||||
win_input : "..\\demo\\yolo_test.mp4"
|
||||
|
||||
# network config
|
||||
net : "yolo4_berkeley_fp32.rt"
|
||||
net : "yolo4tiny_fp32.rt"
|
||||
ntype : 'y'
|
||||
n_classes : 80
|
||||
n_batch : 1
|
||||
|
||||
@@ -170,12 +170,12 @@ public:
|
||||
tk::dnn::Network *pre_phase_net = nullptr;
|
||||
CenterTrack() {};
|
||||
~CenterTrack() {};
|
||||
bool init(const std::string& tensor_path, const int n_classes=3, const int n_batches=1,
|
||||
TKDNN_LIB_EXPORT_API bool init(const std::string& tensor_path, const int n_classes=3, const int n_batches=1,
|
||||
const float conf_thresh=0.3, const bool mode_3d=true,
|
||||
const std::vector<cv::Mat>& k_calibs=std::vector<cv::Mat>());
|
||||
void preprocess(cv::Mat &frame, const int bi=0);
|
||||
void postprocess(const int bi=0,const bool mAP=false);
|
||||
void draw(std::vector<cv::Mat>& frames);
|
||||
TKDNN_LIB_EXPORT_API void preprocess(cv::Mat &frame, const int bi=0);
|
||||
TKDNN_LIB_EXPORT_API void postprocess(const int bi=0,const bool mAP=false);
|
||||
TKDNN_LIB_EXPORT_API void draw(std::vector<cv::Mat>& frames);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -73,9 +73,9 @@ public:
|
||||
CenternetDetection() {};
|
||||
~CenternetDetection() {};
|
||||
|
||||
bool init(const std::string& tensor_path, const int n_classes=80, const int n_batches=1, const float conf_thresh=0.3);
|
||||
void preprocess(cv::Mat &frame, const int bi=0);
|
||||
void postprocess(const int bi=0,const bool mAP=false);
|
||||
TKDNN_LIB_EXPORT_API bool init(const std::string& tensor_path, const int n_classes=80, const int n_batches=1, const float conf_thresh=0.3);
|
||||
TKDNN_LIB_EXPORT_API void preprocess(cv::Mat &frame, const int bi=0);
|
||||
TKDNN_LIB_EXPORT_API void postprocess(const int bi=0,const bool mAP=false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -92,10 +92,10 @@ public:
|
||||
CenternetDetection3D() {};
|
||||
~CenternetDetection3D() {};
|
||||
|
||||
bool init(const std::string& tensor_path, const int n_classes=3, const int n_batches=1, const float conf_thresh=0.3, const std::vector<cv::Mat>& k_calibs=std::vector<cv::Mat>());
|
||||
void preprocess(cv::Mat &frame, const int bi=0);
|
||||
void postprocess(const int bi=0,const bool mAP=false);
|
||||
void draw(std::vector<cv::Mat>& frames);
|
||||
TKDNN_LIB_EXPORT_API bool init(const std::string& tensor_path, const int n_classes=3, const int n_batches=1, const float conf_thresh=0.3, const std::vector<cv::Mat>& k_calibs=std::vector<cv::Mat>());
|
||||
TKDNN_LIB_EXPORT_API void preprocess(cv::Mat &frame, const int bi=0);
|
||||
TKDNN_LIB_EXPORT_API void postprocess(const int bi=0,const bool mAP=false);
|
||||
TKDNN_LIB_EXPORT_API void draw(std::vector<cv::Mat>& frames);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace tk { namespace dnn {
|
||||
void darknetAddLayer(tk::dnn::Network *net, darknetFields_t &f, std::string wgs_path,
|
||||
std::vector<tk::dnn::Layer*> &netLayers, const std::vector<std::string>& names);
|
||||
std::vector<std::string> darknetReadNames(const std::string& names_file);
|
||||
tk::dnn::Network* darknetParser(const std::string& cfg_file, const std::string& wgs_path, const std::string& names_file);
|
||||
TKDNN_LIB_EXPORT_API tk::dnn::Network* darknetParser(const std::string& cfg_file, const std::string& wgs_path, const std::string& names_file);
|
||||
void loadYoloInfo(const std::string &cfg_file,int lineNo,std::vector<float> &mask,std::vector<float> &anchors,int &num,int &classes,float &nms_thresh,int &nms_kind,int &coords);
|
||||
void loadYoloInitInfo(int &channels,int &width,int &height,const std::string &cfg_file);
|
||||
std::vector<int> noYolosLine(const std::string &cfg_file);
|
||||
|
||||
+29
-29
@@ -43,8 +43,8 @@ enum layerType_t {
|
||||
class Layer {
|
||||
|
||||
public:
|
||||
Layer(Network *net);
|
||||
virtual ~Layer();
|
||||
TKDNN_LIB_EXPORT_API Layer(Network *net);
|
||||
TKDNN_LIB_EXPORT_API virtual ~Layer();
|
||||
virtual layerType_t getLayerType() = 0;
|
||||
|
||||
virtual dnnType* infer(dataDim_t &dim, dnnType* srcData) {
|
||||
@@ -208,8 +208,8 @@ public:
|
||||
class Dense : public LayerWgs {
|
||||
|
||||
public:
|
||||
Dense(Network *net, int out_ch, std::string fname_weights);
|
||||
virtual ~Dense();
|
||||
TKDNN_LIB_EXPORT_API Dense(Network *net, int out_ch, std::string fname_weights);
|
||||
TKDNN_LIB_EXPORT_API virtual ~Dense();
|
||||
virtual layerType_t getLayerType() { return LAYER_DENSE; };
|
||||
|
||||
virtual dnnType* infer(dataDim_t &dim, dnnType* srcData);
|
||||
@@ -236,8 +236,8 @@ public:
|
||||
float ceiling;
|
||||
float slope;
|
||||
|
||||
Activation(Network *net, int act_mode, const float ceiling=0.0, const float slope=0.1);
|
||||
virtual ~Activation();
|
||||
TKDNN_LIB_EXPORT_API Activation(Network *net, int act_mode, const float ceiling=0.0, const float slope=0.1);
|
||||
TKDNN_LIB_EXPORT_API virtual ~Activation();
|
||||
virtual layerType_t getLayerType() {
|
||||
if(act_mode == CUDNN_ACTIVATION_CLIPPED_RELU)
|
||||
return LAYER_ACTIVATION_CRELU;
|
||||
@@ -272,10 +272,10 @@ protected:
|
||||
class Conv2d : public LayerWgs {
|
||||
|
||||
public:
|
||||
Conv2d( Network *net, int out_ch, int kernelH, int kernelW,
|
||||
TKDNN_LIB_EXPORT_API Conv2d( Network *net, int out_ch, int kernelH, int kernelW,
|
||||
int strideH, int strideW, int paddingH, int paddingW,
|
||||
std::string fname_weights, bool batchnorm = false, bool deConv = false, int groups = 1, bool additional_bias=false);
|
||||
virtual ~Conv2d();
|
||||
TKDNN_LIB_EXPORT_API virtual ~Conv2d();
|
||||
virtual layerType_t getLayerType() { return LAYER_CONV2D; };
|
||||
|
||||
virtual dnnType* infer(dataDim_t &dim, dnnType* srcData);
|
||||
@@ -325,8 +325,8 @@ protected:
|
||||
class LSTM : public Layer {
|
||||
|
||||
public:
|
||||
LSTM(Network *net, int hiddensize, bool returnSeq, std::string fname_weights);
|
||||
virtual ~LSTM();
|
||||
TKDNN_LIB_EXPORT_API LSTM(Network *net, int hiddensize, bool returnSeq, std::string fname_weights);
|
||||
TKDNN_LIB_EXPORT_API virtual ~LSTM();
|
||||
virtual layerType_t getLayerType() { return LAYER_LSTM; };
|
||||
|
||||
virtual dnnType* infer(dataDim_t &dim, dnnType* srcData);
|
||||
@@ -376,7 +376,7 @@ public:
|
||||
virtual ~DeConv2d() {}
|
||||
virtual layerType_t getLayerType() { return LAYER_DECONV2D; };
|
||||
|
||||
virtual dnnType* infer(dataDim_t &dim, dnnType* srcData);
|
||||
TKDNN_LIB_EXPORT_API virtual dnnType* infer(dataDim_t &dim, dnnType* srcData);
|
||||
};
|
||||
|
||||
|
||||
@@ -386,10 +386,10 @@ public:
|
||||
class DeformConv2d : public LayerWgs {
|
||||
|
||||
public:
|
||||
DeformConv2d( Network *net, int out_ch, int deformable_group, int kernelH, int kernelW,
|
||||
TKDNN_LIB_EXPORT_API DeformConv2d( Network *net, int out_ch, int deformable_group, int kernelH, int kernelW,
|
||||
int strideH, int strideW, int paddingH, int paddingW,
|
||||
std::string d_fname_weights, std::string fname_weights, bool batchnorm);
|
||||
virtual ~DeformConv2d();
|
||||
TKDNN_LIB_EXPORT_API virtual ~DeformConv2d();
|
||||
virtual layerType_t getLayerType() { return LAYER_DEFORMCONV2D; };
|
||||
|
||||
virtual dnnType* infer(dataDim_t &dim, dnnType* srcData);
|
||||
@@ -420,8 +420,8 @@ protected:
|
||||
class Flatten : public Layer {
|
||||
|
||||
public:
|
||||
Flatten(Network *net);
|
||||
virtual ~Flatten();
|
||||
TKDNN_LIB_EXPORT_API Flatten(Network *net);
|
||||
TKDNN_LIB_EXPORT_API virtual ~Flatten();
|
||||
virtual layerType_t getLayerType() { return LAYER_FLATTEN; };
|
||||
|
||||
virtual dnnType* infer(dataDim_t &dim, dnnType* srcData);
|
||||
@@ -435,8 +435,8 @@ public:
|
||||
class Reshape : public Layer {
|
||||
|
||||
public:
|
||||
Reshape(Network *net, dataDim_t new_dim);
|
||||
virtual ~Reshape();
|
||||
TKDNN_LIB_EXPORT_API Reshape(Network *net, dataDim_t new_dim);
|
||||
TKDNN_LIB_EXPORT_API virtual ~Reshape();
|
||||
virtual layerType_t getLayerType() { return LAYER_RESHAPE; };
|
||||
|
||||
virtual dnnType* infer(dataDim_t &dim, dnnType* srcData);
|
||||
@@ -453,7 +453,7 @@ enum ResizeMode_t { NEAREST= 0,
|
||||
class Resize : public Layer {
|
||||
|
||||
public:
|
||||
Resize(Network *net, int scale_c, int scale_h, int scale_w, bool fixed=false, ResizeMode_t mode=NEAREST);
|
||||
TKDNN_LIB_EXPORT_API Resize(Network *net, int scale_c, int scale_h, int scale_w, bool fixed=false, ResizeMode_t mode=NEAREST);
|
||||
virtual ~Resize();
|
||||
virtual layerType_t getLayerType() { return LAYER_RESIZE; };
|
||||
|
||||
@@ -469,7 +469,7 @@ public:
|
||||
class MulAdd : public Layer {
|
||||
|
||||
public:
|
||||
MulAdd(Network *net, dnnType mul, dnnType add);
|
||||
TKDNN_LIB_EXPORT_API MulAdd(Network *net, dnnType mul, dnnType add);
|
||||
virtual ~MulAdd();
|
||||
virtual layerType_t getLayerType() { return LAYER_MULADD; };
|
||||
|
||||
@@ -505,11 +505,11 @@ public:
|
||||
bool size;
|
||||
tkdnnPoolingMode_t pool_mode;
|
||||
|
||||
Pooling(Network *net, int winH, int winW,
|
||||
TKDNN_LIB_EXPORT_API Pooling(Network *net, int winH, int winW,
|
||||
int strideH, int strideW,
|
||||
int paddingH, int paddingW,
|
||||
tkdnnPoolingMode_t pool_mode);
|
||||
virtual ~Pooling();
|
||||
TKDNN_LIB_EXPORT_API virtual ~Pooling();
|
||||
virtual layerType_t getLayerType() { return LAYER_POOLING; };
|
||||
|
||||
virtual dnnType* infer(dataDim_t &dim, dnnType* srcData);
|
||||
@@ -534,7 +534,7 @@ typedef enum {
|
||||
|
||||
class Padding : public Layer {
|
||||
public:
|
||||
Padding(Network *net,int32_t pad_h,int32_t pad_w,tkdnnPaddingMode_t padding_mode,float constant = 0.0);
|
||||
TKDNN_LIB_EXPORT_API Padding(Network *net,int32_t pad_h,int32_t pad_w,tkdnnPaddingMode_t padding_mode,float constant = 0.0);
|
||||
virtual ~Padding();
|
||||
virtual layerType_t getLayerType(){return LAYER_PADDING ;};
|
||||
virtual dnnType* infer(dataDim_t& dim,dnnType* srcData);
|
||||
@@ -553,8 +553,8 @@ public:
|
||||
class Softmax : public Layer {
|
||||
|
||||
public:
|
||||
Softmax(Network *net, const tk::dnn::dataDim_t* dim=nullptr, const cudnnSoftmaxMode_t mode=CUDNN_SOFTMAX_MODE_CHANNEL);
|
||||
virtual ~Softmax();
|
||||
TKDNN_LIB_EXPORT_API Softmax(Network *net, const tk::dnn::dataDim_t* dim=nullptr, const cudnnSoftmaxMode_t mode=CUDNN_SOFTMAX_MODE_CHANNEL);
|
||||
TKDNN_LIB_EXPORT_API virtual ~Softmax();
|
||||
virtual layerType_t getLayerType() { return LAYER_SOFTMAX; };
|
||||
|
||||
virtual dnnType* infer(dataDim_t &dim, dnnType* srcData);
|
||||
@@ -569,8 +569,8 @@ public:
|
||||
class Route : public Layer {
|
||||
|
||||
public:
|
||||
Route(Network *net, Layer **layers, int layers_n, int groups = 1, int group_id = 0);
|
||||
virtual ~Route();
|
||||
TKDNN_LIB_EXPORT_API Route(Network *net, Layer **layers, int layers_n, int groups = 1, int group_id = 0);
|
||||
TKDNN_LIB_EXPORT_API virtual ~Route();
|
||||
virtual layerType_t getLayerType() { return LAYER_ROUTE; };
|
||||
|
||||
virtual dnnType* infer(dataDim_t &dim, dnnType* srcData);
|
||||
@@ -607,8 +607,8 @@ public:
|
||||
class Shortcut : public Layer {
|
||||
|
||||
public:
|
||||
Shortcut(Network *net, Layer *backLayer, bool mul=false);
|
||||
virtual ~Shortcut();
|
||||
TKDNN_LIB_EXPORT_API Shortcut(Network *net, Layer *backLayer, bool mul=false);
|
||||
TKDNN_LIB_EXPORT_API virtual ~Shortcut();
|
||||
virtual layerType_t getLayerType() { return LAYER_SHORTCUT; };
|
||||
|
||||
virtual dnnType* infer(dataDim_t &dim, dnnType* srcData);
|
||||
@@ -627,7 +627,7 @@ public:
|
||||
class Upsample : public Layer {
|
||||
|
||||
public:
|
||||
Upsample(Network *net, int stride);
|
||||
TKDNN_LIB_EXPORT_API Upsample(Network *net, int stride);
|
||||
virtual ~Upsample();
|
||||
virtual layerType_t getLayerType() { return LAYER_UPSAMPLE; };
|
||||
|
||||
|
||||
@@ -65,9 +65,9 @@ public:
|
||||
MobilenetDetection() {};
|
||||
~MobilenetDetection() {};
|
||||
|
||||
bool init(const std::string& tensor_path,const int n_classes, const int n_batches=1, const float conf_thresh=0.3);
|
||||
void preprocess(cv::Mat &frame, const int bi=0);
|
||||
void postprocess(const int bi=0,const bool mAP=false);
|
||||
TKDNN_LIB_EXPORT_API bool init(const std::string& tensor_path,const int n_classes, const int n_batches=1, const float conf_thresh=0.3);
|
||||
TKDNN_LIB_EXPORT_API void preprocess(cv::Mat &frame, const int bi=0);
|
||||
TKDNN_LIB_EXPORT_API void postprocess(const int bi=0,const bool mAP=false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -38,18 +38,18 @@ const int MAX_LAYERS = 512;
|
||||
class Network {
|
||||
|
||||
public:
|
||||
Network(dataDim_t input_dim);
|
||||
virtual ~Network();
|
||||
void releaseLayers();
|
||||
TKDNN_LIB_EXPORT_API Network(dataDim_t input_dim);
|
||||
TKDNN_LIB_EXPORT_API virtual ~Network();
|
||||
TKDNN_LIB_EXPORT_API void releaseLayers();
|
||||
|
||||
/**
|
||||
Do inference for every added layer
|
||||
*/
|
||||
dnnType* infer(dataDim_t &dim, dnnType* data);
|
||||
TKDNN_LIB_EXPORT_API dnnType* infer(dataDim_t &dim, dnnType* data);
|
||||
|
||||
bool addLayer(Layer *l);
|
||||
void print();
|
||||
const char *getNetworkRTName(const char *network_name);
|
||||
TKDNN_LIB_EXPORT_API void print();
|
||||
TKDNN_LIB_EXPORT_API const char *getNetworkRTName(const char *network_name);
|
||||
void adjustFeatureMapSizeWithShortcuts();
|
||||
|
||||
cudnnDataType_t dataType;
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
int num_layers; //current number of layers
|
||||
|
||||
dataDim_t input_dim;
|
||||
dataDim_t getOutputDim();
|
||||
TKDNN_LIB_EXPORT_API dataDim_t getOutputDim();
|
||||
|
||||
bool fp16, dla, int8;
|
||||
int maxBatchSize;
|
||||
|
||||
@@ -55,8 +55,8 @@ public:
|
||||
|
||||
std::vector<nvinfer1::YoloRT*> yolo_plugins; // yolo layers in network
|
||||
|
||||
NetworkRT(Network *net, const char *name);
|
||||
virtual ~NetworkRT();
|
||||
TKDNN_LIB_EXPORT_API NetworkRT(Network *net, const char *name);
|
||||
TKDNN_LIB_EXPORT_API virtual ~NetworkRT();
|
||||
|
||||
int getMaxBatchSize() {
|
||||
if(engineRT != nullptr)
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
/**
|
||||
Do inference
|
||||
*/
|
||||
dnnType* infer(dataDim_t &dim, dnnType* data);
|
||||
TKDNN_LIB_EXPORT_API dnnType* infer(dataDim_t &dim, dnnType* data);
|
||||
void enqueue(int batchSize = 1);
|
||||
|
||||
nvinfer1::ILayer* convert_layer(nvinfer1::ITensor *input, Layer *l);
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
#endif
|
||||
|
||||
bool deserialize(const char *filename);
|
||||
void destroy();
|
||||
TKDNN_LIB_EXPORT_API void destroy();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace tk { namespace dnn {
|
||||
|
||||
cv::Mat vizFloat2colorMap(cv::Mat map, double min=0, double max=0, int classes=19);
|
||||
cv::Mat vizData2Mat(dnnType *dataInput, tk::dnn::dataDim_t dim, int img_h, int img_w, double min=0, double max=0, int classes=0);
|
||||
cv::Mat vizLayer2Mat(tk::dnn::Network *net, int layer, int imgdim = 1000);
|
||||
TKDNN_LIB_EXPORT_API cv::Mat vizData2Mat(dnnType *dataInput, tk::dnn::dataDim_t dim, int img_h, int img_w, double min=0, double max=0, int classes=0);
|
||||
TKDNN_LIB_EXPORT_API cv::Mat vizLayer2Mat(tk::dnn::Network *net, int layer, int imgdim = 1000);
|
||||
|
||||
}}
|
||||
|
||||
@@ -24,9 +24,9 @@ public:
|
||||
Yolo3Detection() {};
|
||||
~Yolo3Detection() {};
|
||||
|
||||
bool init(const std::string& tensor_path, const int n_classes=80, const int n_batches=1, const float conf_thresh=0.3);
|
||||
void preprocess(cv::Mat &frame, const int bi=0);
|
||||
void postprocess(const int bi=0,const bool mAP=false);
|
||||
TKDNN_LIB_EXPORT_API bool init(const std::string& tensor_path, const int n_classes=80, const int n_batches=1, const float conf_thresh=0.3);
|
||||
TKDNN_LIB_EXPORT_API void preprocess(cv::Mat &frame, const int bi=0);
|
||||
TKDNN_LIB_EXPORT_API void postprocess(const int bi=0,const bool mAP=false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <stdlib.h>
|
||||
#include "utils.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include <unistd.h>
|
||||
@@ -18,6 +19,6 @@
|
||||
#include <yaml-cpp/yaml.h>
|
||||
|
||||
|
||||
void readCalibrationMatrix(const std::string& path, cv::Mat& calib_mat);
|
||||
TKDNN_LIB_EXPORT_API void readCalibrationMatrix(const std::string& path, cv::Mat& calib_mat);
|
||||
|
||||
#endif //DEMO_UTILS_H
|
||||
@@ -33,7 +33,7 @@ struct PR
|
||||
void print();
|
||||
};
|
||||
|
||||
void readmAPParams( const char* config_filename, int& classes, int& map_points,
|
||||
TKDNN_LIB_EXPORT_API void readmAPParams( const char* config_filename, int& classes, int& map_points,
|
||||
int& map_levels, float& map_step, float& IoU_thresh,
|
||||
float& conf_thresh, bool& verbose);
|
||||
|
||||
@@ -85,7 +85,7 @@ double computeMap( std::vector<Frame> &images,const int classes,
|
||||
* @return mAP IoU_tresh:IoU_tresh+map_step*map_levels (e.g. mAP 0.5:0.95 when
|
||||
* map_step=0.05 and map_levels=10)
|
||||
*/
|
||||
double computeMapNIoULevels(std::vector<Frame> &images,const int classes,
|
||||
TKDNN_LIB_EXPORT_API double computeMapNIoULevels(std::vector<Frame> &images,const int classes,
|
||||
const float i_IoU_thresh=0.5, const float conf_thresh=0.3,
|
||||
const int map_points=101, const float map_step=0.05,
|
||||
const int map_levels=10, const bool verbose=false,
|
||||
@@ -105,7 +105,7 @@ double computeMapNIoULevels(std::vector<Frame> &images,const int classes,
|
||||
* are written on file
|
||||
* @param net name of the considered neural network
|
||||
*/
|
||||
void computeTPFPFN( std::vector<Frame> &images,const int classes,
|
||||
TKDNN_LIB_EXPORT_API void computeTPFPFN( std::vector<Frame> &images,const int classes,
|
||||
const float IoU_thresh=0.5, const float conf_thresh=0.3,
|
||||
bool verbose=false, const bool write_on_file=false,
|
||||
std::string net="");
|
||||
|
||||
+18
-18
@@ -3,37 +3,37 @@
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
void activationELUForward(dnnType *srcData, dnnType *dstData, int size, cudaStream_t stream = cudaStream_t(0));
|
||||
void activationLEAKYForward(dnnType *srcData, dnnType *dstData, int size, float slope, cudaStream_t stream = cudaStream_t(0));
|
||||
void activationReLUCeilingForward(dnnType *srcData, dnnType *dstData, int size, const float ceiling, cudaStream_t stream = cudaStream_t(0));
|
||||
void activationLOGISTICForward(dnnType *srcData, dnnType *dstData, int size, cudaStream_t stream = cudaStream_t(0));
|
||||
void activationSIGMOIDForward(dnnType *srcData, dnnType *dstData, int size, cudaStream_t stream = cudaStream_t(0));
|
||||
void activationMishForward(dnnType* srcData, dnnType* dstData, int size, cudaStream_t stream= cudaStream_t(0));
|
||||
TKDNN_LIB_EXPORT_API void activationELUForward(dnnType *srcData, dnnType *dstData, int size, cudaStream_t stream = cudaStream_t(0));
|
||||
TKDNN_LIB_EXPORT_API void activationLEAKYForward(dnnType *srcData, dnnType *dstData, int size, float slope, cudaStream_t stream = cudaStream_t(0));
|
||||
TKDNN_LIB_EXPORT_API void activationReLUCeilingForward(dnnType *srcData, dnnType *dstData, int size, const float ceiling, cudaStream_t stream = cudaStream_t(0));
|
||||
TKDNN_LIB_EXPORT_API void activationLOGISTICForward(dnnType *srcData, dnnType *dstData, int size, cudaStream_t stream = cudaStream_t(0));
|
||||
TKDNN_LIB_EXPORT_API void activationSIGMOIDForward(dnnType *srcData, dnnType *dstData, int size, cudaStream_t stream = cudaStream_t(0));
|
||||
TKDNN_LIB_EXPORT_API void activationMishForward(dnnType* srcData, dnnType* dstData, int size, cudaStream_t stream= cudaStream_t(0));
|
||||
|
||||
void fill(dnnType *data, int size, dnnType val, cudaStream_t stream = cudaStream_t(0));
|
||||
TKDNN_LIB_EXPORT_API void fill(dnnType *data, int size, dnnType val, cudaStream_t stream = cudaStream_t(0));
|
||||
|
||||
void resizeForward(dnnType *srcData, dnnType *dstData, int n, int i_c, int i_h, int i_w,
|
||||
TKDNN_LIB_EXPORT_API void resizeForward(dnnType *srcData, dnnType *dstData, int n, int i_c, int i_h, int i_w,
|
||||
int o_c, int o_h, int o_w, cudaStream_t stream = cudaStream_t(0));
|
||||
|
||||
void reorgForward(dnnType *srcData, dnnType *dstData,
|
||||
TKDNN_LIB_EXPORT_API void reorgForward(dnnType *srcData, dnnType *dstData,
|
||||
int n, int c, int h, int w, int stride, cudaStream_t stream = cudaStream_t(0));
|
||||
|
||||
void MaxPoolingForward(dnnType *srcData, dnnType *dstData, int n, int c, int h, int w, int stride_x, int stride_y, int size, int padding, cudaStream_t stream = cudaStream_t(0));
|
||||
TKDNN_LIB_EXPORT_API void MaxPoolingForward(dnnType *srcData, dnnType *dstData, int n, int c, int h, int w, int stride_x, int stride_y, int size, int padding, cudaStream_t stream = cudaStream_t(0));
|
||||
|
||||
void softmaxForward(float *input, int n, int batch, int batch_offset,
|
||||
TKDNN_LIB_EXPORT_API void softmaxForward(float *input, int n, int batch, int batch_offset,
|
||||
int groups, int group_offset, int stride, float temp, float *output, cudaStream_t stream = cudaStream_t(0));
|
||||
|
||||
void shortcutForward(dnnType *srcData, dnnType *dstData, int n1, int c1, int h1, int w1, int s1,
|
||||
TKDNN_LIB_EXPORT_API void shortcutForward(dnnType *srcData, dnnType *dstData, int n1, int c1, int h1, int w1, int s1,
|
||||
int n2, int c2, int h2, int w2, int s2, bool mul,
|
||||
cudaStream_t stream = cudaStream_t(0));
|
||||
|
||||
void upsampleForward(dnnType *srcData, dnnType *dstData,
|
||||
TKDNN_LIB_EXPORT_API void upsampleForward(dnnType *srcData, dnnType *dstData,
|
||||
int n, int c, int h, int w, int s, int forward, float scale,
|
||||
cudaStream_t stream = cudaStream_t(0));
|
||||
|
||||
void float2half(float *srcData, __half *dstData, int size, const cudaStream_t stream = cudaStream_t(0));
|
||||
TKDNN_LIB_EXPORT_API void float2half(float *srcData, __half *dstData, int size, const cudaStream_t stream = cudaStream_t(0));
|
||||
|
||||
void dcnV2CudaForward(cublasStatus_t stat, cublasHandle_t handle,
|
||||
TKDNN_LIB_EXPORT_API void dcnV2CudaForward(cublasStatus_t stat, cublasHandle_t handle,
|
||||
float *input, float *weight,
|
||||
float *bias, float *ones,
|
||||
float *offset, float *mask,
|
||||
@@ -47,11 +47,11 @@ void dcnV2CudaForward(cublasStatus_t stat, cublasHandle_t handle,
|
||||
const int out_n, const int out_c, const int out_h, const int out_w,
|
||||
const int dst_dim, cudaStream_t stream = cudaStream_t(0));
|
||||
|
||||
void scalAdd(dnnType* dstData, int size, float alpha, float beta, int inc, cudaStream_t stream = cudaStream_t(0));
|
||||
TKDNN_LIB_EXPORT_API void scalAdd(dnnType* dstData, int size, float alpha, float beta, int inc, cudaStream_t stream = cudaStream_t(0));
|
||||
|
||||
void reflection_pad2d_out_forward(int32_t pad_h,int32_t pad_w,float *srcData,float *dstData,int32_t input_h,int32_t input_w,int32_t plane_dim,int32_t n_batch,cudaStream_t cudaStream = cudaStream_t(0));
|
||||
TKDNN_LIB_EXPORT_API void reflection_pad2d_out_forward(int32_t pad_h,int32_t pad_w,float *srcData,float *dstData,int32_t input_h,int32_t input_w,int32_t plane_dim,int32_t n_batch,cudaStream_t cudaStream = cudaStream_t(0));
|
||||
|
||||
void constant_pad2d_forward(dnnType *srcData,dnnType *dstData,int32_t input_h,int32_t input_w,int32_t output_h,
|
||||
TKDNN_LIB_EXPORT_API void constant_pad2d_forward(dnnType *srcData,dnnType *dstData,int32_t input_h,int32_t input_w,int32_t output_h,
|
||||
int32_t output_w,int32_t c,int32_t n,int32_t padT,int32_t padL,dnnType constant,cudaStream_t cudaStream = cudaStream_t(0));
|
||||
|
||||
|
||||
|
||||
@@ -27,20 +27,20 @@ struct threshold : public thrust::binary_function<float,float,float>
|
||||
}
|
||||
};
|
||||
|
||||
void sort(dnnType *src_begin, dnnType *src_end, int *idsrc);
|
||||
void topk(dnnType *src_begin, int *idsrc, int K, float *topk_scores,
|
||||
TKDNN_LIB_EXPORT_API void sort(dnnType *src_begin, dnnType *src_end, int *idsrc);
|
||||
TKDNN_LIB_EXPORT_API void topk(dnnType *src_begin, int *idsrc, int K, float *topk_scores,
|
||||
int *topk_inds, float *topk_ys, float *topk_xs);
|
||||
// void sortAndTopKonDevice(dnnType *src_begin, int *idsrc, float *topk_scores, int *topk_inds, float *topk_ys, float *topk_xs, const int size, const int K, const int n_classes);
|
||||
void normalize(float *bgr, const int ch, const int h, const int w, const float *mean, const float *stddev);
|
||||
void transformDep(float *src_begin, float *src_end, float *dst_begin, float *dst_end);
|
||||
void subtractWithThreshold(dnnType *src_begin, dnnType *src_end, dnnType *src2_begin, dnnType *src_out, struct threshold op);
|
||||
void topKxyclasses(int *ids_begin, int *ids_end, const int K, const int size, const int wh, int *clses, int *xs, int *ys);
|
||||
void topKxyAddOffset(int * ids_begin, const int K, const int size, int *intxs_begin, int *intys_begin,
|
||||
TKDNN_LIB_EXPORT_API void normalize(float *bgr, const int ch, const int h, const int w, const float *mean, const float *stddev);
|
||||
TKDNN_LIB_EXPORT_API void transformDep(float *src_begin, float *src_end, float *dst_begin, float *dst_end);
|
||||
TKDNN_LIB_EXPORT_API void subtractWithThreshold(dnnType *src_begin, dnnType *src_end, dnnType *src2_begin, dnnType *src_out, struct threshold op);
|
||||
TKDNN_LIB_EXPORT_API void topKxyclasses(int *ids_begin, int *ids_end, const int K, const int size, const int wh, int *clses, int *xs, int *ys);
|
||||
TKDNN_LIB_EXPORT_API void topKxyAddOffset(int * ids_begin, const int K, const int size, int *intxs_begin, int *intys_begin,
|
||||
float *xs_begin, float *ys_begin, dnnType *src_begin, float *src_out, int *ids_out);
|
||||
void bboxes(int * ids_begin, const int K, const int size, float *xs_begin, float *ys_begin,
|
||||
TKDNN_LIB_EXPORT_API void bboxes(int * ids_begin, const int K, const int size, float *xs_begin, float *ys_begin,
|
||||
dnnType *src_begin, float *bbx0, float *bbx1, float *bby0, float *bby1, float *src_out, int *ids_out);
|
||||
void getRecordsFromTopKId(int * ids_begin, const int K, const int ch, const int size, dnnType *src_begin, float *src_out, int *ids_out);
|
||||
TKDNN_LIB_EXPORT_API void getRecordsFromTopKId(int * ids_begin, const int K, const int ch, const int size, dnnType *src_begin, float *src_out, int *ids_out);
|
||||
|
||||
void maxElem(dnnType *src_begin, dnnType *dst_begin, const int c, const int h, const int w);
|
||||
TKDNN_LIB_EXPORT_API void maxElem(dnnType *src_begin, dnnType *dst_begin, const int c, const int h, const int w);
|
||||
|
||||
#endif //KERNELSTHRUST_H
|
||||
@@ -61,7 +61,7 @@ namespace nvinfer1 {
|
||||
|
||||
class ActivationLeakyRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
ActivationLeakyRTPluginCreator();
|
||||
TKDNN_LIB_EXPORT_API ActivationLeakyRTPluginCreator();
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace nvinfer1 {
|
||||
|
||||
class ActivationLogisticRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
ActivationLogisticRTPluginCreator() ;
|
||||
TKDNN_LIB_EXPORT_API ActivationLogisticRTPluginCreator() ;
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override ;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace nvinfer1 {
|
||||
|
||||
class ActivationMishRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
ActivationMishRTPluginCreator() ;
|
||||
TKDNN_LIB_EXPORT_API ActivationMishRTPluginCreator() ;
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override ;
|
||||
const char *getPluginNamespace() const NOEXCEPT override ;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace nvinfer1 {
|
||||
|
||||
class ActivationReLUCeilingPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
ActivationReLUCeilingPluginCreator() ;
|
||||
TKDNN_LIB_EXPORT_API ActivationReLUCeilingPluginCreator() ;
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override ;
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace nvinfer1{
|
||||
|
||||
class ConstantPaddingRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
ConstantPaddingRTPluginCreator();
|
||||
TKDNN_LIB_EXPORT_API ConstantPaddingRTPluginCreator();
|
||||
|
||||
void setPluginNamespace(const char* pluginNamespace) NOEXCEPT override;
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace nvinfer1 {
|
||||
|
||||
class DeformableConvRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
DeformableConvRTPluginCreator();
|
||||
TKDNN_LIB_EXPORT_API DeformableConvRTPluginCreator();
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override ;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace nvinfer1 {
|
||||
|
||||
class FlattenConcatRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
FlattenConcatRTPluginCreator() ;
|
||||
TKDNN_LIB_EXPORT_API FlattenConcatRTPluginCreator() ;
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override ;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace nvinfer1 {
|
||||
|
||||
class MaxPoolFixedSizeRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
MaxPoolFixedSizeRTPluginCreator() ;
|
||||
TKDNN_LIB_EXPORT_API MaxPoolFixedSizeRTPluginCreator() ;
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override ;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace nvinfer1{
|
||||
|
||||
class ReflectionPaddingRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
ReflectionPaddingRTPluginCreator();
|
||||
TKDNN_LIB_EXPORT_API ReflectionPaddingRTPluginCreator();
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override ;
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace nvinfer1 {
|
||||
|
||||
class RegionRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
RegionRTPluginCreator();
|
||||
TKDNN_LIB_EXPORT_API RegionRTPluginCreator();
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override ;
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace nvinfer1 {
|
||||
|
||||
class ReorgRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
ReorgRTPluginCreator();
|
||||
TKDNN_LIB_EXPORT_API ReorgRTPluginCreator();
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override;
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace nvinfer1 {
|
||||
|
||||
class ReshapeRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
ReshapeRTPluginCreator() ;
|
||||
TKDNN_LIB_EXPORT_API ReshapeRTPluginCreator() ;
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override ;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace nvinfer1 {
|
||||
|
||||
class ResizeLayerRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
ResizeLayerRTPluginCreator() ;
|
||||
TKDNN_LIB_EXPORT_API ResizeLayerRTPluginCreator() ;
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override ;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace nvinfer1 {
|
||||
*/
|
||||
|
||||
public:
|
||||
RouteRT(int groups, int group_id) ;
|
||||
TKDNN_LIB_EXPORT_API RouteRT(int groups, int group_id) ;
|
||||
|
||||
~RouteRT() ;
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace nvinfer1 {
|
||||
|
||||
class RouteRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
RouteRTPluginCreator() ;
|
||||
TKDNN_LIB_EXPORT_API RouteRTPluginCreator() ;
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override ;
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace nvinfer1 {
|
||||
|
||||
class ShortcutRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
ShortcutRTPluginCreator();
|
||||
TKDNN_LIB_EXPORT_API ShortcutRTPluginCreator();
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override;
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace nvinfer1 {
|
||||
|
||||
class UpsampleRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
UpsampleRTPluginCreator();
|
||||
TKDNN_LIB_EXPORT_API UpsampleRTPluginCreator();
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace nvinfer1 {
|
||||
|
||||
class YoloRTPluginCreator : public IPluginCreator {
|
||||
public:
|
||||
YoloRTPluginCreator();
|
||||
TKDNN_LIB_EXPORT_API YoloRTPluginCreator();
|
||||
|
||||
void setPluginNamespace(const char *pluginNamespace) NOEXCEPT override;
|
||||
|
||||
|
||||
+18
-9
@@ -35,6 +35,15 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define TKDNN_LIB_EXPORT_API __declspec(dllexport)
|
||||
#define TKDNN_LIB_IMPORT_API __declspec(dllimport)
|
||||
#elif __linux__
|
||||
#define TKDNN_LIB_EXPORT_API __attribute__((visibility("default")))
|
||||
#define TKDNN_LIB_IMPORT_API
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define dnnType float
|
||||
|
||||
@@ -143,23 +152,23 @@ typedef enum {
|
||||
ERROR_CUDNNvsTENSORRT = 8
|
||||
} resultError_t;
|
||||
|
||||
void printCenteredTitle(const char *title, char fill, int dim = 30);
|
||||
bool fileExist(const char *fname);
|
||||
void downloadWeightsifDoNotExist(const std::string& input_bin, const std::string& test_folder, const std::string& weights_url);
|
||||
void readBinaryFile(std::string fname, int size, dnnType** data_h, dnnType** data_d, int seek = 0);
|
||||
int checkResult(int size, dnnType *data_d, dnnType *correct_d, bool device = true, int limit = 10, bool verbose=true);
|
||||
void printDeviceVector(int size, dnnType* vec_d, bool device = true);
|
||||
TKDNN_LIB_EXPORT_API void printCenteredTitle(const char *title, char fill, int dim = 30);
|
||||
TKDNN_LIB_EXPORT_API bool fileExist(const char *fname);
|
||||
TKDNN_LIB_EXPORT_API void downloadWeightsifDoNotExist(const std::string& input_bin, const std::string& test_folder, const std::string& weights_url);
|
||||
TKDNN_LIB_EXPORT_API void readBinaryFile(std::string fname, int size, dnnType** data_h, dnnType** data_d, int seek = 0);
|
||||
TKDNN_LIB_EXPORT_API int checkResult(int size, dnnType *data_d, dnnType *correct_d, bool device = true, int limit = 10, bool verbose=true);
|
||||
TKDNN_LIB_EXPORT_API void printDeviceVector(int size, dnnType* vec_d, bool device = true);
|
||||
float getColor(const int c, const int x, const int max);
|
||||
void resize(int size, dnnType **data);
|
||||
|
||||
void matrixTranspose(cublasHandle_t handle, dnnType* srcData, dnnType* dstData, int rows, int cols);
|
||||
TKDNN_LIB_EXPORT_API void matrixTranspose(cublasHandle_t handle, dnnType* srcData, dnnType* dstData, int rows, int cols);
|
||||
|
||||
void matrixMulAdd( cublasHandle_t handle, dnnType* srcData, dnnType* dstData,
|
||||
dnnType* add_vector, int dim, dnnType mul);
|
||||
|
||||
void getMemUsage(double& vm_usage_kb, double& resident_set_kb);
|
||||
TKDNN_LIB_EXPORT_API void getMemUsage(double& vm_usage_kb, double& resident_set_kb);
|
||||
void printCudaMemUsage();
|
||||
void removePathAndExtension(const std::string &full_string, std::string &name);
|
||||
TKDNN_LIB_EXPORT_API void removePathAndExtension(const std::string &full_string, std::string &name);
|
||||
static inline bool isCudaPointer(void *data) {
|
||||
cudaPointerAttributes attr;
|
||||
return cudaPointerGetAttributes(&attr, data) == 0;
|
||||
|
||||
+2
-2
@@ -15,8 +15,8 @@
|
||||
|
||||
using namespace nvinfer1;
|
||||
|
||||
extern std::mutex gYoloPlugins_mutex;
|
||||
extern std::vector<YoloRT*> gYoloPlugins;
|
||||
TKDNN_LIB_IMPORT_API extern std::mutex gYoloPlugins_mutex;
|
||||
TKDNN_LIB_IMPORT_API extern std::vector<YoloRT*> gYoloPlugins;
|
||||
|
||||
// Logger for info/warning/errors
|
||||
class Logger : public ILogger {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
using namespace nvinfer1;
|
||||
|
||||
// used to retrive Yolo plugin during network deserialization
|
||||
std::mutex gYoloPlugins_mutex;
|
||||
std::vector<YoloRT*> gYoloPlugins;
|
||||
TKDNN_LIB_EXPORT_API std::mutex gYoloPlugins_mutex;
|
||||
TKDNN_LIB_EXPORT_API std::vector<YoloRT*> gYoloPlugins;
|
||||
|
||||
std::vector<PluginField> YoloRTPluginCreator::mPluginAttributes;
|
||||
PluginFieldCollection YoloRTPluginCreator::mFC{};
|
||||
|
||||
Reference in New Issue
Block a user