Add different yolov4 size tests
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
||||
#include "DarknetParser.h"
|
||||
|
||||
int main() {
|
||||
std::string bin_path = "yolo4";
|
||||
std::string bin_path = "yolo4_320";
|
||||
std::vector<std::string> input_bins = {
|
||||
bin_path + "/layers/input.bin"
|
||||
};
|
||||
@@ -15,9 +15,9 @@ int main() {
|
||||
bin_path + "/debug/layer161_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo4.cfg";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo4_320.cfg";
|
||||
std::string name_path = "../tests/darknet/names/coco.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/d97CFzYqCPCp5Hg/download");
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/64PHAwrM6RCZbiR/download");
|
||||
|
||||
// parse darknet network
|
||||
tk::dnn::Network *net = tk::dnn::darknetParser(cfg_path, wgs_path, name_path);
|
||||
@@ -0,0 +1,34 @@
|
||||
#include<iostream>
|
||||
#include<vector>
|
||||
#include "tkdnn.h"
|
||||
#include "test.h"
|
||||
#include "DarknetParser.h"
|
||||
|
||||
int main() {
|
||||
std::string bin_path = "yolo4_416";
|
||||
std::vector<std::string> input_bins = {
|
||||
bin_path + "/layers/input.bin"
|
||||
};
|
||||
std::vector<std::string> output_bins = {
|
||||
bin_path + "/debug/layer139_out.bin",
|
||||
bin_path + "/debug/layer150_out.bin",
|
||||
bin_path + "/debug/layer161_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo4_416.cfg";
|
||||
std::string name_path = "../tests/darknet/names/coco.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/982LxTQcNQfFQc4/download");
|
||||
|
||||
// parse darknet network
|
||||
tk::dnn::Network *net = tk::dnn::darknetParser(cfg_path, wgs_path, name_path);
|
||||
net->print();
|
||||
|
||||
//convert network to tensorRT
|
||||
tk::dnn::NetworkRT *netRT = new tk::dnn::NetworkRT(net, net->getNetworkRTName(bin_path.c_str()));
|
||||
|
||||
int ret = testInference(input_bins, output_bins, net, netRT);
|
||||
net->releaseLayers();
|
||||
delete net;
|
||||
delete netRT;
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#include<iostream>
|
||||
#include<vector>
|
||||
#include "tkdnn.h"
|
||||
#include "test.h"
|
||||
#include "DarknetParser.h"
|
||||
|
||||
int main() {
|
||||
std::string bin_path = "yolo4_512";
|
||||
std::vector<std::string> input_bins = {
|
||||
bin_path + "/layers/input.bin"
|
||||
};
|
||||
std::vector<std::string> output_bins = {
|
||||
bin_path + "/debug/layer139_out.bin",
|
||||
bin_path + "/debug/layer150_out.bin",
|
||||
bin_path + "/debug/layer161_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo4_512.cfg";
|
||||
std::string name_path = "../tests/darknet/names/coco.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/XN3FNXs3fnMaK5i/download");
|
||||
|
||||
// parse darknet network
|
||||
tk::dnn::Network *net = tk::dnn::darknetParser(cfg_path, wgs_path, name_path);
|
||||
net->print();
|
||||
|
||||
//convert network to tensorRT
|
||||
tk::dnn::NetworkRT *netRT = new tk::dnn::NetworkRT(net, net->getNetworkRTName(bin_path.c_str()));
|
||||
|
||||
int ret = testInference(input_bins, output_bins, net, netRT);
|
||||
net->releaseLayers();
|
||||
delete net;
|
||||
delete netRT;
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#include<iostream>
|
||||
#include<vector>
|
||||
#include "tkdnn.h"
|
||||
#include "test.h"
|
||||
#include "DarknetParser.h"
|
||||
|
||||
int main() {
|
||||
std::string bin_path = "yolo4_608";
|
||||
std::vector<std::string> input_bins = {
|
||||
bin_path + "/layers/input.bin"
|
||||
};
|
||||
std::vector<std::string> output_bins = {
|
||||
bin_path + "/debug/layer139_out.bin",
|
||||
bin_path + "/debug/layer150_out.bin",
|
||||
bin_path + "/debug/layer161_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo4_608.cfg";
|
||||
std::string name_path = "../tests/darknet/names/coco.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/Bg9r7kqDFJiFB4c/download");
|
||||
|
||||
// parse darknet network
|
||||
tk::dnn::Network *net = tk::dnn::darknetParser(cfg_path, wgs_path, name_path);
|
||||
net->print();
|
||||
|
||||
//convert network to tensorRT
|
||||
tk::dnn::NetworkRT *netRT = new tk::dnn::NetworkRT(net, net->getNetworkRTName(bin_path.c_str()));
|
||||
|
||||
int ret = testInference(input_bins, output_bins, net, netRT);
|
||||
net->releaseLayers();
|
||||
delete net;
|
||||
delete netRT;
|
||||
return ret;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
#include<iostream>
|
||||
#include<algorithm>
|
||||
#include "tkdnn.h"
|
||||
#include <stdlib.h> /* srand, rand */
|
||||
|
||||
@@ -29,6 +30,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
int ret_tensorrt = 0;
|
||||
std::cout<<"Testing with batchsize: "<<BATCH_SIZE<<"\n";
|
||||
std::vector<double> stats;
|
||||
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
||||
float total_time = 0;
|
||||
for(int i=0; i<1200; i++) {
|
||||
@@ -46,18 +48,26 @@ int main(int argc, char *argv[]) {
|
||||
netRT.infer(dim, input_d);
|
||||
TKDNN_TSTOP
|
||||
total_time+= t_ns;
|
||||
if(i> 1)
|
||||
stats.push_back(t_ns);
|
||||
|
||||
// control output
|
||||
std::cout<<"Output Buffers: "<<netRT.getBuffersN()-1<<"\n";
|
||||
// std::cout<<"Output Buffers: "<<netRT.getBuffersN()-1<<"\n";
|
||||
std::cout<<"Img: "<<i<<"\n";
|
||||
for(int o=1; o<netRT.getBuffersN(); o++) {
|
||||
for(int b=1; b<BATCH_SIZE; b++) {
|
||||
dnnType *out_d = (dnnType*) netRT.buffersRT[o];
|
||||
dnnType *out0_d = out_d;
|
||||
dnnType *outI_d = out_d + netRT.buffersDIM[o].tot()*b;
|
||||
ret_tensorrt |= checkResult(netRT.buffersDIM[o].tot(), outI_d, out0_d) == 0 ? 0 : ERROR_TENSORRT;
|
||||
ret_tensorrt |= checkResult(netRT.buffersDIM[o].tot(), outI_d, out0_d,true, 10, false) == 0 ? 0 : ERROR_TENSORRT;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout<<"avg: "<<total_time/1200.<<std::endl;
|
||||
std::cout<<"Min: "<<*std::min_element(stats.begin(), stats.end())/BATCH_SIZE<<" ms\n";
|
||||
std::cout<<"Max: "<<*std::max_element(stats.begin(), stats.end())/BATCH_SIZE<<" ms\n";
|
||||
double mean =0;
|
||||
for(int i=0; i<stats.size(); i++) mean += stats[i]; mean /= stats.size();
|
||||
std::cout<<"Avg: "<<mean/BATCH_SIZE<<" ms\t"<<1000/(mean/BATCH_SIZE)<<" FPS\n"<<COL_END;
|
||||
return ret_tensorrt;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user