upsample ok, route have problems

This commit is contained in:
Francesco Gatti
2018-12-22 23:56:01 +01:00
parent 34be4cd00f
commit 3bd725801d
6 changed files with 112 additions and 16 deletions
+23 -14
View File
@@ -77,7 +77,7 @@ const char *c102_bin = "../tests/yolo3_berkeley/layers/c102.bin";
const char *c103_bin = "../tests/yolo3_berkeley/layers/c103.bin";
const char *c104_bin = "../tests/yolo3_berkeley/layers/c104.bin";
const char *c105_bin = "../tests/yolo3_berkeley/layers/c105.bin";
const char *output_bin = "../tests/yolo3_berkeley/debug/layer82_out.bin";
const char *output_bin = "../tests/yolo3_berkeley/debug/layer93_out.bin";
int main() {
@@ -231,19 +231,21 @@ int main() {
tk::dnn::Activation a78 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c79 (&net, 512, 1, 1, 1, 1, 0, 0, c79_bin, true);
tk::dnn::Activation a79 (&net, tk::dnn::ACTIVATION_LEAKY);
/*
tk::dnn::Conv2d c80 (&net,1024, 3, 3, 1, 1, 1, 1, c80_bin, true);
tk::dnn::Activation a80 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c81 (&net, 45, 1, 1, 1, 1, 0, 0, c81_bin, false);
tk::dnn::Yolo g82 (&net, 10, 3);
/*
tk::dnn::Yolo y82 (&net, 10, 3);
tk::dnn::Layer *m83_layers[1] = { &a79 };
tk::dnn::Route m83 (&net, m83_layers, 1);
*/
tk::dnn::Conv2d c84 (&net, 256, 1, 1, 1, 1, 0, 0, c84_bin, true);
tk::dnn::Activation a84 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Upsample u85 (&net, 2);
tk::dnn::Layer *m86_layers[2] = { &u85, &s61 };
tk::dnn::Route m86 (&net, m86_layers, 2);
// tk::dnn::Layer *m86_layers[2] = { &u85, &s61 };
// tk::dnn::Route m86 (&net, m86_layers, 2);
tk::dnn::Conv2d c87 (&net, 256, 1, 1, 1, 1, 0, 0, c87_bin, true);
tk::dnn::Activation a87 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c88 (&net, 512, 3, 3, 1, 1, 1, 1, c88_bin, true);
@@ -254,19 +256,21 @@ int main() {
tk::dnn::Activation a90 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c91 (&net, 256, 1, 1, 1, 1, 0, 0, c91_bin, true);
tk::dnn::Activation a91 (&net, tk::dnn::ACTIVATION_LEAKY);
/*
tk::dnn::Conv2d c92 (&net, 512, 3, 3, 1, 1, 1, 1, c92_bin, true);
tk::dnn::Activation a92 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c93 (&net, 45, 1, 1, 1, 1, 0, 0, c93_bin, false);
tk::dnn::Yolo g94 (&net, 10, 3);
tk::dnn::Yolo y94 (&net, 10, 3);
tk::dnn::Layer *m95_layers[1] = { &a91 };
tk::dnn::Route m95 (&net, m95_layers, 1);
*/
tk::dnn::Conv2d c96 (&net, 128, 1, 1, 1, 1, 0, 0, c96_bin, true);
tk::dnn::Activation a96 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Upsample u97 (&net, 2);
tk::dnn::Layer *m98_layers[2] = { &u97, &s36 };
tk::dnn::Route m98 (&net, m98_layers, 2);
// tk::dnn::Layer *m98_layers[2] = { &u97, &s36 };
// tk::dnn::Route m98 (&net, m98_layers, 2);
tk::dnn::Conv2d c99 (&net, 128, 1, 1, 1, 1, 0, 0, c99_bin, true);
tk::dnn::Activation a99 (&net, tk::dnn::ACTIVATION_LEAKY);
@@ -282,8 +286,13 @@ int main() {
tk::dnn::Conv2d c104 (&net, 256, 3, 3, 1, 1, 1, 1, c104_bin, true);
tk::dnn::Activation a104 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c105 (&net, 45, 1, 1, 1, 1, 0, 0, c105_bin, false);
tk::dnn::Yolo g106 (&net, 10, 3);
*/
tk::dnn::Yolo y106 (&net, 10, 3);
// merge all yolos
// tk::dnn::Layer *m107_layers[2] = { &y82, &y94, &y106 };
// tk::dnn::Route m107 (&net, m107_layers, 3);
// Load input
dnnType *data;
dnnType *input_h;
@@ -318,9 +327,9 @@ int main() {
printCenteredTitle(" CHECK RESULTS ", '=', 30);
dnnType *out, *out_h;
int out_dim = net.getOutputDim().tot();
readBinaryFile(output_bin, out_dim, &out_h, &out);
std::cout<<"CUDNN vs correct"; checkResult(out_dim, out_data, out);
std::cout<<"TRT vs correct"; checkResult(out_dim, out_data2, out);
//readBinaryFile(output_bin, out_dim, &out_h, &out);
//std::cout<<"CUDNN vs correct"; checkResult(out_dim, out_data, out);
//std::cout<<"TRT vs correct"; checkResult(out_dim, out_data2, out);
std::cout<<"CUDNN vs TRT "; checkResult(out_dim, out_data, out_data2);
return 0;
}