diff --git a/README.md b/README.md index 7fb389b..2325eb5 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,7 @@ All models from darknet are now parsed directly from cfg, you still need to expo relu leaky mish + logistic ## Run the demo @@ -225,7 +226,7 @@ Once you have successfully created your rt file, run the demo: ``` In general the demo program takes 7 parameters: ``` -./demo +./demo ``` where * `````` is the rt file generated by a test @@ -361,7 +362,8 @@ This demo also creates a json file named ```net_name_COCO_res.json``` containing | yolo4 | Yolov4 8 | [COCO 2017](http://cocodataset.org/) | 80 | 416x416 | [weights](https://cloud.hipert.unimore.it/s/d97CFzYqCPCp5Hg/download) | | yolo4_berkeley | Yolov4 8 | [BDD100K ](https://bair.berkeley.edu/blog/2018/05/30/bdd/) | 10 | 540x320 | [weights](https://cloud.hipert.unimore.it/s/nkWFa5fgb4NTdnB/download) | | yolo4tiny | Yolov4 tiny 9 | [COCO 2017](http://cocodataset.org/) | 80 | 416x416 | [weights](https://cloud.hipert.unimore.it/s/iRnc4pSqmx78gJs/download) | -| yolo4x | Yolov4x-mish 9 | [COCO 2017](http://cocodataset.org/) | 80 | 672x672 | [weights](https://cloud.hipert.unimore.it/s/BLPpiAigZJLorQD/download) | +| yolo4x | Yolov4x-mish 9 | [COCO 2017](http://cocodataset.org/) | 80 | 640x640 | [weights](https://cloud.hipert.unimore.it/s/5MFjtNtgbDGdJEo/download) | +| yolo4x-cps | Scaled Yolov4 10 | [COCO 2017](http://cocodataset.org/) | 80 | 512x512 | [weights](https://cloud.hipert.unimore.it/s/AfzHE4BfTeEm2gH/download) | ### tkDNN on Windows 10 (experimental) @@ -463,3 +465,4 @@ It is recommended to use Nvidia Driver(465+),Cuda unknown errors have been obser 7. Wang, Chien-Yao, et al. "CSPNet: A New Backbone that can Enhance Learning Capability of CNN." arXiv preprint arXiv:1911.11929 (2019). 8. Bochkovskiy, Alexey, Chien-Yao Wang, and Hong-Yuan Mark Liao. "YOLOv4: Optimal Speed and Accuracy of Object Detection." arXiv preprint arXiv:2004.10934 (2020). 9. Bochkovskiy, Alexey, "Yolo v4, v3 and v2 for Windows and Linux" (https://github.com/AlexeyAB/darknet) +10. Wang, Chien-Yao, Alexey Bochkovskiy, and Hong-Yuan Mark Liao. "Scaled-YOLOv4: Scaling Cross Stage Partial Network." arXiv preprint arXiv:2011.08036 (2020). diff --git a/include/tkDNN/NetworkRT.h b/include/tkDNN/NetworkRT.h index 66892f5..29cacf5 100644 --- a/include/tkDNN/NetworkRT.h +++ b/include/tkDNN/NetworkRT.h @@ -25,9 +25,9 @@ template T readBUF(const char*& buffer) using namespace nvinfer1; #include "pluginsRT/ActivationLeakyRT.h" +#include "pluginsRT/ActivationLogisticRT.h" #include "pluginsRT/ActivationReLUCeilingRT.h" #include "pluginsRT/ActivationMishRT.h" -#include "pluginsRT/ActivationLogisticRT.h" #include "pluginsRT/ReorgRT.h" #include "pluginsRT/RegionRT.h" #include "pluginsRT/RouteRT.h" diff --git a/include/tkDNN/pluginsRT/ActivationLogisticRT.h b/include/tkDNN/pluginsRT/ActivationLogisticRT.h index 83f62ff..063931f 100644 --- a/include/tkDNN/pluginsRT/ActivationLogisticRT.h +++ b/include/tkDNN/pluginsRT/ActivationLogisticRT.h @@ -57,4 +57,4 @@ public: } int size; -}; \ No newline at end of file +}; diff --git a/scripts/test_all_tests.sh b/scripts/test_all_tests.sh index af04aff..6aab775 100644 --- a/scripts/test_all_tests.sh +++ b/scripts/test_all_tests.sh @@ -69,10 +69,11 @@ do echo -e "${ORANGE}Batch $TKDNN_BATCHSIZE ${NC}" test_net mnist - ./test_imuodom &>> $out_file - print_output $? imuodom + # ./test_imuodom &>> $out_file + # print_output $? imuodom test_net yolo4 + test_net yolo4-csp test_net yolo4x test_net yolo4_berkeley test_net yolo4tiny diff --git a/src/Activation.cpp b/src/Activation.cpp index 4219271..a8642e7 100644 --- a/src/Activation.cpp +++ b/src/Activation.cpp @@ -56,7 +56,7 @@ dnnType* Activation::infer(dataDim_t &dim, dnnType* srcData) { else if(act_mode == ACTIVATION_LOGISTIC) { activationLOGISTICForward(srcData, dstData, dim.tot()); - }else { + } else { dnnType alpha = dnnType(1); dnnType beta = dnnType(0); checkCUDNN( cudnnActivationForward(net->cudnnHandle, diff --git a/src/NetworkRT.cpp b/src/NetworkRT.cpp index 5dc8ee0..320c3ea 100644 --- a/src/NetworkRT.cpp +++ b/src/NetworkRT.cpp @@ -667,6 +667,11 @@ IPlugin* PluginFactory::createPlugin(const char* layerName, const void* serialDa a->size = readBUF(buf); return a; } + if(name.find("ActivationLogistic") == 0) { + ActivationLogisticRT *a = new ActivationLogisticRT(); + a->size = readBUF(buf); + return a; + } if(name.find("ActivationCReLU") == 0) { float activationReluTemp = readBUF(buf); ActivationReLUCeiling* a = new ActivationReLUCeiling(activationReluTemp); diff --git a/src/Yolo.cpp b/src/Yolo.cpp index 1eb7843..eaf1de7 100644 --- a/src/Yolo.cpp +++ b/src/Yolo.cpp @@ -96,7 +96,6 @@ dnnType* Yolo::infer(dataDim_t &dim, dnnType* srcData) { activationLOGISTICForward(srcData + index, dstData + index, 2*dim.w*dim.h); if (this->scaleXY != 1) scalAdd(dstData + index, 2 * dim.w*dim.h, this->scaleXY, -0.5*(this->scaleXY - 1), 1); - index = entry_index(b, n*dim.w*dim.h, 4, classes, input_dim, output_dim); activationLOGISTICForward(srcData + index, dstData + index, (1+classes)*dim.w*dim.h); } diff --git a/tests/darknet/cfg/yolo4-csp.cfg b/tests/darknet/cfg/yolo4-csp.cfg index 887898e..691ec03 100644 --- a/tests/darknet/cfg/yolo4-csp.cfg +++ b/tests/darknet/cfg/yolo4-csp.cfg @@ -1276,4 +1276,4 @@ iou_loss=ciou nms_kind=diounms beta_nms=0.6 new_coords=1 -max_delta=2 \ No newline at end of file +max_delta=2 diff --git a/tests/darknet/cfg/yolo4x.cfg b/tests/darknet/cfg/yolo4x.cfg index f6604f6..2ff854f 100644 --- a/tests/darknet/cfg/yolo4x.cfg +++ b/tests/darknet/cfg/yolo4x.cfg @@ -1433,4 +1433,4 @@ iou_loss=ciou nms_kind=diounms beta_nms=0.6 new_coords=1 -max_delta=2 \ No newline at end of file +max_delta=2 diff --git a/tests/darknet/yolo4-csp.cpp b/tests/darknet/yolo4-csp.cpp index 3802a9a..8ad8aef 100644 --- a/tests/darknet/yolo4-csp.cpp +++ b/tests/darknet/yolo4-csp.cpp @@ -6,28 +6,26 @@ int main() { std::string bin_path = "yolo4-csp"; - std::vector input_bins = { - bin_path + "/layers/input.bin" + std::vector input_bins = { + bin_path + "/layers/input.bin" }; std::vector output_bins = { - bin_path + "/debug/layer144_out.bin", - bin_path + "/debug/layer159_out.bin", - bin_path + "/debug/layer174_out.bin" + bin_path + "/debug/layer144_out.bin", + bin_path + "/debug/layer159_out.bin", + bin_path + "/debug/layer174_out.bin" }; std::string wgs_path = bin_path + "/layers"; std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo4-csp.cfg"; std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/coco.names"; downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/AfzHE4BfTeEm2gH/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;