Open SokPhanith opened 3 years ago
Go to line 322 where this block of code is in mobilenetv2ssd.cpp
// classification header 0
tk::dnn::Layer *header_0[1] = {&relu_14_1};
tk::dnn::Route rout_ch_0(&net, header_0, 1);
tk::dnn::Conv2d ch_0_conv1(&net, 576, 3, 3, 1, 1, 1, 1, classification_header0[0], true, false, 576, true);
tk::dnn::Activation ch_relu_0_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
tk::dnn::Conv2d ch_0_conv2(&net, 126, 1, 1, 1, 1, 0, 0, classification_header0[1], false);
tk::dnn::Layer *conf0[1] = {&ch_0_conv2};
Change it to
// classification header 0
tk::dnn::Layer *header_0[1] = {&relu_14_1};
tk::dnn::Route rout_ch_0(&net, header_0, 1);
tk::dnn::Conv2d ch_0_conv1(&net, 576, 3, 3, 1, 1, 1, 1, classification_header0[0], true, false, 576, true);
tk::dnn::Activation ch_relu_0_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
tk::dnn::Conv2d ch_0_conv2(&net, 6 * classes, 1, 1, 1, 1, 0, 0, classification_header0[1], false); //change 126 to 6 x classes
tk::dnn::Layer *conf0[1] = {&ch_0_conv2};
Do that for the next 4 blocks
Thanks you @daynauth. I can covert it to TensorRT engine but result detection not good when I got the result like below : fp32. | [ 0 ]: 1.5204 1.54345 | [ 2 ]: 1.87475 1.71696 | [ 3 ]: -1.00988 -0.880602 | [ 4 ]: 1.60527 1.77853 | [ 5 ]: -0.931939 -0.720109 | [ 6 ]: 1.71499 1.59624 | [ 7 ]: -0.768118 -0.959083 | [ 8 ]: 1.04617 1.27626 | [ 9 ]: -1.49756 -1.43087 | Wrongs: 10 ~0.02
| [ 0 ]: -0.229185 0.0469791 | [ 1 ]: -0.0839813 0.0822884 | [ 3 ]: 0.011675 -0.0248753 | [ 4 ]: -0.475023 -0.607493 | [ 5 ]: 0.951046 0.775346 | [ 6 ]: 0.272973 -0.0831814 | [ 7 ]: -0.949614 -0.753534 | [ 8 ]: -0.63458 -0.810912 | [ 9 ]: -0.128321 -0.210743 | Wrongs: 23 ~0.02 TRT vs correct | OK ~0.02 | OK ~0.02 CUDNN vs TRT
| [ 0 ]: 1.5204 1.54342 | [ 2 ]: 1.87475 1.717 | [ 3 ]: -1.00988 -0.880599 | [ 4 ]: 1.60527 1.77856 | [ 5 ]: -0.931939 -0.720109 | [ 6 ]: 1.71499 1.59627 | [ 7 ]: -0.768118 -0.959077 | [ 8 ]: 1.04617 1.27621 | [ 9 ]: -1.49756 -1.4309 | Wrongs: 10 ~0.02
CUDNN vs TRT
| [ 0 ]: 0.968103 0.709769 | [ 1 ]: 0.983429 0.773645 | [ 2 ]: 0.976511 0.707555 | [ 3 ]: 0.964841 0.723442 | [ 4 ]: 0.972451 0.751323 | [ 5 ]: 0.958528 0.655424 | [ 6 ]: 0.946463 0.65149 | [ 7 ]: 0.975324 0.725766 | [ 8 ]: 0.960998 0.645195 | Wrongs: 5988 ~0.02
| [ 0 ]: 0.596325 0.54878 | [ 1 ]: -0.21843 0.712039 | [ 2 ]: -0.331537 0.948913 | [ 3 ]: -0.595714 -1.65793 | [ 4 ]: 0.314037 0.228692 | [ 5 ]: 0.10484 0.0525467 | [ 6 ]: 0.128811 -0.227251 | [ 7 ]: -0.422746 0.294692 | [ 8 ]: 0.322055 1.32709 | Wrongs: 11711 ~0.02
fp16 ==== RESNET CHECK RESULTS === CUDNN vs correct
| [ 0 ]: 1.5204 1.54345 | [ 2 ]: 1.87475 1.71696 | [ 3 ]: -1.00988 -0.880602 | [ 4 ]: 1.60527 1.77853 | [ 5 ]: -0.931939 -0.720109 | [ 6 ]: 1.71499 1.59624 | [ 7 ]: -0.768118 -0.959083 | [ 8 ]: 1.04617 1.27626 | [ 9 ]: -1.49756 -1.43087 | Wrongs: 10 ~0.02
| [ 0 ]: -0.229185 0.0469791 | [ 1 ]: -0.0839813 0.0822884 | [ 3 ]: 0.011675 -0.0248753 | [ 4 ]: -0.475023 -0.607493 | [ 5 ]: 0.951046 0.775346 | [ 6 ]: 0.272973 -0.0831814 | [ 7 ]: -0.949614 -0.753534 | [ 8 ]: -0.63458 -0.810912 | [ 9 ]: -0.128321 -0.210743 | Wrongs: 23 ~0.02 TRT vs correct
| [ 0 ]: 0 1.54345 | [ 1 ]: 0 -1.09417 | [ 2 ]: 0 1.71696 | [ 3 ]: 0 -0.880602 | [ 4 ]: 0 1.77853 | [ 5 ]: 0 -0.720109 | [ 6 ]: 0 1.59624 | [ 7 ]: 0 -0.959083 | [ 8 ]: 0 1.27626 | Wrongs: 12 ~0.02
| [ 0 ]: 0 0.0469791 | [ 1 ]: 0 0.0822884 | [ 2 ]: 0 0.871726 | [ 3 ]: 0 -0.0248753 | [ 4 ]: 0 -0.607493 | [ 5 ]: 0 0.775346 | [ 6 ]: 0 -0.0831814 | [ 7 ]: 0 -0.753534 | [ 8 ]: 0 -0.810912 | Wrongs: 24 ~0.02 CUDNN vs TRT
| [ 0 ]: 1.5204 0 | [ 1 ]: -1.07767 0 | [ 2 ]: 1.87475 0 | [ 3 ]: -1.00988 0 | [ 4 ]: 1.60527 0 | [ 5 ]: -0.931939 0 | [ 6 ]: 1.71499 0 | [ 7 ]: -0.768118 0 | [ 8 ]: 1.04617 0 | Wrongs: 12 ~0.02
CUDNN vs TRT
| [ 0 ]: 0.968103 nan | [ 1 ]: 0.983429 0.5 | [ 2 ]: 0.976511 0.5 | [ 3 ]: 0.964841 0.5 | [ 4 ]: 0.972451 0.5 | [ 5 ]: 0.958528 0.5 | [ 6 ]: 0.946463 nan | [ 7 ]: 0.975324 0.5 | [ 8 ]: 0.960998 0.5 | Wrongs: 6000 ~0.02
| [ 0 ]: 0.596325 0 | [ 1 ]: -0.21843 0 | [ 2 ]: -0.331537 0 | [ 3 ]: -0.595714 0 | [ 4 ]: 0.314037 0 | [ 5 ]: 0.10484 0 | [ 6 ]: 0.128811 0 | [ 7 ]: -0.422746 0 | [ 8 ]: 0.322055 0 | Wrongs: 11352 ~0.02
when I read demo with high thresh-hold
./demo mobilenetv2ssd_fp32.rt cnc_drive.mp4 m 1 1 1 0.5 or ./demo mobilenetv2ssd_fp16.rt cnc_drive.mp4 m 1 1 1 0.5
it's have a lot of bbox on my detection or live from webcam
My model have 4 classes and I follow training on this source : https://github.com/mive93/pytorch-ssd. I test a simple on jetson nano it work around 12fps and output 2 folder layers and debug and then copy to build folder I go to change in tests/mobilent/mobilenetv2ssd/mobilenetv2ssd.cpp change classes = 5 and then go to path src/MobilenetDetection.cpp add more class like : else if(classes == 5){ const char *classesnames[] = { "a","b","c","d"}; classesNames = std::vector(classesnames, std::end(classesnames));}
and build again.
when run: ./test_mobilenetv2ssd
Error like this :
New NETWORK (tkDNN v0.5, CUDNN v8)
Reading weights: I=3 O=32 KERNEL=3x3x1
Reading weights: I=1 O=32 KERNEL=3x3x1
Reading weights: I=32 O=16 KERNEL=1x1x1
Reading weights: I=16 O=96 KERNEL=1x1x1
Reading weights: I=1 O=96 KERNEL=3x3x1
Reading weights: I=96 O=24 KERNEL=1x1x1
Reading weights: I=24 O=144 KERNEL=1x1x1
Reading weights: I=1 O=144 KERNEL=3x3x1
Reading weights: I=144 O=24 KERNEL=1x1x1
Reading weights: I=24 O=144 KERNEL=1x1x1
Reading weights: I=1 O=144 KERNEL=3x3x1
Reading weights: I=144 O=32 KERNEL=1x1x1
Reading weights: I=32 O=192 KERNEL=1x1x1
Reading weights: I=1 O=192 KERNEL=3x3x1
Reading weights: I=192 O=32 KERNEL=1x1x1
Reading weights: I=32 O=192 KERNEL=1x1x1
Reading weights: I=1 O=192 KERNEL=3x3x1
Reading weights: I=192 O=32 KERNEL=1x1x1
Reading weights: I=32 O=192 KERNEL=1x1x1
Reading weights: I=1 O=192 KERNEL=3x3x1
Reading weights: I=192 O=64 KERNEL=1x1x1
Reading weights: I=64 O=384 KERNEL=1x1x1
Reading weights: I=1 O=384 KERNEL=3x3x1
Reading weights: I=384 O=64 KERNEL=1x1x1
Reading weights: I=64 O=384 KERNEL=1x1x1
Reading weights: I=1 O=384 KERNEL=3x3x1
Reading weights: I=384 O=64 KERNEL=1x1x1
Reading weights: I=64 O=384 KERNEL=1x1x1
Reading weights: I=1 O=384 KERNEL=3x3x1
Reading weights: I=384 O=64 KERNEL=1x1x1
Reading weights: I=64 O=384 KERNEL=1x1x1
Reading weights: I=1 O=384 KERNEL=3x3x1
Reading weights: I=384 O=96 KERNEL=1x1x1
Reading weights: I=96 O=576 KERNEL=1x1x1
Reading weights: I=1 O=576 KERNEL=3x3x1
Reading weights: I=576 O=96 KERNEL=1x1x1
Reading weights: I=96 O=576 KERNEL=1x1x1
Reading weights: I=1 O=576 KERNEL=3x3x1
Reading weights: I=576 O=96 KERNEL=1x1x1
Reading weights: I=96 O=576 KERNEL=1x1x1
Reading weights: I=1 O=576 KERNEL=3x3x1
Reading weights: I=576 O=160 KERNEL=1x1x1
Reading weights: I=160 O=960 KERNEL=1x1x1
Reading weights: I=1 O=960 KERNEL=3x3x1
Reading weights: I=960 O=160 KERNEL=1x1x1
Reading weights: I=160 O=960 KERNEL=1x1x1
Reading weights: I=1 O=960 KERNEL=3x3x1
Reading weights: I=960 O=160 KERNEL=1x1x1
Reading weights: I=160 O=960 KERNEL=1x1x1
Reading weights: I=1 O=960 KERNEL=3x3x1
Reading weights: I=960 O=320 KERNEL=1x1x1
Reading weights: I=320 O=1280 KERNEL=1x1x1
Reading weights: I=1280 O=256 KERNEL=1x1x1
Reading weights: I=1 O=256 KERNEL=3x3x1
Reading weights: I=256 O=512 KERNEL=1x1x1
Reading weights: I=512 O=128 KERNEL=1x1x1
Reading weights: I=1 O=128 KERNEL=3x3x1
Reading weights: I=128 O=256 KERNEL=1x1x1
Reading weights: I=256 O=128 KERNEL=1x1x1
Reading weights: I=1 O=128 KERNEL=3x3x1
Reading weights: I=128 O=256 KERNEL=1x1x1
Reading weights: I=256 O=64 KERNEL=1x1x1
Reading weights: I=1 O=64 KERNEL=3x3x1
Reading weights: I=64 O=64 KERNEL=1x1x1
Reading weights: I=1 O=576 KERNEL=3x3x1
Reading weights: I=576 O=126 KERNEL=1x1x1
Error reading file mobilenetv2ssd/layers/classification_headers-0-3.bin with n of float: 72576 seek: 0 size: 290304
/home/phanith/tkDNN/src/utils.cpp:58 Aborting...