This commit is contained in:
rcavicchioli
2019-02-19 11:38:13 +01:00
parent 851c6a366c
commit 39f80bbfb6
3 changed files with 101 additions and 101 deletions
+2 -2
View File
@@ -74,8 +74,8 @@ target_link_libraries(test_yolo_224 tkDNN)
add_executable(test_yolo_berkeley tests/yolo_berkeley/yolo_berkeley.cpp) add_executable(test_yolo_berkeley tests/yolo_berkeley/yolo_berkeley.cpp)
target_link_libraries(test_yolo_berkeley tkDNN) target_link_libraries(test_yolo_berkeley tkDNN)
add_executable(test_yolo3_voc tests/yolo3_voc/yolo3_voc.cpp) add_executable(test_yolo3_coco4 tests/yolo3_coco4/yolo3_coco4.cpp)
target_link_libraries(test_yolo3_voc tkDNN) target_link_libraries(test_yolo3_coco4 tkDNN)
add_executable(test_yolo3_berkeley tests/yolo3_berkeley/yolo3_berkeley.cpp) add_executable(test_yolo3_berkeley tests/yolo3_berkeley/yolo3_berkeley.cpp)
target_link_libraries(test_yolo3_berkeley tkDNN) target_link_libraries(test_yolo3_berkeley tkDNN)
@@ -1,89 +1,89 @@
#include<iostream> #include<iostream>
#include "tkdnn.h" #include "tkdnn.h"
const char *input_bin = "../tests/yolo3_voc/layers/input.bin"; const char *input_bin = "../tests/yolo3_coco4/layers/input.bin";
const char *c0_bin = "../tests/yolo3_voc/layers/c0.bin"; const char *c0_bin = "../tests/yolo3_coco4/layers/c0.bin";
const char *c1_bin = "../tests/yolo3_voc/layers/c1.bin"; const char *c1_bin = "../tests/yolo3_coco4/layers/c1.bin";
const char *c2_bin = "../tests/yolo3_voc/layers/c2.bin"; const char *c2_bin = "../tests/yolo3_coco4/layers/c2.bin";
const char *c3_bin = "../tests/yolo3_voc/layers/c3.bin"; const char *c3_bin = "../tests/yolo3_coco4/layers/c3.bin";
const char *c5_bin = "../tests/yolo3_voc/layers/c5.bin"; const char *c5_bin = "../tests/yolo3_coco4/layers/c5.bin";
const char *c6_bin = "../tests/yolo3_voc/layers/c6.bin"; const char *c6_bin = "../tests/yolo3_coco4/layers/c6.bin";
const char *c7_bin = "../tests/yolo3_voc/layers/c7.bin"; const char *c7_bin = "../tests/yolo3_coco4/layers/c7.bin";
const char *c9_bin = "../tests/yolo3_voc/layers/c9.bin"; const char *c9_bin = "../tests/yolo3_coco4/layers/c9.bin";
const char *c10_bin = "../tests/yolo3_voc/layers/c10.bin"; const char *c10_bin = "../tests/yolo3_coco4/layers/c10.bin";
const char *c12_bin = "../tests/yolo3_voc/layers/c12.bin"; const char *c12_bin = "../tests/yolo3_coco4/layers/c12.bin";
const char *c13_bin = "../tests/yolo3_voc/layers/c13.bin"; const char *c13_bin = "../tests/yolo3_coco4/layers/c13.bin";
const char *c14_bin = "../tests/yolo3_voc/layers/c14.bin"; const char *c14_bin = "../tests/yolo3_coco4/layers/c14.bin";
const char *c16_bin = "../tests/yolo3_voc/layers/c16.bin"; const char *c16_bin = "../tests/yolo3_coco4/layers/c16.bin";
const char *c17_bin = "../tests/yolo3_voc/layers/c17.bin"; const char *c17_bin = "../tests/yolo3_coco4/layers/c17.bin";
const char *c19_bin = "../tests/yolo3_voc/layers/c19.bin"; const char *c19_bin = "../tests/yolo3_coco4/layers/c19.bin";
const char *c20_bin = "../tests/yolo3_voc/layers/c20.bin"; const char *c20_bin = "../tests/yolo3_coco4/layers/c20.bin";
const char *c22_bin = "../tests/yolo3_voc/layers/c22.bin"; const char *c22_bin = "../tests/yolo3_coco4/layers/c22.bin";
const char *c23_bin = "../tests/yolo3_voc/layers/c23.bin"; const char *c23_bin = "../tests/yolo3_coco4/layers/c23.bin";
const char *c25_bin = "../tests/yolo3_voc/layers/c25.bin"; const char *c25_bin = "../tests/yolo3_coco4/layers/c25.bin";
const char *c26_bin = "../tests/yolo3_voc/layers/c26.bin"; const char *c26_bin = "../tests/yolo3_coco4/layers/c26.bin";
const char *c28_bin = "../tests/yolo3_voc/layers/c28.bin"; const char *c28_bin = "../tests/yolo3_coco4/layers/c28.bin";
const char *c29_bin = "../tests/yolo3_voc/layers/c29.bin"; const char *c29_bin = "../tests/yolo3_coco4/layers/c29.bin";
const char *c31_bin = "../tests/yolo3_voc/layers/c31.bin"; const char *c31_bin = "../tests/yolo3_coco4/layers/c31.bin";
const char *c32_bin = "../tests/yolo3_voc/layers/c32.bin"; const char *c32_bin = "../tests/yolo3_coco4/layers/c32.bin";
const char *c34_bin = "../tests/yolo3_voc/layers/c34.bin"; const char *c34_bin = "../tests/yolo3_coco4/layers/c34.bin";
const char *c35_bin = "../tests/yolo3_voc/layers/c35.bin"; const char *c35_bin = "../tests/yolo3_coco4/layers/c35.bin";
const char *c37_bin = "../tests/yolo3_voc/layers/c37.bin"; const char *c37_bin = "../tests/yolo3_coco4/layers/c37.bin";
const char *c38_bin = "../tests/yolo3_voc/layers/c38.bin"; const char *c38_bin = "../tests/yolo3_coco4/layers/c38.bin";
const char *c39_bin = "../tests/yolo3_voc/layers/c39.bin"; const char *c39_bin = "../tests/yolo3_coco4/layers/c39.bin";
const char *c41_bin = "../tests/yolo3_voc/layers/c41.bin"; const char *c41_bin = "../tests/yolo3_coco4/layers/c41.bin";
const char *c42_bin = "../tests/yolo3_voc/layers/c42.bin"; const char *c42_bin = "../tests/yolo3_coco4/layers/c42.bin";
const char *c44_bin = "../tests/yolo3_voc/layers/c44.bin"; const char *c44_bin = "../tests/yolo3_coco4/layers/c44.bin";
const char *c45_bin = "../tests/yolo3_voc/layers/c45.bin"; const char *c45_bin = "../tests/yolo3_coco4/layers/c45.bin";
const char *c47_bin = "../tests/yolo3_voc/layers/c47.bin"; const char *c47_bin = "../tests/yolo3_coco4/layers/c47.bin";
const char *c48_bin = "../tests/yolo3_voc/layers/c48.bin"; const char *c48_bin = "../tests/yolo3_coco4/layers/c48.bin";
const char *c50_bin = "../tests/yolo3_voc/layers/c50.bin"; const char *c50_bin = "../tests/yolo3_coco4/layers/c50.bin";
const char *c51_bin = "../tests/yolo3_voc/layers/c51.bin"; const char *c51_bin = "../tests/yolo3_coco4/layers/c51.bin";
const char *c53_bin = "../tests/yolo3_voc/layers/c53.bin"; const char *c53_bin = "../tests/yolo3_coco4/layers/c53.bin";
const char *c54_bin = "../tests/yolo3_voc/layers/c54.bin"; const char *c54_bin = "../tests/yolo3_coco4/layers/c54.bin";
const char *c56_bin = "../tests/yolo3_voc/layers/c56.bin"; const char *c56_bin = "../tests/yolo3_coco4/layers/c56.bin";
const char *c57_bin = "../tests/yolo3_voc/layers/c57.bin"; const char *c57_bin = "../tests/yolo3_coco4/layers/c57.bin";
const char *c59_bin = "../tests/yolo3_voc/layers/c59.bin"; const char *c59_bin = "../tests/yolo3_coco4/layers/c59.bin";
const char *c60_bin = "../tests/yolo3_voc/layers/c60.bin"; const char *c60_bin = "../tests/yolo3_coco4/layers/c60.bin";
const char *c62_bin = "../tests/yolo3_voc/layers/c62.bin"; const char *c62_bin = "../tests/yolo3_coco4/layers/c62.bin";
const char *c63_bin = "../tests/yolo3_voc/layers/c63.bin"; const char *c63_bin = "../tests/yolo3_coco4/layers/c63.bin";
const char *c64_bin = "../tests/yolo3_voc/layers/c64.bin"; const char *c64_bin = "../tests/yolo3_coco4/layers/c64.bin";
const char *c66_bin = "../tests/yolo3_voc/layers/c66.bin"; const char *c66_bin = "../tests/yolo3_coco4/layers/c66.bin";
const char *c67_bin = "../tests/yolo3_voc/layers/c67.bin"; const char *c67_bin = "../tests/yolo3_coco4/layers/c67.bin";
const char *c69_bin = "../tests/yolo3_voc/layers/c69.bin"; const char *c69_bin = "../tests/yolo3_coco4/layers/c69.bin";
const char *c70_bin = "../tests/yolo3_voc/layers/c70.bin"; const char *c70_bin = "../tests/yolo3_coco4/layers/c70.bin";
const char *c72_bin = "../tests/yolo3_voc/layers/c72.bin"; const char *c72_bin = "../tests/yolo3_coco4/layers/c72.bin";
const char *c73_bin = "../tests/yolo3_voc/layers/c73.bin"; const char *c73_bin = "../tests/yolo3_coco4/layers/c73.bin";
const char *c75_bin = "../tests/yolo3_voc/layers/c75.bin"; const char *c75_bin = "../tests/yolo3_coco4/layers/c75.bin";
const char *c76_bin = "../tests/yolo3_voc/layers/c76.bin"; const char *c76_bin = "../tests/yolo3_coco4/layers/c76.bin";
const char *c77_bin = "../tests/yolo3_voc/layers/c77.bin"; const char *c77_bin = "../tests/yolo3_coco4/layers/c77.bin";
const char *c78_bin = "../tests/yolo3_voc/layers/c78.bin"; const char *c78_bin = "../tests/yolo3_coco4/layers/c78.bin";
const char *c79_bin = "../tests/yolo3_voc/layers/c79.bin"; const char *c79_bin = "../tests/yolo3_coco4/layers/c79.bin";
const char *c80_bin = "../tests/yolo3_voc/layers/c80.bin"; const char *c80_bin = "../tests/yolo3_coco4/layers/c80.bin";
const char *c81_bin = "../tests/yolo3_voc/layers/c81.bin"; const char *c81_bin = "../tests/yolo3_coco4/layers/c81.bin";
const char *g82_bin = "../tests/yolo3_voc/layers/g82.bin"; const char *g82_bin = "../tests/yolo3_coco4/layers/g82.bin";
const char *c84_bin = "../tests/yolo3_voc/layers/c84.bin"; const char *c84_bin = "../tests/yolo3_coco4/layers/c84.bin";
const char *c87_bin = "../tests/yolo3_voc/layers/c87.bin"; const char *c87_bin = "../tests/yolo3_coco4/layers/c87.bin";
const char *c88_bin = "../tests/yolo3_voc/layers/c88.bin"; const char *c88_bin = "../tests/yolo3_coco4/layers/c88.bin";
const char *c89_bin = "../tests/yolo3_voc/layers/c89.bin"; const char *c89_bin = "../tests/yolo3_coco4/layers/c89.bin";
const char *c90_bin = "../tests/yolo3_voc/layers/c90.bin"; const char *c90_bin = "../tests/yolo3_coco4/layers/c90.bin";
const char *c91_bin = "../tests/yolo3_voc/layers/c91.bin"; const char *c91_bin = "../tests/yolo3_coco4/layers/c91.bin";
const char *c92_bin = "../tests/yolo3_voc/layers/c92.bin"; const char *c92_bin = "../tests/yolo3_coco4/layers/c92.bin";
const char *c93_bin = "../tests/yolo3_voc/layers/c93.bin"; const char *c93_bin = "../tests/yolo3_coco4/layers/c93.bin";
const char *g94_bin = "../tests/yolo3_voc/layers/g94.bin"; const char *g94_bin = "../tests/yolo3_coco4/layers/g94.bin";
const char *c96_bin = "../tests/yolo3_voc/layers/c96.bin"; const char *c96_bin = "../tests/yolo3_coco4/layers/c96.bin";
const char *c99_bin = "../tests/yolo3_voc/layers/c99.bin"; const char *c99_bin = "../tests/yolo3_coco4/layers/c99.bin";
const char *c100_bin = "../tests/yolo3_voc/layers/c100.bin"; const char *c100_bin = "../tests/yolo3_coco4/layers/c100.bin";
const char *c101_bin = "../tests/yolo3_voc/layers/c101.bin"; const char *c101_bin = "../tests/yolo3_coco4/layers/c101.bin";
const char *c102_bin = "../tests/yolo3_voc/layers/c102.bin"; const char *c102_bin = "../tests/yolo3_coco4/layers/c102.bin";
const char *c103_bin = "../tests/yolo3_voc/layers/c103.bin"; const char *c103_bin = "../tests/yolo3_coco4/layers/c103.bin";
const char *c104_bin = "../tests/yolo3_voc/layers/c104.bin"; const char *c104_bin = "../tests/yolo3_coco4/layers/c104.bin";
const char *c105_bin = "../tests/yolo3_voc/layers/c105.bin"; const char *c105_bin = "../tests/yolo3_coco4/layers/c105.bin";
const char *g106_bin = "../tests/yolo3_voc/layers/g106.bin"; const char *g106_bin = "../tests/yolo3_coco4/layers/g106.bin";
const char *output_bins[3] = { const char *output_bins[3] = {
"../tests/yolo3_voc/debug/layer82_out.bin", "../tests/yolo3_coco4/debug/layer82_out.bin",
"../tests/yolo3_voc/debug/layer94_out.bin", "../tests/yolo3_coco4/debug/layer94_out.bin",
"../tests/yolo3_voc/debug/layer106_out.bin" "../tests/yolo3_coco4/debug/layer106_out.bin"
}; };
int main() { int main() {
@@ -240,8 +240,8 @@ int main() {
tk::dnn::Activation a79 (&net, tk::dnn::ACTIVATION_LEAKY); 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::Conv2d c80 (&net,1024, 3, 3, 1, 1, 1, 1, c80_bin, true);
tk::dnn::Activation a80 (&net, tk::dnn::ACTIVATION_LEAKY); tk::dnn::Activation a80 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c81 (&net, 75, 1, 1, 1, 1, 0, 0, c81_bin, false); tk::dnn::Conv2d c81 (&net, 27, 1, 1, 1, 1, 0, 0, c81_bin, false);
tk::dnn::Yolo yolo0 (&net, 20, 3, g82_bin); tk::dnn::Yolo yolo0 (&net, 4, 3, g82_bin);
tk::dnn::Layer *m83_layers[1] = { &a79 }; tk::dnn::Layer *m83_layers[1] = { &a79 };
tk::dnn::Route m83 (&net, m83_layers, 1); tk::dnn::Route m83 (&net, m83_layers, 1);
@@ -264,8 +264,8 @@ int main() {
tk::dnn::Conv2d c92 (&net, 512, 3, 3, 1, 1, 1, 1, c92_bin, true); 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::Activation a92 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c93 (&net, 75, 1, 1, 1, 1, 0, 0, c93_bin, false); tk::dnn::Conv2d c93 (&net, 27, 1, 1, 1, 1, 0, 0, c93_bin, false);
tk::dnn::Yolo yolo1 (&net, 20, 3, g94_bin); tk::dnn::Yolo yolo1 (&net, 4, 3, g94_bin);
tk::dnn::Layer *m95_layers[1] = { &a91 }; tk::dnn::Layer *m95_layers[1] = { &a91 };
tk::dnn::Route m95 (&net, m95_layers, 1); tk::dnn::Route m95 (&net, m95_layers, 1);
@@ -288,8 +288,8 @@ int main() {
tk::dnn::Conv2d c104 (&net, 256, 3, 3, 1, 1, 1, 1, c104_bin, true); 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::Activation a104 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c105 (&net, 75, 1, 1, 1, 1, 0, 0, c105_bin, false); tk::dnn::Conv2d c105 (&net, 27, 1, 1, 1, 1, 0, 0, c105_bin, false);
tk::dnn::Yolo yolo2 (&net, 20, 3, g106_bin); tk::dnn::Yolo yolo2 (&net, 4, 3, g106_bin);
// Load input // Load input
dnnType *data; dnnType *data;
@@ -300,7 +300,7 @@ int main() {
net.print(); net.print();
//convert network to tensorRT //convert network to tensorRT
tk::dnn::NetworkRT netRT(&net, "yolo3_voc.rt"); tk::dnn::NetworkRT netRT(&net, "yolo3_coco4.rt");
// the network have 3 outputs // the network have 3 outputs
tk::dnn::dataDim_t out_dim[3]; tk::dnn::dataDim_t out_dim[3];
@@ -1,10 +1,10 @@
[net] [net]
# Testing # Testing
batch=1 batch=1
subdivisions=1 subdivisions=1
# Training # Training
# batch=64 #batch=32
# subdivisions=16 #subdivisions=8
width=416 width=416
height=416 height=416
channels=3 channels=3
@@ -602,13 +602,13 @@ activation=leaky
size=1 size=1
stride=1 stride=1
pad=1 pad=1
filters=75 filters=27
activation=linear activation=linear
[yolo] [yolo]
mask = 6,7,8 mask = 6,7,8
anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326 anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326
classes=20 classes=4
num=9 num=9
jitter=.3 jitter=.3
ignore_thresh = .5 ignore_thresh = .5
@@ -686,13 +686,13 @@ activation=leaky
size=1 size=1
stride=1 stride=1
pad=1 pad=1
filters=75 filters=27
activation=linear activation=linear
[yolo] [yolo]
mask = 3,4,5 mask = 3,4,5
anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326 anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326
classes=20 classes=4
num=9 num=9
jitter=.3 jitter=.3
ignore_thresh = .5 ignore_thresh = .5
@@ -770,13 +770,13 @@ activation=leaky
size=1 size=1
stride=1 stride=1
pad=1 pad=1
filters=75 filters=27
activation=linear activation=linear
[yolo] [yolo]
mask = 0,1,2 mask = 0,1,2
anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326 anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326
classes=20 classes=4
num=9 num=9
jitter=.3 jitter=.3
ignore_thresh = .5 ignore_thresh = .5