446 Commits

Author SHA1 Message Date
Francesco Gatti d4f7b4ad8b remove using namespace useless 2022-03-30 22:14:06 +02:00
Francesco Gatti 5e71b99265 YoloRT save bias, mask and clasesName into RT file 2022-03-30 20:46:51 +02:00
Francesco Gatti fa9db167b8 version 0.7 2022-03-30 17:48:02 +02:00
Francesco Gatti 30098ca6b4 Merge pull request #285 from ceccocats/tensorrt8
Tensorrt8
2022-03-30 17:45:41 +02:00
Francesco Gatti df31375b67 Merge branch 'master' into tensorrt8 2022-03-30 16:41:45 +02:00
Francesco Gatti 69bb7370a5 compile with tensorrt7 2022-03-30 15:52:30 +02:00
Francesco Gatti 7c0620e391 test_all_test script save results in separate files 2022-03-30 15:47:41 +02:00
Micaela Verucchi c690d537f1 Update READMEs, add README_depth, minors
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2022-03-30 15:40:25 +02:00
Harshvardhan Chandirasekar 40266a6c32 Fixed tensorrt8 branch to work jetpack 4.5 and tensorrt7
Signed-off-by: perseusdg <f20180523@goa.bits-pilani.ac.in>
2022-03-16 18:09:32 +05:30
perseusdg 480b5a9c5a added monodepth2_1024 2022-02-22 14:50:39 +00:00
Micaela Verucchi 3bcc32ffdc Fix nms thresh
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2022-02-15 19:57:57 +01:00
perseusdg b3bc93693f Revert "Merge branch 'tensorrt8-rds' into depth"
This reverts commit 00f06f7bcc, reversing
changes made to 6a133d8dec.
2022-01-25 18:30:39 +05:30
Harshvardhan Chandirasekar ef564f134d Merge pull request #6 from perseusdg/depth
Merge - build fixes
2022-01-24 21:55:06 +05:30
perseusdg f996659845 Merge remote-tracking branch 'origin/depth' into depth 2022-01-24 21:48:35 +05:30
Harshvardhan Chandirasekar afdad8e661 Moved batchnorm and test_monodepth2_new_format layer to dev
Signed-off-by: perseusdg <harshvardhan.chandira@gmail.com>
2022-01-24 21:48:21 +05:30
Harshvardhan Chandirasekar 71366befc2 Merge pull request #5 from perseusdg/depth
Merge tensorrt8 and depth
2022-01-24 21:44:37 +05:30
Harshvardhan Chandirasekar 3e86671c50 Moved batchnorm and test_monodepth2_new_format layer to dev
Signed-off-by: perseusdg <harshvardhan.chandira@gmail.com>
2022-01-24 21:41:59 +05:30
Harshvardhan Chandirasekar 00f06f7bcc Merge branch 'tensorrt8-rds' into depth 2022-01-20 22:05:54 +05:30
Harshvardhan Chandirasekar 53725c88a9 Merge pull request #3 from perseusdg/tensorrt8
push tensorrt8 commits to the rds branch
2022-01-20 21:12:49 +05:30
Harshvardhan Chandirasekar 6a133d8dec -Replaced ISliceLayer based paddings(reflection,constant and zero) with the IPluginV2 version for TensorRT >= 8.2.0
-Fixed demo build issue on Windows

Signed-off-by: perseusdg <harshvardhan.chandira@gmail.com>
2022-01-20 00:52:22 +05:30
Micaela Verucchi decd73d298 Fix saving result video in demoDepth, add automatic download for monodepth2 weights
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2022-01-19 10:22:06 -08:00
Micaela Verucchi 907df27e07 Fix monodepth2, add demoDepth:
- Fix monodepth2 network, now works with both cuDNN and tensorRT
- Substitute cuDNN ELU with tkDNN one
- add DepthNN class
- add demoDepth demo, now only works with monodepth2 net

Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
               Francesco Gatti <gattifrancesco@hotmail.it>
2022-01-18 21:34:16 -08:00
perseusdg 19e41a8b99 monodepth2 new format (test) conv + independent batch norm 2022-01-11 12:38:36 +05:30
perseusdg 061bc79a69 Added BatchNorm to NetworkRT (conver_layer) 2022-01-10 22:48:16 +05:30
perseusdg bcf0c4eab3 Added BatchNorm Layer (Testing still needs to be done) 2022-01-10 22:48:06 +05:30
perseusdg e1eac2d42a Added a seperate layer file for batchnorm,to support an independent batchnorm class in order to pass necessary parameters read from the bin file. 2022-01-10 22:47:59 +05:30
perseusdg 3023926695 fix constantpadding commit 2022-01-09 22:17:43 +05:30
perseusdg 4d8f99b441 depth->tensorrt8 patches 2022-01-09 19:24:38 +05:30
perseusdg cabebc95a2 added individual layer names in monodepth2 2022-01-09 13:45:44 +05:30
perseusdg 3b58fbcb82 Added ConstantPadding plugin for TensorRT < 8.2 2022-01-07 13:05:09 +05:30
perseusdg f189efcbb1 Reflection Padding native plugin fix ,forgot to added input_dim.c in the plugin creator 2022-01-07 05:41:26 +00:00
perseusdg 7298dcfb2f Added monodepth2.cpp 2022-01-06 16:30:11 +00:00
perseusdg b75cecb105 Added constant and zero padding with ISliceLayer,need to add them for tensorrt versions less than 8.2 using IPluginV2Ext instead of ISliceLayer since they dont seem to support reflect and zero 2022-01-04 09:03:04 +05:30
perseusdg ba022663f1 completed padding migrations from github 2022-01-03 19:49:32 +05:30
perseusdg 6837644eb2 add reflection padding from github 2022-01-03 18:58:13 +05:30
perseusdg dcf4054bc6 performance improvements for yolo based networks,significant reduction in inference time can be seen yolo4tiny ,yolo4 and minor reduction in inference time can be seen in yolo4_berkeley_f1 and yolo4_berkeley - tested with a batchsize of 1 and 2 and on gtx 1070,it is possible that the performance improvement is more signficant in newer hardware 2022-01-03 13:52:16 +05:30
Micaela Verucchi 04de9908a6 Add yolo4-csp for crowdhuman dataset, add shelfnet for coco-stuff dataset, fix minor in demo.cpp
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-11-29 17:33:57 +01:00
Micaela Verucchi 9cbac460bc Update README.md 2021-11-25 11:32:38 +01:00
Micaela Verucchi 24cdb4c4a7 Update Readme
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-11-24 18:20:26 +01:00
Micaela Verucchi a4781244f4 Fix merge problem
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-11-24 18:16:15 +01:00
Micaela Verucchi bbae618118 Update README and add print in demo
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-11-24 18:08:41 +01:00
Micaela Verucchi 0707c26bbd Merge of perseusdg-tensorrt8 inside tkDNN
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-11-24 17:59:27 +01:00
perseusdg 9cecc5051a -Modified Dockerfile.base to cudagl
-Changed demo to take in input from demoConfig.yaml file
-Readme changes for demo.md
2021-11-24 03:39:57 +05:30
Micaela Verucchi be5864748a Use yaml config file for the demo instead of param list
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-11-23 16:29:40 +01:00
Micaela Verucchi 75c3cb0038 Add script to compare times_rtinference.csv files
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-11-23 13:01:58 +01:00
Micaela Verucchi 55df97afe1 Fix warnings, upgrade to C++14
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-11-23 13:01:07 +01:00
perseusdg a8c98e3c31 Signed-off-by: perseusdg <43143075+perseusdg@users.noreply.github.com>
removed all TRT8_DEPRACTED functions
2021-11-19 22:40:52 +05:30
perseusdg 19f12d9c15 rds_slam -> tensorrt8 port for rds 2021-11-15 00:08:37 +05:30
perseusdg 6f936096ae Added num of layers in net and netRT,suggestions from pull request 270 on main repo 2021-11-14 07:13:42 +05:30
perseusdg 367061fea2 fps fix 2021-11-13 18:11:46 +05:30
perseusdg d488c3bd17 remove duplicated lines 2021-11-13 02:12:50 +05:30
perseusdg ee5000ccca bug fixes for dla networks and ported optimization from different pull request 2021-11-13 02:00:49 +05:30
perseusdg 9e328c0daa Migrate tkDNN max pooling plugin creation to pluginRegistry from the default method 2021-11-10 20:09:57 +05:30
perseusdg 7dd33cd118 added assert for supportsFormat in plugins 2021-11-10 14:37:16 +05:30
perseusdg 936b680f2f Remove debug prints 2021-11-10 13:45:44 +05:30
perseusdg c0e2097397 - CMakeLists.txt opencv cuda contrib autodetect
- Updated Docker to cuda-11.3+cudnn-8.2.1+TensorRT-8.0.34,Ubuntu to 20.04 and OpenCV to 4.5.4
- Updated OpenCV4 to 4.5.4 in install_OpenCV4.sh
- Updated README.md
2021-11-10 12:30:57 +05:30
perseusdg 744396fb0e Update README.md,windows.md and demo.cpp
Small fixes in DeformableConvRT.cpp
2021-11-09 13:37:26 +05:30
Micaela Verucchi d2d44e9e92 Fix max elem (remove thrust) for segmentation
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-11-05 19:54:02 +05:30
Micaela Verucchi d6fb6c6af4 Fix max elem (remove thrust) for segmentation
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-11-04 19:28:55 +01:00
perseusdg 802c01bd8f windows debug fix 2021-10-30 19:29:21 +05:30
perseusdg 7a89a4a573 ReshapeRT.cpp fix 2021-10-28 23:43:12 +05:30
perseusdg c5e66c6bf6 TRT8 works with almost every nerual network now!!!!(including demo3d) 2021-10-28 23:35:37 +05:30
perseusdg 8c36dd0431 mobilenet works with trt7(IPluginV2IOExt) ,need to test it with trt8 2021-10-27 18:00:33 +05:30
perseusdg 54e7af11ed tensorrt7 support for ipluginv2 2021-10-18 18:07:57 +05:30
Micaela Verucchi eca10ac0a8 Update weights
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-09-19 00:16:31 +02:00
perseusdg 18cc6abbb6 DeformableConvRT.h fixes ,cmake cuda arch auto detection 2021-09-07 23:57:52 +05:30
perseusdg 03473743c4 tkDNN works with trt8!!,need to test int8 and mobilenet,dla_cnet (fps seems to be a bit low 350 on trt8 compared to 396 on trt7) 2021-09-07 22:00:28 +05:30
perseusdg 9fa116ce4a tkdnn(trt8) runs now minus the detections ,[executionContext.cpp::enqueueInternal::312] Error Code 3: Internal Error (Parameter check failed at: runtime/api/executionContext.cpp::enqueueInternal::312, condition: mDeviceMemorySize == 0 || mExecutionResources->getDeviceMemory() != nullptr - is the error that causes it 2021-09-07 07:20:46 +05:30
perseusdg 504dee5016 test_yolo4 netRT->destroy() 2021-09-06 15:35:57 +05:30
Harshvardhan Chandirasekar 65ba5c9844 tkDNN can now deserialize tensorrt-8 engine (both through test_* and trtexec)
but demo has issues in yolo::computeDetections
2021-09-05 01:06:56 +05:30
perseusdg de83ae5d25 update tensorrt8 branch 2021-08-30 19:04:26 +05:30
perseusdg 2ffe07057e Mnist works at the moment with trt8,others like yolo4tiny and mobilenet generate the engine files but crash after throwing nvifer1::CudaRuntimeError and when demo is being run ,it doesnt deserialize properly and crashes 2021-08-29 03:18:58 +05:30
perseusdg 3d8b1ac494 Yolo3Detection.cpp doesn't build yet,issues with dependecies of preprocessing and postprocessing on IPluginFactory 2021-08-21 22:29:36 +05:30
perseusdg eba78e7e78 Updates to build libkernel.so under TensorRT 8 2021-08-16 13:59:19 +05:30
perseusdg d2ce966c46 fix return type for bool functions 2021-08-04 12:37:58 +05:30
Harshvardhan Chandirasekar bb902f5b65 fix for downloading weights(utils.cpp) when using docker 2021-07-25 23:53:30 +05:30
perseusdg 1412aa66c4 minor fixes for windows ,for release v0.6 2021-07-24 08:51:44 -07:00
Harshvardhan Chandirasekar e58ddadb7d Merge branch 'ceccocats:master' into master 2021-07-24 08:18:17 -07:00
Micaela Verucchi a992c9feb5 Update README.md 2021-07-23 16:50:15 +02:00
Micaela Verucchi 09080709a9 Remove Issues.md
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-07-23 15:23:47 +02:00
Micaela Verucchi 7521d10ba7 Update README with gifs
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-07-23 15:07:52 +02:00
Micaela Verucchi ab349083bf Merge with cnet works, all tests passed.
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-07-23 14:37:04 +02:00
Micaela Verucchi 4f9f27152a Update READMEs
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-07-23 10:31:34 +02:00
Davide Sapienza 0292e21c33 Merge remote-tracking branch 'origin/master' into cnet 2021-07-22 17:03:23 +02:00
Davide Sapienza 2bb70859da Add FPS results for CenterTrack 2D/3D
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2021-07-22 16:54:25 +02:00
Davide Sapienza b9f82510d3 Add demo_utils.
This commit splits the utils file into two different files:
utils and demo_utils, to overcome some opencv problems caused
by demo_utils includes.

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2021-07-22 10:45:18 +02:00
Davide Sapienza 1216e8bb74 Add camera calibration file reading for demo3d and demoTracker.
Some minor fixes.

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2021-07-21 16:14:53 +02:00
Davide Sapienza be2d361ac6 Update 3d detection
This commit updates the CenternetDetection3d class and fixes
some bugs.

It also removes the resnet101 network for CenterNet 3D.
This network doesn't exist.

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2021-07-21 15:51:13 +02:00
Davide Sapienza f78f7bfddc Fix link in readme files
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2021-07-21 15:35:17 +02:00
Micaela Verucchi f4e71a5a28 Add yolo4_berkeley_f1
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-07-21 12:56:00 +02:00
Harshvardhan Chandirasekar 548e87fc0e Merge branch 'ceccocats:master' into master 2021-07-21 12:44:24 +05:30
Micaela Verucchi 89b1bb7bee Add missing files
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-07-20 18:39:25 +02:00
Micaela Verucchi 318dfe4b55 merge with master
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-07-20 18:38:46 +02:00
Harshvardhan Chandirasekar 4ed247df58 Merge branch 'ceccocats:master' into master 2021-07-20 21:24:24 +05:30
Micaela Verucchi 946b1fe5f5 Update READMEs
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-07-20 17:30:32 +02:00
Micaela Verucchi 69256992a3 Add colormap for each segmentation dataset
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-07-20 15:29:26 +02:00
Micaela Verucchi 84ff978ccb Merge with master, all tests passed
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-07-20 12:48:41 +02:00
Micaela Verucchi 4ca69836e9 Update README_seg
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-07-20 11:39:16 +02:00
Micaela Verucchi b3c44a86a8 Fix shelfnet berkeley, update readme, minors
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-07-20 10:57:53 +02:00
Micaela Verucchi b86a93e85d ActivationLeaky IpluginV2 2021-06-28 23:23:15 +02:00
Harshvardhan Chandirasekar 7f9b10ca71 Merge branch 'ceccocats:master' into master 2021-06-18 06:16:13 -07:00
Francesco Gatti c306b36860 Update CMakeLists.txt 2021-06-17 15:31:25 +02:00
Francesco Gatti 9b78f143cb Update CMakeLists.txt 2021-06-16 14:53:46 +02:00
Francesco Gatti d847a4b852 Update CMakeLists.txt 2021-06-15 20:33:41 +02:00
Francesco Gatti 8df7d5fd1b Update CMakeLists.txt 2021-06-15 20:31:58 +02:00
Francesco Gatti 6d7c456f72 cmake version fix 2021-06-15 19:39:34 +02:00
Francesco Gatti b0fdeb4127 install targets 2021-06-15 19:38:13 +02:00
perseusdg 710cb54db3 Centernet fix for windows 2021-06-05 22:12:15 +05:30
Harshvardhan Chandirasekar 23fbcd1850 Merge branch 'ceccocats:master' into master 2021-06-05 21:23:40 +05:30
Francesco Gatti ba8199a030 fix compile error on old tensorrt and remove useless prints 2021-05-16 22:33:45 +02:00
Francesco Gatti 6b8ae1e27c remove wrong cuda arch that cause big performance gap
fix #226
2021-05-16 22:16:21 +02:00
Davide Sapienza 25d02ef3ea Update exporting weights README
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2021-05-11 17:30:24 +02:00
Davide Sapienza fd56e64938 Update the README and split it into several files.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2021-05-11 17:02:43 +02:00
Davide Sapienza 34c1c3d577 Update cnet branch.
This commit splits the demo3D in two demo: one for the 3D object
detection and one for the tracking.

It renames the files related to CenterTrack.

It adds a new parameter to select the tracker mode (2D or 3D).

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2021-05-11 16:17:23 +02:00
Davide Sapienza 0dc96d2a9e Improve CenterTrack.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2021-05-04 17:59:20 +02:00
Fabio Bagni f8327e2dac Merge with cnet 2021-05-04 11:50:08 +02:00
Fabio Bagni 10f39d1055 Fix tracker for batch size > 1 2021-05-04 11:21:05 +02:00
Davide Sapienza d1ae1791d9 Fix a bug in the draw function of CenterTrack.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2021-05-03 18:56:07 +02:00
Davide Sapienza ff6e0e010a Fix a bug with batch > 1
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2021-04-30 22:26:33 +02:00
Davide Sapienza 2367519799 Add the calibration matrix reading for CenterTrack
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2021-04-30 17:10:51 +02:00
Davide Sapienza be6ad27c11 Batch size > 1 for the 3D demo.
This commit lets to use differtent batch size for 3D CenterNet
and CenterTrack.

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2021-04-29 11:13:24 +02:00
Davide Sapienza 28fab9c3e1 Merge remote-tracking branch 'origin/master' into cnet 2021-04-27 14:43:39 +02:00
Harshvardhan Chandirasekar 9e3977d9ea Merge pull request #1 from ceccocats/master
ceccocats/tkdnn pull
2021-04-25 23:58:44 +05:30
Francesco Gatti a638592fc7 Merge pull request #199 from rickymedrano/rickymedrano-patch-1
Minor Readme Changes
2021-04-24 19:00:58 +02:00
Francesco Gatti a473a02a44 Merge branch 'perseusdg-master' 2021-04-24 18:55:44 +02:00
Francesco Gatti 6611a91201 merge perseusdg windows10 support 2021-04-24 18:55:26 +02:00
Harshvardhan Chandirasekar 39323ca8d3 Update README.md 2021-04-14 17:22:26 +05:30
Harshvardhan Chandirasekar f90ee8ab7d Update CMakeLists.txt 2021-04-09 13:20:44 +05:30
perseusdg 1de804f98d Code cleanup and readme fixes 2021-04-09 13:17:41 +05:30
perseusdg 37b2a5bd98 minor modifications 2021-04-08 00:57:58 +05:30
perseusdg cc594f09ef merge from gitlab 2021-04-08 00:28:00 +05:30
hchandirasekar 2e92944f1d Opencv cuda fix 2021-03-31 03:44:51 -07:00
Harshvardhan Chandirasekar 5f3ab1472c Update download_validation.py 2021-03-26 15:09:28 +01:00
hchandirasekar 7018d163ed python download file 2021-03-26 19:37:44 +05:30
hchandirasekar f12ec3c935 added yolo4x and yolo4-csp from the github repo and download file corrections 2021-03-26 12:18:46 +05:30
hchandirasekar f3d1591430 ReadMe.md windows changes 2021-03-25 20:46:12 +05:30
hchandirasekar 44b71ae6f3 ReadMe.md windows changes 2021-03-25 20:44:43 +05:30
hchandirasekar 78859fe191 timer fix 2021-03-25 16:38:53 +05:30
hchandirasekar e94e1f7622 tkdnn first patch for windows 2021-03-24 22:26:46 +05:30
Harshvardhan Chandirasekar 06787a931f minor migrations 2021-03-17 23:06:50 +05:30
Harshvardhan Chandirasekar 304ab49897 shared_ptr migrations 2021-03-17 22:26:26 +05:30
hchandirasekar 6aa8666be5 Commits for msvc 16.9 2021-03-10 12:59:04 +05:30
Micaela Verucchi 4b3731928c Add yolo4_320_coco2 (pedestrian and stop sign)
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-02-25 09:57:10 +01:00
Ricky Medrano f055341af6 Minor Readme Changes
Added Logistic as a viable activation you can use.
Added conf-thresh as the 7th parameter in the ./demo call.
2021-02-09 07:57:57 -08:00
hchandirasekar 4a90314333 minor fixes in test.h 2021-01-26 23:11:58 +05:30
hchandirasekar 2d4dececb6 Builds on windows successfully,issues with deserialization and downloading weights 2021-01-26 20:17:43 +04:00
hchandirasekar fb52444cdc Replaced dynamic arrays with std::vector ,works on linux ..needs to be tested on windows after clearing up the lnk2019 error 2021-01-25 04:12:05 +05:30
Micaela Verucchi adac8576b0 Add support to Scaled-YOLO4, update Yolov4x-mish (tested)
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2021-01-22 17:57:42 +01:00
perseusdg 512acd8cba minor fixes 2021-01-21 09:29:27 +04:00
perseusdg 56feb54377 able to build kernels as shared object file(dll),and minor changes to lstm.cpp and utils.cpp to overcome minor msvc build errors 2021-01-21 00:22:15 +04:00
Davide Sapienza 59b0f434a7 Fix a bug in the 3D bounding boxes.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-12-14 15:32:35 +01:00
Davide Sapienza 1cfa199ee6 Add pre-processing and post-processing stats
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-12-09 19:43:51 +01:00
Davide Sapienza 9e1d7b3bb4 Update demo3d with show flag
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-12-09 18:05:54 +01:00
Davide Sapienza dbc052865c Fix a wrong path in CenternetDetection3DTrack.cpp
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-12-09 18:04:42 +01:00
Davide Sapienza 4543df8533 Update readme.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-12-07 18:56:07 +01:00
Davide Sapienza 48ecebe6dd Add CenterTrack pre, post, visualization and demo.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-12-07 18:45:29 +01:00
Davide Sapienza 9f10c3f6e2 Add CenterTrack based on dla34.
The implemented network refers to the nuScenes_3Dtracking.pth model.

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-12-07 17:59:27 +01:00
Davide Sapienza 7f65ee0b2a Merge remote-tracking branch 'origin/master' into cnet
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-12-07 17:45:44 +01:00
Micaela Verucchi 8fb5772ad9 Update README_seg.md 2020-11-24 13:03:02 +01:00
Micaela Verucchi 43d213ba36 Update README_seg.md 2020-11-24 12:44:36 +01:00
Micaela Verucchi f137bcb694 Update README_seg
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-11-24 12:39:37 +01:00
Micaela Verucchi a52e18b6e6 Add shelfnet_mapillary, README_seg, resize of input
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-11-24 12:37:33 +01:00
Micaela Verucchi a17e7800b9 Add computation of #parameters, #MACC, and max feature map size in the tests
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-11-23 13:07:54 +01:00
Micaela Verucchi b8855b9599 Update README
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-11-23 11:34:06 +01:00
Micaela Verucchi 702791e41a Add support for yolov4x-mish.
Changes:
- add parameters nms_kind, nms_thresh, new_coords to yolo layer and darknet parser
- added diou nms, new method to compute the BBs
- created test for yolov4x-mish called yolo4x

Tested, all tests work.
Problem to solve: little loss in mAP of yolo4x

Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-11-23 11:29:32 +01:00
Micaela Verucchi 86478f9384 Add yolo4_mmr test
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-10-23 11:40:55 +02:00
Micaela Verucchi a0e7f05a50 Update README.md 2020-10-10 13:03:01 +02:00
Micaela Verucchi d3372aad31 Update README with Xavier NX FPS results 15W4Core
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-09-15 14:09:02 +02:00
Micaela Verucchi be818d5e3a Update README with Xavier NX FPS results
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-09-15 10:50:24 +02:00
Micaela Verucchi 04b4a69107 Merge with master
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-09-14 17:30:02 +02:00
micaela fa2b3d26cb Fix typos (#107)
Signed-off-by: micaela <micaelaverucchi@gmail.com>
2020-09-11 09:13:59 +02:00
Micaela Verucchi 38106a9495 Merge branch 'master' of https://github.com/ceccocats/tkDNN 2020-08-06 15:54:09 +02:00
Micaela Verucchi df5443e017 Fix boxes also for Centernet
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-08-06 15:53:57 +02:00
Micaela Verucchi 8bef544bae Update README.md 2020-08-06 11:05:26 +02:00
Micaela Verucchi f778e1aa99 Fixed boxes to float, add conf thresh as param
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-08-05 19:55:10 +02:00
Francesco Gatti a5d2d4792a fix coords convert 2020-07-27 13:52:39 +02:00
Francesco Gatti 3a0802d70c Resolve detection objects pick by prob threshold.
Before this it will only pick the last object with prob > thresh wich is absolutely wrong
Now it picks all the objects with prob > thesh.

fixes #94
2020-07-27 13:45:42 +02:00
Micaela Verucchi 286e777300 Improved segmentation results, removed resize, code to reorder
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-07-22 19:21:46 +02:00
Micaela Verucchi f4970d1e6f Update README.md 2020-07-17 14:37:10 +02:00
Micaela Verucchi 6a68f19b2c Fix patch from @ahmedius2 , tkDNN now supports CUDNN 8.0.1 (Fix #74)
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
	       Francesco Gatti <gattifrancesco@hotmail.it>
2020-07-16 19:06:54 +02:00
tk c4aad7fe95 Patch for CUDNN 8.0.1
Signed-off-by: tk <micaelaverucchi@gmail.com>
2020-07-16 18:16:09 +02:00
Francesco Gatti b2df9fc110 Update README.md 2020-07-13 19:51:09 +02:00
Francesco Gatti b12cf0d7c2 docker 2020-07-13 19:50:00 +02:00
Micaela Verucchi 594947f301 Update file names map demo
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-07-08 11:27:09 +02:00
Micaela Verucchi e7779ad773 Add conf_thresh parameter to detectors, add batches handling in map demo
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-07-08 09:52:36 +02:00
tk 65e2074dda Merge branch 'eval' of https://github.com/ceccocats/tkDNN into eval 2020-07-06 17:58:08 +02:00
tk a68f45cb4e Merge with master, add yolov4tiny_512
Signed-off-by: tk <micaelaverucchi@gmail.com>
2020-07-06 17:57:50 +02:00
Micaela Verucchi b4c8c2bbad Add stats
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-07-03 18:45:20 +02:00
Micaela Verucchi 79cd96de6f Add resize to original size, writing of segmentation
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-07-02 12:14:20 +02:00
Micaela Verucchi 7c2155decf Add weights download link for csresnext50-panet-spp_berkeley ( fix #63 )
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-07-01 11:56:46 +02:00
Micaela Verucchi a5cc4e3eda Add berkeley test, add weights for shelfnets
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-07-01 10:53:24 +02:00
Micaela Verucchi a4dca23111 Minor
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-07-01 10:22:31 +02:00
Francesco Gatti 04602f3952 Yolo4-tiny batched
fix #59
2020-06-30 19:37:16 +02:00
Micaela Verucchi fe2e4eae92 yolo4tiny works on tensorRT 🐬 🐬 🐬 🐬
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-30 15:52:58 +02:00
Micaela Verucchi 61aa24c6b7 yolov4tiny works on CUDNN
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-30 15:19:03 +02:00
Micaela Verucchi 3bf9547502 Improve preprocessing
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-29 15:11:52 +02:00
Francesco Gatti 6d9beb1ec5 Merge pull request #53 from omaralvarez/master
Fix error when parsing label files with unexpected chars
2020-06-25 10:07:41 +02:00
Micaela Verucchi d25803d438 Post-processing improved
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-24 18:46:25 +02:00
Micaela Verucchi 082920f3f5 Shelfnet works, also visualization. Postprocessing need to be parallelized
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-23 20:01:47 +02:00
Micaela Verucchi 94e558003d Shelfnet works on tensorRT (shortcut need to be fixed)
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-23 12:50:24 +02:00
Micaela Verucchi 6fd261f628 Shelfnet works on cuDNN. To test everything else
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-22 18:11:19 +02:00
Omar Alvarez 2817ade782 Fix parsing label files with unexpected chars 2020-06-22 13:40:15 +02:00
Micaela Verucchi 9f1e30eaa9 Add shelfnet. Resnet18backbone works
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-19 18:55:42 +02:00
Francesco Gatti 1dfc69ba89 viz yolo3 preprocess 2020-06-16 13:19:30 +02:00
Francesco Gatti 07193fc343 dealloc in test.h
fix #36
2020-06-16 12:44:12 +02:00
Francesco Gatti 1b8f45703f darknet parser cpp 2020-06-16 12:41:48 +02:00
Francesco Gatti 3d3a2427c9 viz yolo3 2020-06-16 12:36:45 +02:00
Micaela Verucchi 285c77d6dd Imptove relative paths
Signed-off-by:  Micaela Verucchi <micaelaverucchi@gmail.com>
		Francesco Gatti <gattifrancesco@hotmail.it>
2020-06-15 17:15:37 +02:00
Francesco Gatti 6dff675db7 fix wrong commit 2020-06-14 13:03:48 +02:00
Francesco Gatti cbfc8ea4f2 serialize fix 2020-06-14 13:01:45 +02:00
Francesco Gatti 567dc0f75d cmake cudnn fix 2020-06-14 12:57:29 +02:00
Micaela Verucchi ab6d2d1766 Update README
Signed-off-by: Micaela Verucchi <micaela.verucchi@unimore.it>
2020-06-12 11:39:46 +02:00
Micaela Verucchi 8d08f5aade New yolo4_512 download link
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-11 20:54:17 +02:00
Micaela Verucchi e094a3e0fc Add script for inference FPS
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-11 16:09:01 +02:00
Micaela Verucchi c4e955eab5 Add different yolov4 size tests
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-11 12:43:34 +02:00
Micaela Verucchi be9e327aef Fix minor, update readme
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-09 21:01:19 +02:00
Francesco Gatti 211eff8ad0 Merge branch 'master' of https://github.com/ceccocats/tkDNN 2020-06-09 20:53:17 +02:00
Francesco Gatti 20303ac32e cudnn8 compile 2020-06-09 20:53:05 +02:00
Micaela Verucchi 3ea23815a4 Update README.md 2020-06-03 11:01:17 +02:00
Francesco Gatti 62e4a3f779 memory release 2020-06-02 12:43:06 +02:00
Francesco Gatti 0458f361b1 release layer wgs and version update 2020-06-01 21:03:37 +02:00
Francesco Gatti 2f243f26e5 readme update 2020-06-01 19:04:39 +02:00
Francesco Gatti c8ed6d782a all test ok 2020-06-01 16:15:29 +02:00
Francesco Gatti d4e0d07e09 merge 2020-06-01 15:34:59 +02:00
Micaela Verucchi 0548a662f5 Merge branch 'master' of https://github.com/ceccocats/tkDNN into eval 2020-06-01 15:18:29 +02:00
Micaela Verucchi a0e4e9f209 Modify yolov4_berkeley link for download, clean to merge with master
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-01 15:17:53 +02:00
Francesco Gatti 18794d52c2 darknet parser tested 2020-06-01 14:55:08 +02:00
Francesco Gatti d2e2669b6d darknet parse all net to be tested 2020-06-01 12:22:55 +02:00
Micaela Verucchi d8fbee58d8 Add names files
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-01 10:42:06 +02:00
Micaela Verucchi a6eef498fa Check
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-01 10:39:13 +02:00
Micaela Verucchi 826fcc97c8 Read classes' names from file
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-06-01 10:34:48 +02:00
Francesco Gatti 6d81473b2a yolo3 parsed ok 2020-05-30 22:11:00 +02:00
Francesco Gatti 0621ed223b Merge branch 'darknetparser' of https://github.com/ceccocats/tkDNN into darknetparser 2020-05-30 19:38:31 +02:00
Francesco Gatti 0ae96a6bc4 darknet parser to be tested on yolo3 2020-05-30 19:38:26 +02:00
Micaela Verucchi d45947eec5 Add group field
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-30 19:03:29 +02:00
Micaela Verucchi e5e6654b1d Add fields to darknetParseFields
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-30 18:44:17 +02:00
Francesco Gatti 298487d5c5 parse yolo layers 2020-05-30 18:44:02 +02:00
Micaela Verucchi 6b6dbabba3 Modify darknetFields_t
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-30 18:10:14 +02:00
Francesco Gatti e1d5f58c3f layer parser 2020-05-30 18:02:20 +02:00
Micaela Verucchi 041a5cf65d Add some fields
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-30 18:00:22 +02:00
Francesco Gatti 8935d85e91 parse layer and network 2020-05-30 17:59:00 +02:00
Micaela Verucchi 64d22c51f1 Add darknetParseFields
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-30 17:57:48 +02:00
Micaela Verucchi eec8de3efa merge
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-30 17:33:18 +02:00
Francesco Gatti 548a3dd33c parse line by line 2020-05-30 17:27:22 +02:00
Micaela Verucchi 15105e90d3 Add parseType
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-30 17:25:48 +02:00
Francesco Gatti 4e1c7a70b1 darknet parser interface 2020-05-30 16:58:40 +02:00
Micaela Verucchi d936e5f740 Add mish_yashas
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-30 16:57:53 +02:00
Davide Sapienza 3d2405323b Add the downloading CenterNet weights and outputs for 3D
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-05-29 15:54:22 +02:00
Davide Sapienza 7a677d5c10 Add CenterNet based on Resnet101 for 3D, CUDNN and TensorRT work
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-05-29 14:54:36 +02:00
Francesco Gatti 90dd1d95f3 Update LICENSE 2020-05-28 14:44:07 +02:00
Davide Sapienza f07f333ae5 Update README
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-05-27 18:06:26 +02:00
Davide Sapienza 6bdf47bae6 Add 3D demo program
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-05-27 18:05:38 +02:00
Davide Sapienza ba8c282384 Add 3D CenterNet detection class
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-05-27 18:03:09 +02:00
Davide Sapienza 64098ad244 Add CenterNet based on DLA34 for 3D, CUDNN and TensorRT work
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-05-22 12:51:25 +02:00
Micaela Verucchi 854e1d909a Fix original size
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-19 16:33:45 +02:00
Micaela Verucchi 377310af50 Add variable batch for detector update
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-19 09:32:27 +02:00
Micaela Verucchi 0a9e01db15 Add yolo4_berkeley test
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-15 09:48:59 +02:00
Micaela Verucchi 23b40de508 Add verbose define
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-15 09:41:27 +02:00
Micaela Verucchi 5d01a3f629 Fix Centernet postprocessing
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-14 17:13:38 +02:00
Micaela Verucchi 40456592fc Adapt detection classes to use batches, adapt demos, update README
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-14 16:41:51 +02:00
Micaela Verucchi 2e3cb52cff Add flag to disable visualization and save video
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-11 15:08:10 +02:00
Micaela Verucchi f684a2126e Merge branch 'master' of https://github.com/ceccocats/tkDNN into eval 2020-05-11 11:58:51 +02:00
Micaela Verucchi 533bb48789 Add json detection creation for codalab check
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-05-11 11:57:58 +02:00
Francesco Gatti ca7631250c filter yaw ok 2020-05-03 19:12:10 +02:00
Francesco Gatti 7f0d9a930d Merge branch 'tree' into ipmslam 2020-05-03 15:58:43 +02:00
Francesco Gatti 85bbbf42a1 merge 2020-05-03 15:58:00 +02:00
Francesco Gatti df76766890 Imu odom weights 2020-05-03 15:56:30 +02:00
Francesco Gatti 2594e491d4 Merge branch 'master' of https://github.com/ceccocats/tkDNN 2020-05-03 15:54:42 +02:00
Francesco Gatti 5a9ed44b6a SEP model 2020-05-03 15:54:39 +02:00
Francesco Gatti 9b3752d77a Merge branch 'master' of https://github.com/ceccocats/tkDNN 2020-05-03 15:53:51 +02:00
Francesco Gatti 5ab2e63de4 imu odom SEP model 2020-05-03 15:53:35 +02:00
Francesco Gatti 98537624cf merge tree 2020-05-01 15:39:00 +02:00
Micaela Verucchi 4fd84b1876 Update README.md 2020-04-29 18:34:06 +02:00
Francesco Gatti d8f034a7ad Update README.md 2020-04-29 18:17:32 +02:00
Francesco Gatti d6c28c5ba2 Update README.md 2020-04-29 18:09:50 +02:00
Francesco Gatti 3e2d0630b7 Update README.md 2020-04-29 13:07:26 +02:00
Francesco Gatti 986ec5d00c Update LICENSE 2020-04-28 22:59:45 +02:00
Micaela Verucchi adb5a693cd Modify download
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-28 20:40:35 +02:00
Micaela Verucchi db0f8a4d99 Support yolov4
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-28 20:35:30 +02:00
Francesco Gatti e6d435a463 Merge commit '04bd5d7ff46270c732b76cd9656e22de930e138e' into tree 2020-04-28 14:54:18 +02:00
Micaela Verucchi a874fad2bd Merge branch 'master' of https://github.com/ceccocats/tkDNN into cnet 2020-04-28 14:43:24 +02:00
Francesco Gatti 04bd5d7ff4 stream 2020-04-28 14:36:02 +02:00
Micaela Verucchi 89f91f568e Fix shortcutRT plugin, now works with batches, fix yolo3_512 downlaod link
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-28 14:34:12 +02:00
Francesco Gatti c975a467b1 sensor close if not started fix 2020-04-28 12:59:30 +02:00
dsapienza 6e5ab031c4 Deformable batch works
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-04-25 02:47:31 +02:00
Micaela Verucchi f418a1f9b2 Add bdd new tests, add BDD100K_val download, fix yolo3-512 link
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-24 12:39:57 +02:00
Francesco Gatti 3ba276a236 merge tkDNN 2020-04-24 11:18:22 +02:00
Francesco Gatti 13c9dc6620 RegionRT softmax fix 2020-04-24 00:08:06 +02:00
Francesco Gatti 1ea6097a97 Reshape batch fix 2020-04-23 23:51:23 +02:00
Francesco Gatti 8cff886ee5 Flatten batch to be checked 2020-04-23 01:18:27 +02:00
Francesco Gatti 488887992c test batch 2020-04-23 00:54:03 +02:00
Francesco Gatti 8caff5f598 RouteRt is not used 2020-04-21 19:50:45 +00:00
Francesco Gatti 3d940a9fa2 batch seems ok in yolo3_berkely
layers to be checked:
DeformableConvRT
FlattenConcatRT
ReshapeRT
RouteRT (dont know why but seems working)
2020-04-21 19:41:40 +00:00
Francesco Gatti 7c81c5a43c batch size > 1 2020-04-21 19:20:44 +02:00
Francesco Gatti b1818b81d9 Merge pull request #2 from ceccocats/cnet
Move download of weights inside build folder
2020-04-18 12:43:23 +02:00
Micaela Verucchi 2fbac7705d Move download of weights inside build folder
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-17 22:36:25 +02:00
Francesco Gatti cbea75a8f6 merge master 2020-04-15 14:21:33 +02:00
Francesco Gatti 4a308467e6 warning fix 2020-04-14 14:26:06 +02:00
Francesco Gatti 29b99f4e61 pull from repos 2020-04-14 12:32:50 +02:00
Francesco Gatti e3e5a133f5 pull from repos 2020-04-12 21:47:25 +02:00
Francesco Gatti f637aa0ea8 Create LICENSE 2020-04-09 22:13:50 +02:00
Francesco Gatti c654610569 readme update 2020-04-09 20:15:37 +02:00
Francesco Gatti 85588f7343 warning fix 2020-04-09 20:05:10 +02:00
Francesco Gatti f9e3f17c0a cmake dont download test data 2020-04-09 20:00:29 +02:00
Francesco Gatti cb5b7a1d98 ignore calib table 2020-04-09 19:56:08 +02:00
Davide Sapienza 106cbb5c73 Remove the optional parameters from the Pooling layer.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-04-09 19:20:27 +02:00
Micaela Verucchi fabad7bace Add mnist download, change ERROR_TKDNN into ERROR_TENSORRT
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-09 19:02:25 +02:00
Davide Sapienza 4361d5fec0 Remove the final parameter from the layers
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-04-09 18:48:03 +02:00
Micaela Verucchi 3502c5b676 Fix pooling, add return code in each test, add return code handling in test_all_tests script
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-09 15:25:05 +02:00
Francesco Gatti ed0596a52c warning fix 2020-04-09 01:00:14 +02:00
Francesco Gatti 2635d24855 Merge branch 'master' into cnet 2020-04-09 00:57:43 +02:00
Francesco Gatti 1bb9f73a0b remove deprecated and unused warning 2020-04-09 00:55:07 +02:00
Francesco Gatti c1247930c9 gnuplot imuodom 2020-04-08 16:53:35 +02:00
Micaela Verucchi bddb0110ca Add imuodom download and test in script
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-08 16:50:40 +02:00
Micaela Verucchi 6d1fda0c21 Compile on tx2
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-08 16:23:08 +02:00
Micaela Verucchi 35e86ca5cb Improve test_all_tests scripts to run in every mode (FP32, FP16, INT8)
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
               Davide Sapienza <sapienza.dav@gmail.com>
2020-04-08 15:29:49 +02:00
Micaela Verucchi 0debd01ba7 Minor, uncomment test_all_tests
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-08 15:05:52 +02:00
Micaela Verucchi 0951f4644f Merge with master works
Signed-off-by:  Micaela Verucchi <micaelaverucchi@gmail.com>
		Davide Sapienza <sapienza.dav@gmail.com>
2020-04-08 14:59:42 +02:00
Micaela Verucchi 6ec417d89f Add scripts folder
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-08 14:24:34 +02:00
Micaela Verucchi ba04328d48 Ok test script, output removed
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-08 14:06:30 +02:00
Micaela Verucchi ef78d7f176 Add BoundingBox class
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-08 13:52:29 +02:00
Micaela Verucchi f089d59d10 Add script to check if every test works fine
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-08 13:49:06 +02:00
Micaela Verucchi da79128271 Update download url
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-08 12:34:02 +02:00
Micaela Verucchi 5f6011b206 Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2020-04-08 11:20:56 +02:00
Micaela Verucchi ae1d8cd9e6 Refactoring & documentation
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-08 11:20:48 +02:00
Davide Sapienza 0e5c90634f Fix the Deformable convolution code sintax.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-04-08 11:14:34 +02:00
Davide Sapienza 5562f599a6 Fix the INT8 calibrator sintax
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-04-08 10:22:03 +02:00
Micaela Verucchi 326c7e0940 Move extraction of name into function in utils
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-08 10:09:15 +02:00
Micaela Verucchi c36befaf2b Minor fix on output file name in map demo
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-08 09:35:54 +02:00
Davide Sapienza cf3fbeddbd Fix the sorting kernels used in the CenterNet pre and post-processing.
This commit moves the kernels in the correct sub-directory.
It creates new header file for Thrust kernels. It splits the
kernels into two files: 'normalize.cu' contains CenterNet
pre-processing operations, 'postprocessing.cu' contains the
CenterNet post-processing operations.

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-04-07 18:28:12 +02:00
Davide Sapienza ae876e22ee Update README.md for INT8 inference
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-04-06 20:27:59 +02:00
Davide Sapienza 26dcb7b8c9 Fix the tensorRT code to support versions prior to 6.0
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-04-06 19:54:40 +02:00
Micaela Verucchi 455291b6dd Fix compile errors dut to Int8BatchStream
Signed-off-by: Micaela Verucchi <micaela.verucchi@unimore.it>
               Davide Sapienza <sapienza.dav@gmail.com>
2020-04-06 19:11:39 +02:00
Micaela Verucchi 8575059666 Add again evalutation.h
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-06 18:35:52 +02:00
Micaela Verucchi 9ec0913d7f Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2020-04-06 18:13:02 +02:00
Micaela Verucchi c8308963df Add evaluation to tk::dnn namespace, style fix also
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-06 18:12:38 +02:00
Davide Sapienza e3442e4764 Move the calibration table saving to the tests/network folder.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-04-06 18:06:21 +02:00
Micaela Verucchi c0a978a480 Add opencv install script (for real)
Signed-off-by: Micaela Verucchi <micaela.verucchi@unimore.it>
2020-04-06 17:27:25 +02:00
Micaela Verucchi 674c61d280 Add opencv script, modified macro, add opencv section into readme
Signed-off-by: Micaela Verucchi <micaela.verucchi@unimore.it>
2020-04-06 17:25:53 +02:00
Micaela Verucchi dfdeb8b36e Modify weights download for some nets, now also calibration tables are downloaded in tests folder
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-06 16:22:23 +02:00
Davide Sapienza e4900120db Fix getNetworkRTName (works also on Xavier)
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-04-02 10:15:30 +02:00
Micaela Verucchi 79a05a8159 Modify weights download link for mobilenetv2ssd512 and yolo3_tiny512
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-02 09:41:24 +02:00
Micaela Verucchi af13e7c954 Add getMemoryUsage function, detection update moved in abstract lass, splitted execution time in pre-inf-post, other minors.
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-04-01 19:18:43 +02:00
Davide Sapienza c06c9fcf23 Update README.md
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-03-30 19:02:55 +02:00
Davide Sapienza bb157be82c Add TKDNN_CALIB_IMG_PATH and TKDNN_CALIB_LABRL_PATH variable
This commit adds two variables for the calibration dataset.
The first is reffered to .txt file that contains the list
of the absolute paths of the images for the INT8 calitration.
The second is referred to .txt file that contains the list
of the absolute paths of the labels of the same images above.

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-03-30 18:55:32 +02:00
Davide Sapienza ce20868bad Add TKDNN_MODE variable to the name of the network.
This commit permits to obtain different .rt files for different
precision optimizations of the same network.

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-03-30 15:08:25 +02:00
Micaela Verucchi 573924cf2c Update README.md 2020-03-29 20:15:15 +02:00
Micaela Verucchi f2a4125d9f Update README.md 2020-03-29 20:07:27 +02:00
Micaela Verucchi d7276c720d Update README.md 2020-03-29 20:03:59 +02:00
Davide Sapienza 482e122655 Fix opencv cuda include error
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-03-27 10:43:49 +01:00
Davide Sapienza 08e1801c60 Add the Int8 calibrator and the tensorRT Int8 inference
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-03-27 00:48:14 +01:00
Micaela Verucchi 7c55dcb708 Add tp tests for yolo3512 and yolo3tiny512
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-03-26 15:06:49 +01:00
Micaela Verucchi 3eda9b9219 Add GPU version for yolo3detection
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-03-23 21:29:29 +01:00
Micaela Verucchi df37e11709 Modify map demo, using abstract class. Move draw function in abstract class
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-03-23 19:32:37 +01:00
Micaela Verucchi bbcc33c0cf Refactoring for detection NN
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-03-20 21:14:12 +01:00
Micaela Verucchi c7d9c38ea0 Add OPENCV_CUDA define, to allow having preprocess both in CPU and GPU (Mobilenet and Centernet)
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-03-20 10:21:11 +01:00
Micaela Verucchi 58fe723b6a Style fix, useless params removed
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-03-19 18:13:35 +01:00
Micaela Verucchi f44f377771 Add preprocess function, allow preprocess on GPU for mobilenetdetection
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-03-19 17:53:29 +01:00
Micaela Verucchi 41b1135fb3 Add support for mobilenet in map_demo
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-03-17 15:08:43 +01:00
Micaela Verucchi 43fd92f701 Fix conv2d with additional bias for tensorRT. Fix reshape deserialize. Mb2512 works with tensorRT
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-03-17 13:18:05 +01:00
Micaela Verucchi 1d388ca51a Add mobilenetv2ssdlite512 test.
Works for CuDNN, not for tensorRT.
Modified channels in second convolution for classification headers from 126 to 486, when changing size from 300 to 512.
Added size 512 SSD specs and support to COCO dataset (81 classes, first BACKGROUND due to repo for training).
Refactoring class names.

Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-03-17 10:35:02 +01:00
Micaela Verucchi 9c25d15ff2 Add yolov3_512 (size 512) test 2020-03-16 11:29:15 +01:00
Francesco Gatti 62c8f528a4 eigen assert fix 2020-03-14 19:50:55 +01:00
Micaela Verucchi 82d907971c Fix download weights yolov3 versions
Signed-off-by: Micaela Verucchi <micaela.verucchi@unimore.it>
2020-03-14 18:20:32 +01:00
Francesco Gatti 555b32b5dc Refactoring
Signed-off-by: Francesco Gatti <gattifrancesco@hotmail.it>
2020-03-14 17:22:58 +01:00
Francesco Gatti cf7fbadcd2 Add function to download weigths if do no exist, for each test. Add some controls in map demo.
Signed-off-by: Francesco Gatti <gattifrancesco@hotmail.it>
2020-03-14 17:02:07 +01:00
xavier 5e0c1879bc Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2020-03-13 12:17:21 +01:00
xavier 32dd807ab0 Add Yolov3_tiny512 test cpp
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-03-13 12:16:18 +01:00
Micaela Verucchi 8aa792925d Update README.md 2020-03-12 20:42:44 +01:00
xavier 9d17cb42f4 Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2020-03-12 20:18:11 +01:00
xavier db10ebeb34 Fix print on times.csv
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-03-12 20:18:02 +01:00
Francesco Gatti 62e7882744 Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2020-03-12 18:43:33 +01:00
Francesco Gatti 13b4dffd71 csresnext50-panet-spp works with TensorRT
Signed-off-by: Francesco Gatti <gattifrancesco@hotmail.it>
2020-03-12 18:24:41 +01:00
Francesco Gatti f6527f51e3 Add csresnext50-panet-spp test. Works on CUDNN. Does not work with TensorRT
Signed-off-by: Francesco Gatti <gattifrancesco@hotmail.it>
2020-03-11 18:37:26 +01:00
Micaela Verucchi 66e3b98b04 Update README.md 2020-03-11 12:04:28 +01:00
Micaela Verucchi 0cc2666e26 Update README.md 2020-03-11 11:51:28 +01:00
xavier d0d462c015 Merge
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-03-10 15:43:26 +01:00
xavier 2d46f16b70 Add tiny yolo 512 test
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-03-10 15:40:11 +01:00
Micaela Verucchi e6aa73d7bc Update README.md 2020-03-10 15:26:57 +01:00
Micaela Verucchi 4b85a2238a Add writing results on file for map demo
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-03-10 14:35:25 +01:00
Francesco Gatti 8944778dcf imuodom fix 2020-03-09 22:05:34 +01:00
Francesco Gatti 406f8cc9b3 - ImuOdom model into class
- Route layer input array hard copy
- fix utils
2020-03-09 19:44:21 +01:00
Micaela Verucchi 7ea31d123a Update README
Signed-off-by: Micaela Verucchi <micaela.verucchi@unimore.it>
2020-03-08 18:12:08 +01:00
Davide Sapienza 7dbbbe4d9a Update README
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-03-03 17:34:01 +01:00
Davide Sapienza 01a42ffe27 Move multiple demo files into one
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-03-03 17:30:35 +01:00
Davide Sapienza 296a6cbc87 Add draw method to Yolo3Detection class.
Update yolo demo

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-03-03 17:08:25 +01:00
Micaela Verucchi fe206ea24c Fix dependencies problems
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2020-02-27 16:48:10 +01:00
xavier 3eb079dd13 Add Mobilenetv2 SSD Lite post and preprocessing, add mobilenet demo
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-02-26 17:42:20 +01:00
xavier 110bf56dc4 Fix include error
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-02-21 11:14:52 +01:00
xavier 209a3e8492 Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2020-02-21 10:49:35 +01:00
xavier 38a1b9dcb2 Add Mobilenet2SSDLite test
The new test works both with TensorRT and cuDNN. Preprocessing and
Postprocessing are missing. Add ClippedReLU (for ReLU6), groups for
Conv2d, additional bias for convolution.

Other minors:
-move the timer in the detector to measure all the
processing time for a given frame (both centernet and yolo);
-add int8 flag.

Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
Davide Sapienza <sapienza.dav@gmail.com>
2020-02-21 10:45:46 +01:00
Davide Sapienza 2c1df5619f Move pre-processing on GPU
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-02-14 18:44:13 +01:00
Davide Sapienza 97b88ef52d Fix a bug in the deformable kernel.
There was a wrong variable initialization.

Fixes: 51ffcb1f50 ("Optimize deformable kernel")

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-02-11 16:28:17 +01:00
Micaela Verucchi 4c2d2a7965 Update README.md 2020-02-11 15:12:27 +01:00
xavier 636d899f9f Merge README
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-02-11 14:58:25 +01:00
xavier 7e21b10aee Add script to download COCO val2017
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-02-11 14:56:54 +01:00
Micaela Verucchi 6e2ff405f4 Update README.md 2020-02-11 11:28:20 +01:00
xavier 1936e54870 Change README.md, add config.yaml, refactoring
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-02-11 11:25:42 +01:00
xavier b5c0baa99d Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2020-02-11 10:32:52 +01:00
xavier 801b8b5641 Read parameters for mAP from yaml, add yampl-cpp dependency
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-02-11 10:32:42 +01:00
Davide Sapienza 51ffcb1f50 Optimize deformable kernel
Signed-off.by: Ignacio Sañudo Olmedo<ignacio.sanudoolmedo@unimore.it>
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-02-11 10:06:08 +01:00
xavier 10831ab450 Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2020-02-10 18:19:12 +01:00
xavier d601e980f6 Add avg precision, recall, f1score computation, other minors
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-02-10 18:19:08 +01:00
Davide Sapienza b06dc286e9 Update README.md
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-02-10 11:19:39 +01:00
Davide Sapienza c02238ddc8 Add Anaconda environment for ResNet101 and DLA34 weights exporter
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-02-10 10:58:04 +01:00
Davide Sapienza e72aa348a0 Add DLA34 weights exporter
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-02-10 10:56:33 +01:00
Davide Sapienza 62fe82ce9e Update ResNet101 weights exporter
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-02-10 10:54:04 +01:00
Davide Sapienza 9007e25a00 Remove mallocs and frees from the kernels
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-02-07 14:50:05 +01:00
xavier 289a97d06c Refactoring map_demo, add evaluation.h and evaluation.cpp
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-02-07 12:47:02 +01:00
xavier f32d8a859b Add mAP 0.5:0.95, other small fix
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-02-07 09:09:40 +01:00
xavier 5c501f529b Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2020-02-07 09:06:29 +01:00
Davide Sapienza 2503eba173 Fix memory leak
This commit moves cublasCreate out from dcn_v2_cuda_forward
to save some milliseconds and it adds cublasDestroy (cause
of memory leak).

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-02-06 23:09:12 +01:00
xavier c21a0687ce Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2020-02-06 18:24:49 +01:00
Davide Sapienza 70eb5214cc Change CenterNet input dimension.
This commit changes the image input dimension, it updates the
CenterNet detection class.

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-02-06 18:08:06 +01:00
xavier 37019597af Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2020-02-05 18:39:32 +01:00
xavier d8eeb36d4b Add mAP computation and demo
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-02-05 18:39:13 +01:00
Davide Sapienza c695d8c5d7 Implement CenterNet based on DLA34, CUDNN and TensorRT work.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-02-05 14:59:56 +01:00
Davide Sapienza 4616be0738 Add grouped convolutions in CUDNN and tensorRT.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-02-05 14:32:58 +01:00
Davide Sapienza fe85c26888 Implement DLA34, CUDNN and TensorRT work.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-01-24 19:30:32 +01:00
Davide Sapienza 7f239efdc0 Centernet: fix pooling problem, add centrnet demo
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-01-21 12:50:18 +01:00
Davide Sapienza c68d6f318e Merge branch 'master' of https://github.com/ceccocats/tkDNN into cnet 2020-01-20 16:41:19 +01:00
Davide Sapienza b23cf9fe70 Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet
Signed-off-by: Michaela Verucchi <micaelaverucchi@gmail.com>
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-01-20 12:35:27 +01:00
Davide Sapienza 7838cb4922 Pre-process, Process and Post-process work
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2020-01-20 12:27:49 +01:00
xavier 0f0c8c28e1 Merge with master, works with Jetpack 4.3
Signed-off-by: xavier <micaelaverucchi@gmail.com>
2020-01-15 19:24:19 +01:00
fbagni 23a1365dc4 Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2019-12-23 16:14:24 +01:00
fbagni 7e7f480e2b Yolov3_tiny works on tensorRT
Signed-off-by: fbagni <gattinomicino>
2019-12-23 16:11:41 +01:00
Davide Sapienza 5272f1cde6 CenterNet TensorRT serialization works
This commit adds the Deformable layer serialization.

Signed-oof-by: Davide Sapienza <sapienza.dav@gmail.com>
2019-12-23 15:31:13 +01:00
nvidia f0ea2c027f Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2019-12-20 15:27:55 +01:00
nvidia 854a4c316a Add ResizeLayerRT plugin
Signed-off-by: nvidia <micaelaverucchi@gmail.com>
2019-12-20 15:27:41 +01:00
Davide Sapienza d889ed385d CenterNet TensorRT works. TensorRT serialization not yet implemented
Signed-oof-by: Davide Sapienza <sapienza.dav@gmail.com>
2019-12-20 11:05:03 +01:00
Davide Sapienza e99b353d8b Fix the inference operation of the deformable convolutional layer.
This commit removes the malloc operation in the inference
method and adds the sigmoid kernel.

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2019-12-19 14:47:57 +01:00
Davide Sapienza df888a3457 Add CenterNet based on Resnet101, TensorRT not implemented.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
2019-12-18 18:59:54 +01:00
Micaela Verucchi 44b2bce3ff Yolo3_tiny CUDNN works, TensorRT doesn't. Add n_masks to Yolo layer.
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2019-12-05 20:43:48 +00:00
Micaela Verucchi a2db98670a Add Yolov3 (COCO80) and Yolov3-tiny (COCO80), TensorRT for tiny not working
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2019-12-04 17:01:40 +00:00
Francesco Gatti 2594f59d0d conv2d ok, but deconv ha different dim with tensorrt 2019-10-30 16:45:46 +01:00
Francesco Gatti f247300469 test simple 2019-10-30 15:40:48 +01:00
Micaela Verucchi 6a1707f65e Merge branch 'cnet' of https://github.com/ceccocats/tkDNN into cnet 2019-10-30 10:20:44 +01:00
Micaela Verucchi 8b64d1876f deformable conv cu 2019-10-30 10:20:04 +01:00
fbagni d6d93a74f8 fix 2019-10-30 09:42:54 +01:00
fbagni 33f36ab204 Deconv tensorrt 2019-10-30 09:40:29 +01:00
Francesco Gatti f9afee2f3b deconv layer cudnn 2019-10-30 00:05:22 +01:00
Davide Sapienza 02936fa928 ResNet working 2019-10-29 17:21:31 +01:00
Davide Sapienza e9ec582223 Shortcat ok 2019-10-29 15:08:44 +01:00
Micaela Verucchi 058f9b795f resnet weight export fix 2019-10-28 19:20:02 +01:00
Micaela Verucchi 4ac2c87d1c cmake fix 2019-10-28 18:39:28 +01:00
Micaela Verucchi 42a1ea02b9 resnet merge 2019-10-28 18:38:23 +01:00
323 changed files with 40318 additions and 8476 deletions
+12 -7
View File
@@ -1,10 +1,4 @@
*~
demo/demo/data/img_crop/
demo/demo/data/img_disparity/
demo/demo/data/map/
demo/demo/data/masks_orient/
demo/demo/data/pmat_new/
demo/demo/data/masks_v2/
build/
.vscode/
*.bin
@@ -14,6 +8,17 @@ build/
*.h5
*.tar.gz
*.weights
*.zip
.idea/
*.hdf5
*.pk
*.table
cmake-build-release/
demo/COCO_val2017
demo/BDD100K_val
/.vs
cmake-build-minsizerel/*
scripts/COCO_val2017/*
scripts/COCO_val2017.zip
scripts/all_labels.txt
/cmake/cuda_script
/cmake-build-debug/
-6
View File
@@ -1,6 +0,0 @@
[submodule "tracker_CLASS"]
path = tracker_CLASS
url = https://github.com/mive93/tracker_CLASS.git
[submodule "masa_protocol"]
path = masa_protocol
url = https://git.hipert.unimore.it/rcavicchioli/masa_protocol.git
+187 -84
View File
@@ -1,8 +1,69 @@
cmake_minimum_required(VERSION 3.5)
project (tkDNN)
cmake_minimum_required(VERSION 3.15)
project(tkDNN)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC")
set(CMAKE_CXX_STANDARD 14)
option(ENABLE_OPENCV_CUDA_CONTRIB "Enable OpenCV CUDA Contrib" OFF )
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "default build" FORCE)
endif(NOT CMAKE_BUILD_TYPE)
find_package(CUDA 9.0 REQUIRED)
if (CUDA_FOUND)
set(OUTPUTFILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cuda_script) # No suffix required
execute_process(COMMAND "rm ${OUTPUTFILE}")
set(CUDAFILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/getCudaArch.cu)
execute_process(COMMAND ${CUDA_NVCC_EXECUTABLE} -lcuda ${CUDAFILE} -o ${OUTPUTFILE})
execute_process(COMMAND ${OUTPUTFILE}
RESULT_VARIABLE CUDA_RETURN_CODE
OUTPUT_VARIABLE ARCH)
if(${CUDA_RETURN_CODE} EQUAL 0)
set(CUDA_SUCCESS "TRUE")
else()
set(CUDA_SUCCESS "FALSE")
endif()
if (${CUDA_SUCCESS})
message(STATUS "CUDA Architecture: ${ARCH}")
message(STATUS "CUDA Version: ${CUDA_VERSION_STRING}")
message(STATUS "CUDA Path: ${CUDA_TOOLKIT_ROOT_DIR}")
message(STATUS "CUDA Libararies: ${CUDA_LIBRARIES}")
message(STATUS "CUDA Performance Primitives: ${CUDA_npp_LIBRARY}")
set(CUDA_NVCC_FLAGS "${ARCH}")
else()
message(WARNING ${ARCH})
endif()
endif()
SET(CUDA_SEPARABLE_COMPILATION ON)
if(UNIX)
if(CMAKE_BUILD_TYPE MATCHES Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wno-deprecated-declarations -Wno-unused-variable -O3")
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --maxrregcount=32)
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wno-deprecated-declarations -Wno-unused-variable -g3")
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --maxrregcount=32 -G -g)
endif()
endif()
if(WIN32)
if(CMAKE_BUILD_TYPE MATCHES Release)
set(CMAKE_CXX_FLAGS "/O2 /FS /EHsc /MD")
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --maxrregcount=32)
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_CXX_FLAGS "/Od /FS /EHsc /MDd")
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --maxrregcount=32 -G -g)
endif()
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif(WIN32)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/tkDNN)
# project specific flags
@@ -10,54 +71,77 @@ if(DEBUG)
add_definitions(-DDEBUG)
endif()
if(TKDNN_PATH)
message("SET TKDNN_PATH:" ${TKDNN_PATH})
add_definitions(-DTKDNN_PATH="${TKDNN_PATH}")
else()
add_definitions(-DTKDNN_PATH="${CMAKE_CURRENT_SOURCE_DIR}")
endif()
#-------------------------------------------------------------------------------
# CUDA
#-------------------------------------------------------------------------------
find_package(CUDA 9.0 REQUIRED)
SET(CUDA_SEPARABLE_COMPILATION ON)
#set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -arch=sm_30 --compiler-options '-fPIC'")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}" --compiler-options '-fPIC')
find_package(CUDNN REQUIRED)
include_directories(${CUDNN_INCLUDE_DIR})
find_package(yaml-cpp REQUIRED)
# compile
file(GLOB tkdnn_CUSRC "src/kernels/*.cu")
file(GLOB tkdnn_CUSRC "src/kernels/*.cu" "src/sorting.cu" "src/pluginsRT/*.cpp")
cuda_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${CUDA_INCLUDE_DIRS} ${CUDNN_INCLUDE_DIRS})
cuda_add_library(kernels SHARED ${tkdnn_CUSRC})
target_link_libraries(kernels ${CUDA_CUBLAS_LIBRARIES} ${CUDA_LIBRARIES} ${CUDNN_LIBRARIES} yaml-cpp)
#-------------------------------------------------------------------------------
# External Libraries
#-------------------------------------------------------------------------------
find_package(Eigen3 REQUIRED)
message("Eigen DIR: " ${EIGEN3_INCLUDE_DIR})
include_directories(${EIGEN3_INCLUDE_DIR})
find_package(OpenCV REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOPENCV")
if(ENABLE_OPENCV_CUDA_CONTRIB)
if (OpenCV_FOUND)
find_package(OpenCV COMPONENTS cudawarping cudaarithm)
if(OpenCV_cudawarping_FOUND AND OpenCV_cudaarithm_FOUND)
add_compile_definitions(OPENCV_CUDACONTRIB)
message("OpenCV Cuda Contrib modules found")
else()
message("OpenCV Cuda Contrib modules not found")
set(ENABLE_OPENCV_CUDA_CONTRIB OFF)
endif()
endif()
endif()
# if(OpenCV_CUDA_VERSION)
# add_compile_definitions(OPENCV_CUDACONTRIB)
# endif()
include_directories(/usr/include/gdal)
# gives problems in cross-compiling, probably malformed cmake config
#-------------------------------------------------------------------------------
# Build Libraries
#-------------------------------------------------------------------------------
file(GLOB tkdnn_SRC "src/*.cpp")
set(tkdnn_LIBS kernels ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES} ${CUDNN_LIBRARIES} ${OpenCV_LIBS})
file(GLOB class_SRC "src/class_src/*.cpp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -O3")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${CUDA_INCLUDE_DIRS} ${OPENCV_INCLUDE_DIRS} ${NVINFER_INCLUDES} "~/repos/cereal/include" ${CMAKE_CURRENT_SOURCE_DIR}/tracker_CLASS/c++/src /usr/include/python2.7)
set(class_LIBS ${OpenCV_LIBS} -lgdal yaml-cpp python2.7)
set(tkdnn_LIBS kernels ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES} ${CUDNN_LIBRARIES} ${OpenCV_LIBS} yaml-cpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${CUDA_INCLUDE_DIRS} ${OPENCV_INCLUDE_DIRS} ${NVINFER_INCLUDES})
add_library(tkDNN SHARED ${tkdnn_SRC})
target_link_libraries(tkDNN ${tkdnn_LIBS})
add_library(CLASS SHARED ${class_SRC})
target_link_libraries(CLASS ${class_LIBS})
target_link_libraries(tkDNN ${tkdnn_LIBS} ${CUDA_CUBLAS_LIBRARIES})
#static
#add_library(tkDNN_static STATIC ${tkdnn_SRC})
#target_link_libraries(tkDNN_static ${tkdnn_LIBS})
# SMALL NETS
add_executable(test_simple tests/simple/test_simple.cpp)
target_link_libraries(test_simple tkDNN)
@@ -67,62 +151,93 @@ target_link_libraries(test_mnist tkDNN)
add_executable(test_mnistRT tests/mnist/test_mnistRT.cpp)
target_link_libraries(test_mnistRT tkDNN)
## YOLO NETS
add_executable(test_yolo tests/yolo/yolo.cpp)
target_link_libraries(test_yolo tkDNN)
add_executable(test_yolo_voc tests/yolo_voc/yolo_voc.cpp)
target_link_libraries(test_yolo_voc tkDNN)
add_executable(test_yolo_tiny tests/yolo_tiny/yolo_tiny.cpp)
target_link_libraries(test_yolo_tiny tkDNN)
add_executable(test_yolo_relu tests/yolo_relu/yolo_relu.cpp)
target_link_libraries(test_yolo_relu tkDNN)
add_executable(test_yolo_224 tests/yolo_224/yolo_224.cpp)
target_link_libraries(test_yolo_224 tkDNN)
add_executable(test_yolo_berkeley tests/yolo_berkeley/yolo_berkeley.cpp)
target_link_libraries(test_yolo_berkeley tkDNN)
add_executable(test_yolo3_coco4 tests/yolo3_coco4/yolo3_coco4.cpp)
target_link_libraries(test_yolo3_coco4 tkDNN)
add_executable(test_yolo3_berkeley tests/yolo3_berkeley/yolo3_berkeley.cpp)
target_link_libraries(test_yolo3_berkeley tkDNN)
add_executable(test_yolo3_tetrapack tests/yolo3_tetrapack/yolo3_tetrapack.cpp)
target_link_libraries(test_yolo3_tetrapack tkDNN)
add_executable(test_yolo3_tetrapack_resize tests/yolo3_tetrapack_resize/yolo3_tetrapack_resize.cpp)
target_link_libraries(test_yolo3_tetrapack_resize tkDNN)
add_executable(test_yolo3_BCDS6 tests/yolo3_BCDS6/yolo3_BCDS6.cpp)
target_link_libraries(test_yolo3_BCDS6 tkDNN)
add_executable(test_yolo3_flir tests/yolo3_flir/yolo3_flir.cpp)
target_link_libraries(test_yolo3_flir tkDNN)
add_executable(test_imuodom tests/imuodom/imuodom.cpp)
target_link_libraries(test_imuodom tkDNN)
################################################################################
# DARKNET
file(GLOB darknet_SRC "tests/darknet/*.cpp")
foreach(test_SRC ${darknet_SRC})
get_filename_component(test_NAME "${test_SRC}" NAME_WE)
set(test_NAME test_${test_NAME})
add_executable(${test_NAME} ${test_SRC})
target_link_libraries(${test_NAME} tkDNN)
install(TARGETS ${test_NAME} DESTINATION bin)
endforeach()
# MOBILENET
add_executable(test_mobilenetv2ssd tests/mobilenet/mobilenetv2ssd/mobilenetv2ssd.cpp)
target_link_libraries(test_mobilenetv2ssd tkDNN)
add_executable(test_bdd-mobilenetv2ssd tests/mobilenet/bdd-mobilenetv2ssd/bdd-mobilenetv2ssd.cpp)
target_link_libraries(test_bdd-mobilenetv2ssd tkDNN)
add_executable(test_mobilenetv2ssd512 tests/mobilenet/mobilenetv2ssd512/mobilenetv2ssd512.cpp)
target_link_libraries(test_mobilenetv2ssd512 tkDNN)
# BACKBONES
add_executable(test_resnet101 tests/backbones/resnet101/resnet101.cpp)
target_link_libraries(test_resnet101 tkDNN)
add_executable(test_dla34 tests/backbones/dla34/dla34.cpp)
target_link_libraries(test_dla34 tkDNN)
# CENTERNET
add_executable(test_resnet101_cnet tests/centernet/resnet101_cnet/resnet101_cnet.cpp)
target_link_libraries(test_resnet101_cnet tkDNN)
add_executable(test_dla34_cnet tests/centernet/dla34_cnet/dla34_cnet.cpp)
target_link_libraries(test_dla34_cnet tkDNN)
add_executable(test_dla34_cnet3d tests/centernet/dla34_cnet3d/dla34_cnet3d.cpp)
target_link_libraries(test_dla34_cnet3d tkDNN)
# CENTERTRACK
add_executable(test_dla34_ctrack tests/centertrack/dla34_ctrack/dla34_ctrack.cpp)
target_link_libraries(test_dla34_ctrack tkDNN)
# SHELFNET
add_executable(test_shelfnet tests/shelfnet/shelfnet.cpp)
target_link_libraries(test_shelfnet tkDNN)
add_executable(test_shelfnet_berkeley tests/shelfnet/shelfnet_berkeley.cpp)
target_link_libraries(test_shelfnet_berkeley tkDNN)
add_executable(test_shelfnet_mapillary tests/shelfnet/shelfnet_mapillary.cpp)
target_link_libraries(test_shelfnet_mapillary tkDNN)
add_executable(test_shelfnet_coco tests/shelfnet/shelfnet_coco.cpp)
target_link_libraries(test_shelfnet_coco tkDNN)
# MONODEPTH2
add_executable(test_monodepth2_640 tests/monodepth2/monodepth2_640.cpp)
target_link_libraries(test_monodepth2_640 tkDNN)
add_executable(test_monodepth2_1024 tests/monodepth2/monodepth2_1024.cpp)
target_link_libraries(test_monodepth2_1024 tkDNN)
# DEMOS
add_executable(test_rtinference tests/test_rtinference/rtinference.cpp)
target_link_libraries(test_rtinference tkDNN)
add_executable(yolo3_demo demo/demo/demo.cpp
tracker_CLASS/c++/src/ekf.cpp
tracker_CLASS/c++/src/trackutils.cpp
tracker_CLASS/c++/src/plot.cpp
tracker_CLASS/c++/src/tracker.cpp )
add_executable(map_demo demo/demo/map.cpp)
target_link_libraries(map_demo tkDNN)
target_link_libraries(yolo3_demo tkDNN CLASS)
add_executable(demo demo/demo/demo.cpp)
target_link_libraries(demo tkDNN)
add_executable(demo3D demo/demo/demo3D.cpp)
target_link_libraries(demo3D tkDNN)
add_executable(demoTracker demo/demo/demoTracker.cpp)
target_link_libraries(demoTracker tkDNN)
add_executable(seg_demo demo/demo/seg_demo.cpp)
target_link_libraries(seg_demo tkDNN)
add_executable(demoDepth demo/demo/demoDepth.cpp)
target_link_libraries(demoDepth tkDNN)
#-------------------------------------------------------------------------------
# Install
@@ -133,23 +248,11 @@ target_link_libraries(yolo3_demo tkDNN CLASS)
#endif()
message("install dir:" ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY include/ DESTINATION include/)
install(TARGETS tkDNN kernels DESTINATION lib)
install(TARGETS tkDNN DESTINATION lib)
install(TARGETS test_simple test_mnist test_mnistRT test_rtinference demo map_demo DESTINATION bin)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" # source directory
DESTINATION "share/tkDNN/cmake/" # target directory
)
#-------------------------------------------------------------------------------
# Prepare for test
#-------------------------------------------------------------------------------
set(TEST_DATA true CACHE BOOL "If true download deps")
if( ${TEST_DATA} )
message("Launching pre-build dependency installer script...")
execute_process (COMMAND bash -c "bash build_models.sh download"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)
set(TEST_DATA false CACHE BOOL "If true download deps" FORCE)
message("Finished dowloading test weights")
endif()
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tests/" # source directory
DESTINATION "share/tkDNN/tests" # target directory
)
+339
View File
@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
tkDNN
Copyright (C) 2017 Francesco Gatti
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
+203 -46
View File
@@ -1,58 +1,215 @@
# tkDNN
tkDNN is a Deep Neural Network library built with cuDNN primitives specifically thought to work on NVIDIA TK1(and all successive) board.<br>
The main scope is to do high performance inference on already trained models.
tkDNN is a Deep Neural Network library built with cuDNN and tensorRT primitives, specifically thought to work on NVIDIA Jetson Boards. It has been tested on TK1(branch cudnn2), TX1, TX2, AGX Xavier, Nano and several discrete GPUs.
The main goal of this project is to exploit NVIDIA boards as much as possible to obtain the best inference performance. It does not allow training.
this branch actually work on every NVIDIA GPU that support the dependencies:
* CUDA 10.0
* CUDNN 7.603
* TENSORRT 6.01
* OPENCV 4.1
## Dependencies
If you use tkDNN in your research, please cite the [following paper](https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=9212130&casa_token=sQTJXi7tJNoAAAAA:BguH9xCIY48MxbtDS3LXzIXzO-9sWArm7Hd7y7BwaLmqRuM_Gx8bOYizFPNMNtpo5K0kB-P-). For use in commercial solutions, write at gattifrancesco@hotmail.it and micaela.verucchi@unimore.it or refer to https://hipert.unimore.it/ .
```
sudo apt install libgdal-dev libeigen3-dev python-matplotlib libyaml-cpp-dev libcereal-dev python2.7-dev
@inproceedings{verucchi2020systematic,
title={A Systematic Assessment of Embedded Neural Networks for Object Detection},
author={Verucchi, Micaela and Brilli, Gianluca and Sapienza, Davide and Verasani, Mattia and Arena, Marco and Gatti, Francesco and Capotondi, Alessandro and Cavicchioli, Roberto and Bertogna, Marko and Solieri, Marco},
booktitle={2020 25th IEEE International Conference on Emerging Technologies and Factory Automation (ETFA)},
volume={1},
pages={937--944},
year={2020},
organization={IEEE}
}
```
### What's new
#### 20 July 2021
- [x] Support to sematic segmentation [README](docs/README_seg.md)
- [x] Support 2D/3D Object Detection and Tracking [README](docs/README_2d3dtracking.md)
#### 24 November 2021
- [x] Support to sematic segmentation on cuda 11
- [x] Support to TensorRT8. (thanks to [Harshvardhan Chandirasekar](https://github.com/perseusdg))
#### 30 March 2022
- [x] Support to monocular depth esitmation [README](docs/README_depth.md) (thanks to [Harshvardhan Chandirasekar](https://github.com/perseusdg))
## FPS Results
Inference FPS of yolov4 with tkDNN, average of 1200 images with the same dimension as the input size, on
* RTX 2080Ti (CUDA 10.2, TensorRT 7.0.0, Cudnn 7.6.5);
* Xavier AGX, Jetpack 4.3 (CUDA 10.0, CUDNN 7.6.3, tensorrt 6.0.1 );
* Xavier NX, Jetpack 4.4 (CUDA 10.2, CUDNN 8.0.0, tensorrt 7.1.0 ).
* Tx2, Jetpack 4.2 (CUDA 10.0, CUDNN 7.3.1, tensorrt 5.0.6 );
* Jetson Nano, Jetpack 4.4 (CUDA 10.2, CUDNN 8.0.0, tensorrt 7.1.0 ).
| Platform | Network | FP32, B=1 | FP32, B=4 | FP16, B=1 | FP16, B=4 | INT8, B=1 | INT8, B=4 |
| :------: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: |
| RTX 2080Ti | yolo4 320 | 118.59 | 237.31 | 207.81 | 443.32 | 262.37 | 530.93 |
| RTX 2080Ti | yolo4 416 | 104.81 | 162.86 | 169.06 | 293.78 | 206.93 | 353.26 |
| RTX 2080Ti | yolo4 512 | 92.98 | 132.43 | 140.36 | 215.17 | 165.35 | 254.96 |
| RTX 2080Ti | yolo4 608 | 63.77 | 81.53 | 111.39 | 152.89 | 127.79 | 184.72 |
| AGX Xavier | yolo4 320 | 26.78 | 32.05 | 57.14 | 79.05 | 73.15 | 97.56 |
| AGX Xavier | yolo4 416 | 19.96 | 21.52 | 41.01 | 49.00 | 50.81 | 60.61 |
| AGX Xavier | yolo4 512 | 16.58 | 16.98 | 31.12 | 33.84 | 37.82 | 41.28 |
| AGX Xavier | yolo4 608 | 9.45 | 10.13 | 21.92 | 23.36 | 27.05 | 28.93 |
| Xavier NX | yolo4 320 | 14.56 | 16.25 | 30.14 | 41.15 | 42.13 | 53.42 |
| Xavier NX | yolo4 416 | 10.02 | 10.60 | 22.43 | 25.59 | 29.08 | 32.94 |
| Xavier NX | yolo4 512 | 8.10 | 8.32 | 15.78 | 17.13 | 20.51 | 22.46 |
| Xavier NX | yolo4 608 | 5.26 | 5.18 | 11.54 | 12.06 | 15.09 | 15.82 |
| Tx2 | yolo4 320 | 11.18 | 12.07 | 15.32 | 16.31 | - | - |
| Tx2 | yolo4 416 | 7.30 | 7.58 | 9.45 | 9.90 | - | - |
| Tx2 | yolo4 512 | 5.96 | 5.95 | 7.22 | 7.23 | - | - |
| Tx2 | yolo4 608 | 3.63 | 3.65 | 4.67 | 4.70 | - | - |
| Nano | yolo4 320 | 4.23 | 4.55 | 6.14 | 6.53 | - | - |
| Nano | yolo4 416 | 2.88 | 3.00 | 3.90 | 4.04 | - | - |
| Nano | yolo4 512 | 2.32 | 2.34 | 3.02 | 3.04 | - | - |
| Nano | yolo4 608 | 1.40 | 1.41 | 1.92 | 1.93 | - | - |
## MAP Results
Results for COCO val 2017 (5k images), on RTX 2080Ti, with conf threshold=0.001
| | CodaLab | CodaLab | CodaLab | CodaLab | tkDNN map | tkDNN map |
| -------------------- | :-----------: | :-------: | :-----------: | :---------: | :-----------: | :-------: |
| | **tkDNN** | **tkDNN** | **darknet** | **darknet** | **tkDNN** | **tkDNN** |
| | MAP(0.5:0.95) | AP50 | MAP(0.5:0.95) | AP50 | MAP(0.5:0.95) | AP50 |
| Yolov3 (416x416) | 0.381 | 0.675 | 0.380 | 0.675 | 0.372 | 0.663 |
| yolov4 (416x416) | 0.468 | 0.705 | 0.471 | 0.710 | 0.459 | 0.695 |
| yolov3tiny (416x416) | 0.096 | 0.202 | 0.096 | 0.201 | 0.093 | 0.198 |
| yolov4tiny (416x416) | 0.202 | 0.400 | 0.201 | 0.400 | 0.197 | 0.395 |
| Cnet-dla34 (512x512) | 0.366 | 0.543 | \- | \- | 0.361 | 0.535 |
| mv2SSD (512x512) | 0.226 | 0.381 | \- | \- | 0.223 | 0.378 |
## Index
- [tkDNN](#tkdnn)
- [Index](#index)
- [Dependencies](#dependencies)
- [How to compile this repo](#how-to-compile-this-repo)
- [Workflow](#workflow)
- [Exporting weights](#exporting-weights)
- [Run the demos](#run-the-demos)
- [tkDNN on Windows 10 or Windows 11](#tkdnn-on-windows-10-or-windows-11)
- [Existing tests and supported networks](#existing-tests-and-supported-networks)
- [References](#references)
## Dependencies
This branch works on every NVIDIA GPU that supports the following (latest tested) dependencies:
* CUDA 11.3 (or >= 10.2)
* cuDNN 8.2.1 (or >= 8.0.4)
* TensorRT 8.0.3 (or >=7.2)
* OpenCV 4.5.4 (or >=4)
* cmake 3.21 (or >= 3.15)
* yaml-cpp 0.5.2
* eigen3 3.3.4
* curl 7.58
```
sudo apt install libyaml-cpp-dev curl libeigen3-dev
```
#### About OpenCV
To compile and install OpenCV4 with contrib us the script ```install_OpenCV4.sh```. It will download and compile OpenCV in Download folder.
```
bash scripts/install_OpenCV4.sh
```
If you have OpenCV compiled with cuda and contrib and want to use it with tkDNN pass ```ENABLE_OPENCV_CUDA_CONTRIB=ON``` flag when compiling tkDBB
. If the flag is not passed,the preprocessing of the networks is computed on the CPU, otherwise on the GPU. In the latter case some milliseconds are saved in the end-to-end latency.
## How to compile this repo
Build with cmake. If using Ubuntu 18.04 a new version of cmake is needed (3.15 or above).
On both linux and windows ,the ```CMAKE_BUILD_TYPE``` variable needs to be defined as either ```Release``` or ```Debug```.
```
git clone https://github.com/ceccocats/tkDNN
cd tkDNN
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
```
## Workflow
The recommended workflow follow these step:
* Build and train a model in Keras (on any PC)
* Export weights and bias
* Define the model on tkDNN
* Do inference (on TK1)
Steps needed to do inference on tkDNN with a custom neural network.
* Build and train a NN model with your favorite framework.
* Export weights and bias for each layer and save them in a binary file (one for layer).
* Export outputs for each layer and save them in a binary file (one for layer).
* Create a new test and define the network, layer by layer using the weights extracted and the output to check the results.
* Do inference.
## Compile the library
Build with cmake
```
mkdir build
cd build
cmake ..
# use -DTEST_DATA=False to skip dataset download
make
```
during the cmake configuration it will be dowloaded the weights needed for running
the tests
## Exporting weights
## Test
Assumiung you have correctly builded the library these are the test ready to exec:
* test_simple: a simple convolutional and dense network (CUDNN only)
* test_mnist: the famous mnist netwok (CUDNN and TENSORRT)
* test_mnistRT: the mnist network hardcoded in using tensorRT apis (TENSORRT only)
* test_yolo: YOLO detection network (CUDNN and TENSORRT)
* test_yolo_tiny: smaller version of YOLO (CUDNN and TENSRRT)
* test_yolo3_berkeley: our yolo3 version trained with BDD100K dateset
For specific details on how to export weights see [HERE](./docs/exporting_weights.md).
## Run the demos
For specific details on how to run:
- 2D object detection demos, details on FP16, INT8 and batching see [HERE](./docs/demo.md).
- segmentation demos see [HERE](./docs/README_seg.md).
- monocular depth estimation see [HERE](./docs/README_depth.md).
- 2D/3D object detection and tracking demos see [HERE](./docs/README_2d3dtracking.md).
- mAP demo to evaluate 2D object detectors see [HERE](./docs/mAP_demo.md).
## yolo3 berkeley demo detection
For the live detection you need to precompile the tensorRT file by luncing the desidered network test, this is the recommended process:
```
export TKDNN_MODE=FP16 # set the half floating point optimization
rm yolo3_berkeley.rt # be sure to delete(or move) old tensorRT files
./test_yolo3_berkeley # run the yolo test (is slow)
# with f16 inference the result will be a bit incorrect
```
this will genereate a yolo3_berkeley.rt file that can be used for live detection:
```
./yolo3_demo # launch detection on a demo video
./yolo3_demo yolo3_berkeley.rt /dev/video0 # launch detection on device 0
```
![demo](https://user-images.githubusercontent.com/11562617/72547657-540e7800-388d-11ea-83c6-49dfea2a0607.gif)
## tkDNN on Windows 10 or Windows 11
For specific details on how to run tkDNN on Windows 10/11 see [HERE](./docs/windows.md).
## Existing tests and supported networks
| Test Name | Network | Dataset | N Classes | Input size | Weights |
| :---------------- | :-------------------------------------------- | :-----------------------------------------------------------: | :-------: | :-----------: | :------------------------------------------------------------------------ |
| yolo | YOLO v2<sup>1</sup> | [COCO 2014](http://cocodataset.org/) | 80 | 608x608 | [weights](https://cloud.hipert.unimore.it/s/nf4PJ3k8bxBETwL/download) |
| yolo_224 | YOLO v2<sup>1</sup> | [COCO 2014](http://cocodataset.org/) | 80 | 224x224 | weights |
| yolo_berkeley | YOLO v2<sup>1</sup> | [BDD100K ](https://bair.berkeley.edu/blog/2018/05/30/bdd/) | 10 | 416x736 | weights |
| yolo_relu | YOLO v2 (with ReLU, not Leaky)<sup>1</sup> | [COCO 2014](http://cocodataset.org/) | 80 | 416x416 | weights |
| yolo_tiny | YOLO v2 tiny<sup>1</sup> | [COCO 2014](http://cocodataset.org/) | 80 | 416x416 | [weights](https://cloud.hipert.unimore.it/s/m3orfJr8pGrN5mQ/download) |
| yolo_voc | YOLO v2<sup>1</sup> | [VOC ](http://host.robots.ox.ac.uk/pascal/VOC/) | 21 | 416x416 | [weights](https://cloud.hipert.unimore.it/s/DJC5Fi2pEjfNDP9/download) |
| yolo3 | YOLO v3<sup>2</sup> | [COCO 2014](http://cocodataset.org/) | 80 | 416x416 | [weights](https://cloud.hipert.unimore.it/s/jPXmHyptpLoNdNR/download) |
| yolo3_512 | YOLO v3<sup>2</sup> | [COCO 2017](http://cocodataset.org/) | 80 | 512x512 | [weights](https://cloud.hipert.unimore.it/s/RGecMeGLD4cXEWL/download) |
| yolo3_berkeley | YOLO v3<sup>2</sup> | [BDD100K ](https://bair.berkeley.edu/blog/2018/05/30/bdd/) | 10 | 320x544 | [weights](https://cloud.hipert.unimore.it/s/o5cHa4AjTKS64oD/download) |
| yolo3_coco4 | YOLO v3<sup>2</sup> | [COCO 2014](http://cocodataset.org/) | 4 | 416x416 | [weights](https://cloud.hipert.unimore.it/s/o27NDzSAartbyc4/download) |
| yolo3_flir | YOLO v3<sup>2</sup> | [FREE FLIR](https://www.flir.com/oem/adas/adas-dataset-form/) | 3 | 320x544 | [weights](https://cloud.hipert.unimore.it/s/62DECncmF6bMMiH/download) |
| yolo3_tiny | YOLO v3 tiny<sup>2</sup> | [COCO 2014](http://cocodataset.org/) | 80 | 416x416 | [weights](https://cloud.hipert.unimore.it/s/LMcSHtWaLeps8yN/download) |
| yolo3_tiny512 | YOLO v3 tiny<sup>2</sup> | [COCO 2017](http://cocodataset.org/) | 80 | 512x512 | [weights](https://cloud.hipert.unimore.it/s/8Zt6bHwHADqP4JC/download) |
| dla34 | Deep Leayer Aggreagtion (DLA) 34<sup>3</sup> | [COCO 2014](http://cocodataset.org/) | 80 | 224x224 | weights |
| dla34_cnet | Centernet (DLA34 backend)<sup>4</sup> | [COCO 2017](http://cocodataset.org/) | 80 | 512x512 | [weights](https://cloud.hipert.unimore.it/s/KRZBbCQsKAtQwpZ/download) |
| mobilenetv2ssd | Mobilnet v2 SSD Lite<sup>5</sup> | [VOC ](http://host.robots.ox.ac.uk/pascal/VOC/) | 21 | 300x300 | [weights](https://cloud.hipert.unimore.it/s/x4ZfxBKN23zAJQp/download) |
| mobilenetv2ssd512 | Mobilnet v2 SSD Lite<sup>5</sup> | [COCO 2017](http://cocodataset.org/) | 81 | 512x512 | [weights](https://cloud.hipert.unimore.it/s/pdCw2dYyHMJrcEM/download) |
| resnet101 | Resnet 101<sup>6</sup> | [COCO 2014](http://cocodataset.org/) | 80 | 224x224 | weights |
| resnet101_cnet | Centernet (Resnet101 backend)<sup>4</sup> | [COCO 2017](http://cocodataset.org/) | 80 | 512x512 | [weights](https://cloud.hipert.unimore.it/s/5BTjHMWBcJk8g3i/download) |
| csresnext50-panet-spp | Cross Stage Partial Network <sup>7</sup> | [COCO 2014](http://cocodataset.org/) | 80 | 416x416 | [weights](https://cloud.hipert.unimore.it/s/Kcs4xBozwY4wFx8/download) |
| yolo4 | Yolov4 <sup>8</sup> | [COCO 2017](http://cocodataset.org/) | 80 | 416x416 | [weights](https://cloud.hipert.unimore.it/s/d97CFzYqCPCp5Hg/download) |
| yolo4_320 | Yolov4 <sup>8</sup> | [COCO 2017](http://cocodataset.org/) | 80 | 320x320 | [weights](https://cloud.hipert.unimore.it/s/d97CFzYqCPCp5Hg/download) |
| yolo4_512 | Yolov4 <sup>8</sup> | [COCO 2017](http://cocodataset.org/) | 80 | 512x512 | [weights](https://cloud.hipert.unimore.it/s/d97CFzYqCPCp5Hg/download) |
| yolo4_608 | Yolov4 <sup>8</sup> | [COCO 2017](http://cocodataset.org/) | 80 | 608x608 | [weights](https://cloud.hipert.unimore.it/s/d97CFzYqCPCp5Hg/download) |
| yolo4_berkeley | Yolov4 <sup>8</sup> | [BDD100K ](https://bair.berkeley.edu/blog/2018/05/30/bdd/) | 10 | 544x320 | [weights](https://cloud.hipert.unimore.it/s/nkWFa5fgb4NTdnB/download) |
| yolo4tiny | Yolov4 tiny <sup>9</sup> | [COCO 2017](http://cocodataset.org/) | 80 | 416x416 | [weights](https://cloud.hipert.unimore.it/s/iRnc4pSqmx78gJs/download) |
| yolo4x | Yolov4x-mish <sup>9</sup> | [COCO 2017](http://cocodataset.org/) | 80 | 640x640 | [weights](https://cloud.hipert.unimore.it/s/5MFjtNtgbDGdJEo/download) |
| yolo4tiny_512 | Yolov4 tiny <sup>9</sup> | [COCO 2017](http://cocodataset.org/) | 80 | 512x512 | [weights](https://cloud.hipert.unimore.it/s/iRnc4pSqmx78gJs/download) |
| yolo4x-cps | Scaled Yolov4 <sup>10</sup> | [COCO 2017](http://cocodataset.org/) | 80 | 512x512 | [weights](https://cloud.hipert.unimore.it/s/AfzHE4BfTeEm2gH/download) |
| shelfnet | ShelfNet18_realtime<sup>11</sup> | [Cityscapes](https://www.cityscapes-dataset.com/) | 19 | 1024x1024 | [weights](https://cloud.hipert.unimore.it/s/mEDZMRJaGCFWSJF/download) |
| shelfnet_berkeley | ShelfNet18_realtime<sup>11</sup> | [DeepDrive](https://bdd-data.berkeley.edu/) | 20 | 1024x1024 | [weights](https://cloud.hipert.unimore.it/s/m92e7QdD9gYMF7f/download) |
| dla34_cnet3d | Centernet3D (DLA34 backend)<sup>4</sup> | [KITTI 2017](http://www.cvlibs.net/datasets/kitti/eval_object.php?obj_benchmark=3d) | 1 | 512x512 | [weights](https://cloud.hipert.unimore.it/s/2MDyWGzQsTKMjmR/download) |
| dla34_ctrack | CenterTrack (DLA34 backend)<sup>12</sup> | [NuScenes 3D](https://www.nuscenes.org/) | 7 | 512x512 | [weights](https://cloud.hipert.unimore.it/s/rjNfgGL9FtAXLHp/download) |
| monodepth2 | Monodepth2 <sup>13</sup> | [KITTI DEPTH](http://www.cvlibs.net/datasets/kitti/raw_data.php) | - | 640x192 | [weights-mono](https://cloud.hipert.unimore.it/s/iYw9QwgP6CsqxLR/download) |
| monodepth2 | Monodepth2 <sup>13</sup> | [KITTI DEPTH](http://www.cvlibs.net/datasets/kitti/raw_data.php) | - | 640x192 | [weights-stereo](https://cloud.hipert.unimore.it/s/XmwbWNXDfqyQ4EL/download) |
## References
1. Redmon, Joseph, and Ali Farhadi. "YOLO9000: better, faster, stronger." Proceedings of the IEEE conference on computer vision and pattern recognition. 2017.
2. Redmon, Joseph, and Ali Farhadi. "Yolov3: An incremental improvement." arXiv preprint arXiv:1804.02767 (2018).
3. Yu, Fisher, et al. "Deep layer aggregation." Proceedings of the IEEE conference on computer vision and pattern recognition. 2018.
4. Zhou, Xingyi, Dequan Wang, and Philipp Krähenbühl. "Objects as points." arXiv preprint arXiv:1904.07850 (2019).
5. Sandler, Mark, et al. "Mobilenetv2: Inverted residuals and linear bottlenecks." Proceedings of the IEEE conference on computer vision and pattern recognition. 2018.
6. He, Kaiming, et al. "Deep residual learning for image recognition." Proceedings of the IEEE conference on computer vision and pattern recognition. 2016.
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).
11. Zhuang, Juntang, et al. "ShelfNet for fast semantic segmentation." Proceedings of the IEEE International Conference on Computer Vision Workshops. 2019.
12. Zhou, Xingyi, Vladlen Koltun, and Philipp Krähenbühl. "Tracking objects as points." European Conference on Computer Vision. Springer, Cham, 2020.
13. Godard, Clément, et al. "Digging into self-supervised monocular depth estimation." Proceedings of the IEEE/CVF International Conference on Computer Vision. 2019.
## Contributors
The main contibutors, in chronological order, are:
- [Francesco Gatti](https://github.com/ceccocats), francesco.gatti@hipert.it
- [Micaela Verucchi](https://github.com/mive93), micaela.verucchi@unimore.it
- [Davide Sapienza](https://github.com/sapienzadavide), davide.sapienza@unimore.it
- [Harshvardhan Chandirasekar](https://github.com/perseusdg), f20180523@goa.bits-pilani.ac.in
+62 -29
View File
@@ -1,33 +1,66 @@
# Find the header files
# find the library
if(CUDA_FOUND)
find_cuda_helper_libs(cudnn)
set(CUDNN_LIBRARY ${CUDA_cudnn_LIBRARY} CACHE FILEPATH "location of the cuDNN library")
unset(CUDA_cudnn_LIBRARY CACHE)
find_path(CUDNN_INCLUDE_DIR
${CMAKE_SYSROOT}/usr/local/include
${CMAKE_SYSROOT}/usr/include
/usr/local/nvidia/tensorrt/include/
NO_DEFAULT_PATH
)
find_cuda_helper_libs(nvinfer)
set(NVINFER_LIBRARY ${CUDA_nvinfer_LIBRARY} CACHE FILEPATH "location of the nvinfer library")
unset(CUDA_nvinfer_LIBRARY CACHE)
endif()
set(OLD_ROOT ${CMAKE_FIND_ROOT_PATH})
list(APPEND CMAKE_FIND_ROOT_PATH /)
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.7)
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.5)
find_library(CUDNN_LIB
NAMES cudnn
PATHS
/usr/local/driveworks/targets/${CMAKE_SYSTEM_PROCESSOR}-Linux/lib
/usr/lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/
# find the include
if(CUDNN_LIBRARY)
find_path(CUDNN_INCLUDE_DIR
cudnn.h
PATHS ${CUDA_TOOLKIT_INCLUDE}
DOC "location of cudnn.h"
NO_DEFAULT_PATH
)
find_library(CUDNN_NVLIB
NAMES "nvinfer"
PATHS
/usr/local/driveworks/targets/${CMAKE_SYSTEM_PROCESSOR}-Linux/lib
/usr/lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/
NO_DEFAULT_PATH
)
set(CMAKE_FIND_ROOT_PATH ${OLD_ROOT})
)
set(CUDNN_LIBRARIES ${CUDNN_LIB} ${CUDNN_NVLIB})
message("-- Found CUDNN: " ${CUDNN_LIB})
message("-- Found NVINFER: " ${CUDNN_NVLIB})
set(CUDNN_FOUND true)
if(NOT CUDNN_INCLUDE_DIR)
find_path(CUDNN_INCLUDE_DIR
cudnn.h
DOC "location of cudnn.h"
)
endif()
message("-- Found CUDNN: " ${CUDNN_LIBRARY})
message("-- Found CUDNN include: " ${CUDNN_INCLUDE_DIR})
endif()
if(NVINFER_LIBRARY)
find_path(NVINFER_INCLUDE_DIR
NvInfer.h
PATHS ${CUDA_TOOLKIT_INCLUDE}
DOC "location of NvInfer.h"
NO_DEFAULT_PATH
)
if(NOT NVINFER_INCLUDE_DIR)
find_path(NVINFER_INCLUDE_DIR
NvInfer.h
DOC "location of NvInfer.h"
)
endif()
message("-- Found NVINFER: " ${NVINFER_LIBRARY})
message("-- Found NVINFER include: " ${NVINFER_INCLUDE_DIR})
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CUDNN
FOUND_VAR CUDNN_FOUND
REQUIRED_VARS
CUDNN_LIBRARY
CUDNN_INCLUDE_DIR
VERSION_VAR CUDNN_VERSION
)
if(CUDNN_FOUND)
set(CUDNN_LIBRARIES ${CUDNN_LIBRARY} ${NVINFER_LIBRARY})
set(CUDNN_INCLUDE_DIRS ${CUDNN_INCLUDE_DIR} ${NVINFER_INCLUDE_DIR})
endif()
set(CUDNN_FOUND true)
+20
View File
@@ -0,0 +1,20 @@
#include <stdio.h>
int main(int argc, char **argv){
cudaDeviceProp dP;
float min_cc = 5.0;
int rc = cudaGetDeviceProperties(&dP, 0);
if(rc != cudaSuccess) {
cudaError_t error = cudaGetLastError();
printf("CUDA error: %s", cudaGetErrorString(error));
return rc; /* Failure */
}
if((dP.major+(dP.minor/10)) < min_cc) {
printf("Min Compute Capability of %2.1f required: %d.%d found\n Not Building CUDA Code", min_cc, dP.major, dP.minor);
return 1; /* Failure */
} else {
printf("-arch=sm_%d%d", dP.major, dP.minor);
return 0; /* Success */
}
}
+7
View File
@@ -0,0 +1,7 @@
classes : 80 #number of classes
map_points : 101 #number of recall points (0 for all, 101 for COCO, 11 PascalVOC)
map_levels : 10 #number of IoU step for the AP
map_step : 0.05 #step of IoU
IoU_thresh : 0.5 #starting IoU threshold
conf_thresh : 0.001 #threshold on the condifence of the bbox
verbose : false #print on screen information
+7
View File
@@ -0,0 +1,7 @@
classes : 3 #number of classes
map_points : 101 #number of recall points (0 for all, 101 for COCO, 11 PascalVOC)
map_levels : 10 #number of IoU step for the AP
map_step : 0.05 #step of IoU
IoU_thresh : 0.5 #starting IoU threshold
conf_thresh : 0.0 #threshold on the condifence of the bbox
verbose : false #print on screen information
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Mon 06 May 2019 11:32:13 PM CEST"
image_width: 1920
image_height: 1080
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 1.6158690952190570e+03, 0., 9.4702812371722337e+02, 0.,
1.6123979985757153e+03, 5.1995630055718266e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -4.0971199964304100e-01, 1.8755404192050384e-01,
-5.3059322427743867e-03, -1.0380603625304912e-03, 0. ]
avg_reprojection_error: 3.4351035832972515e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Tue 07 May 2019 10:32:53 AM CEST"
image_width: 3072
image_height: 1728
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 4.7264390181579711e+03, 0., 1.5059850098280642e+03, 0.,
4.6793092340700096e+03, 6.7300681982359868e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -4.2669569210605879e-01, 6.6337608795749903e-01,
-1.3881256269106437e-03, 5.2468063845700682e-03, 0. ]
avg_reprojection_error: 3.1312290189919406e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Tue 07 May 2019 10:14:44 AM CEST"
image_width: 1920
image_height: 1080
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 1.6902498656747011e+03, 0., 9.7959318966703324e+02, 0.,
1.7552884617253583e+03, 5.3327953707582492e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -5.4891909767312119e-01, 2.5555919841568631e-01,
-4.3831358875660656e-03, -1.3934378903760349e-02, 0. ]
avg_reprojection_error: 1.1758482932800183e+00
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Mon 06 May 2019 11:32:13 PM CEST"
image_width: 1920
image_height: 1080
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 1.6158690952190570e+03, 0., 9.4702812371722337e+02, 0.,
1.6123979985757153e+03, 5.1995630055718266e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -4.0971199964304100e-01, 1.8755404192050384e-01,
-5.3059322427743867e-03, -1.0380603625304912e-03, 0. ]
avg_reprojection_error: 3.4351035832972515e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Tue 07 May 2019 09:56:50 AM CEST"
image_width: 1920
image_height: 1080
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 1.6229477302581809e+03, 0., 1.0277357980566628e+03, 0.,
1.6485741394129034e+03, 5.5596919291027621e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -3.7853584845653426e-01, 7.8553352913896368e-02,
-6.5552938633907229e-03, -1.6436824648695104e-02, 0. ]
avg_reprojection_error: 8.4629096638637347e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Fri 03 May 2019 11:56:13 PM CEST"
image_width: 3072
image_height: 1728
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 5.8796921906556563e+03, 0., 1.3036708932691290e+03, 0.,
5.9435402023228071e+03, 8.1110067822514861e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -5.4688862790206871e-01, 5.1913397860290666e-01,
-2.1076612628273591e-03, 1.6869796115416984e-02, 0. ]
avg_reprojection_error: 6.7667474319420251e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Sat 04 May 2019 12:00:38 AM CEST"
image_width: 3072
image_height: 1728
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 4.6903033136815602e+03, 0., 1.6303445000881884e+03, 0.,
4.7582671272189546e+03, 4.3596515032334111e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -3.4366857232996317e-01, 2.2799325522263861e-01,
2.0765840315530557e-02, -4.0088654509745098e-03, 0. ]
avg_reprojection_error: 3.9811872397860709e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Tue 07 May 2019 10:20:53 AM CEST"
image_width: 3072
image_height: 1728
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 2.5005410461483498e+03, 0., 1.5319405824251596e+03, 0.,
2.5001544574623872e+03, 7.8267345299919543e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -3.7379752112038928e-01, 1.6246299444310250e-01,
8.0371978716752837e-04, -9.6108499236087584e-04, 0. ]
avg_reprojection_error: 3.6334262234685299e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Tue 07 May 2019 10:37:47 AM CEST"
image_width: 960
image_height: 720
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 5.0439587680799593e+02, 0., 4.8997081391816727e+02, 0.,
5.0714582349015507e+02, 3.5481348085748095e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -2.7916140864065331e-01, 6.5465070220501562e-02,
-1.9231901334709591e-03, -2.6191562264760264e-03, 0. ]
avg_reprojection_error: 5.7283635087126605e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Tue 07 May 2019 10:41:12 AM CEST"
image_width: 960
image_height: 720
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 5.1663651913150818e+02, 0., 4.7267297458218127e+02, 0.,
5.1291090124818436e+02, 3.8505850298928243e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -2.8051872523046845e-01, 6.0895269981008610e-02,
-9.7920840355269542e-03, -4.9804820350633240e-04, 0. ]
avg_reprojection_error: 5.4967308787122626e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Tue 07 May 2019 10:50:02 AM CEST"
image_width: 960
image_height: 720
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 4.9724079419911664e+02, 0., 4.9277930193807083e+02, 0.,
4.9700744926387819e+02, 3.6581239154403062e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -2.7582961261093608e-01, 6.6908017283259263e-02,
-2.1580546593114500e-03, -1.7921711595441153e-03, 0. ]
avg_reprojection_error: 3.7129088933918375e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Tue 07 May 2019 10:53:27 AM CEST"
image_width: 960
image_height: 720
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 4.9372152821507876e+02, 0., 4.7585791077351445e+02, 0.,
4.9644139996881893e+02, 3.5961856724726260e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -2.9023109325424973e-01, 8.3150964750672046e-02,
-6.1378621304345154e-04, 8.4481910933416999e-04, 0. ]
avg_reprojection_error: 3.4691001942524069e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Sat 04 May 2019 12:35:58 AM CEST"
image_width: 3840
image_height: 2160
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 2.1723071272381276e+03, 0., 1.9718118689531000e+03, 0.,
2.2377541672328439e+03, 9.3157209524899565e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -3.8516162509048857e-01, 1.8961757063227327e-01,
1.8297248985443184e-02, -8.9166274086698288e-03, 0. ]
avg_reprojection_error: 9.9886914863900311e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Sun 05 May 2019 08:52:13 PM CEST"
image_width: 3072
image_height: 1728
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 2.9841357325808735e+03, 0., 1.5379802472694901e+03, 0.,
2.9784613885271938e+03, 8.9330228722164566e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -5.1096356919758967e-01, 1.4543132746407733e-01,
-3.1254001577433334e-02, -1.4769334036191385e-02, 0. ]
avg_reprojection_error: 9.3544537534095662e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Sun 05 May 2019 09:24:33 PM CEST"
image_width: 3072
image_height: 1728
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 2.4796388675592771e+03, 0., 1.5358283835422017e+03, 0.,
2.4440198814655632e+03, 8.9911455540136217e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -3.9478938399374452e-01, 1.6288159087710818e-01,
-1.8565610712959927e-02, -7.0112574756757643e-03, 0. ]
avg_reprojection_error: 4.5805459213906724e-01
-22
View File
@@ -1,22 +0,0 @@
%YAML:1.0
---
calibration_time: "Tue 07 May 2019 10:03:44 AM CEST"
image_width: 3072
image_height: 1728
board_width: 8
board_height: 6
square_size: 2.4799999237060547e+01
flags: 0
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 2.6027348174982544e+03, 0., 1.4808496083807213e+03, 0.,
2.6008830910556521e+03, 6.7577068120137187e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ -3.4912899377320661e-01, 1.5704840296202566e-01,
6.4926875404798358e-03, 5.7293259996249049e-03, 0. ]
avg_reprojection_error: 4.0040122960491076e-01
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

@@ -1,3 +0,0 @@
-7.327951322519857 -89.11104695972499 9201.012307315486
-3.2739347567332553 -42.14373356189513 3668.5149400959867
-0.0009310035308911926 -0.010684335913469737 0.9999999999999999
@@ -1,3 +0,0 @@
-5.575118981764042 19.15613757077127 7116.209593619794
-3.2016502214672586 11.087267568165238 4660.384266971425
-0.0007553414127200226 0.002676057142671632 1.0
@@ -1,3 +0,0 @@
-0.6209787370656474 -57.192772931734694 6553.189887121747
-0.655304496315561 -28.195100762686465 3423.351597211246
-0.0001275987755308679 -0.007884524572727637 1.0
@@ -1,3 +0,0 @@
21.441694474392808 72.45500438933801 4652.4523150318
9.195810184174585 36.76655098601718 1801.6321216143722
0.0027471614789484795 0.009610371445379061 1.0
@@ -1,3 +0,0 @@
23.89713091621312 60.523880117656084 7778.591483347838
11.708054761838232 41.819183783017614 1126.9348661897782
0.0029807026524197224 0.008783281479831609 0.9999999999999999
@@ -1,3 +0,0 @@
-2.986713098145805 -21.641128011999868 6870.903103366085
-2.2937864581163416 -14.410613254705751 4594.877638262097
-0.0004752252182089383 -0.003112785793525571 1.0
@@ -1,3 +0,0 @@
0.797119441300711 35.495698816749574 2225.384878217832
0.3510443326339413 59.809425152982726 1419.4212456173686
-1.8197506232485688e-05 0.01820976131616732 1.0
@@ -1,3 +0,0 @@
2.213864892663308 -21.831117643802187 4060.61306610222
0.9075230321117119 -7.525265027425343 1268.217122301812
0.0005431549026467866 -0.0054930502425022745 1.0
@@ -1,3 +0,0 @@
-8.65061527352736 -23.247834477892475 4009.9545358742134
-2.2093309523396223 -8.398154406654037 1529.4606465341913
-0.001952580524058866 -0.006089308376531831 1.0
@@ -1,3 +0,0 @@
-8.665173353556622 -19.056833294770822 3827.027102449301
-2.728678410673174 -6.695956964089541 1523.1971944608492
-0.0020218867007343213 -0.004877696027397352 1.0
@@ -1,3 +0,0 @@
-0.5624066154780419 -26.36968028701744 3384.7920236393156
-0.6590389521668137 -8.709883019993336 1162.7049573736972
-0.00023421305979212285 -0.006824826866955653 0.9999999999999999
@@ -1,3 +0,0 @@
-0.9691844827251948 -16.63913290283819 3991.384826153086
-0.47672518258283236 -11.365071723693541 1770.7201067235435
-0.0003215600914247826 -0.005142032883105236 1.0
-3
View File
@@ -1,3 +0,0 @@
-1.5172087045737013 5.226213011053854 2493.822558690447
-1.4892268949636678 4.265359557115566 3382.185465939972
-0.000492856899218649 0.0016917382715537009 1.0
-3
View File
@@ -1,3 +0,0 @@
3.671630456405992 102.56885593938215 3570.381264275829
1.5985035927893978 46.57491080817888 -1491.4874345505793
0.0006446393888135914 0.027894339637393125 1.0
-3
View File
@@ -1,3 +0,0 @@
0.44666021794890903 -32.932455985363575 3557.76647014547
1.0444994361599629 -37.23760709667856 4404.4517853552425
0.00029114742043039743 -0.010721230871024154 1.0
-3
View File
@@ -1,3 +0,0 @@
0.1982518156851575 -13.22038303683631 595.3838470607648
-0.4806350794284377 -6.567788488139482 598.1732743332492
-0.00016595895699412456 -0.007499178419813009 1.0
-3
View File
@@ -1,3 +0,0 @@
-0.4122368700442484 -10.479982981650977 812.1821012303
-0.6536846365005352 -4.951476039607947 512.0831604767536
-0.00042630219831388434 -0.006003223898658603 1.0
Binary file not shown.
+128 -575
View File
@@ -1,603 +1,156 @@
#include <time.h>
#include <iostream>
#include <signal.h>
#include <stdlib.h> /* srand, rand */
//#include <unistd.h>
#include <mutex>
#include "utils.h"
#include "CenternetDetection.h"
#include "MobilenetDetection.h"
#include "Yolo3Detection.h"
#include "message.h"
#include "visualization.h"
#include "configuration.h"
#include "tracker.h"
#include "../masa_protocol/include/send.hpp"
#include "../masa_protocol/include/serialize.hpp"
// #include <assert.h>
// #include <unistd.h>
// #include <mutex>
// #include <ctime>
// #include <pthread.h>
// #include <signal.h>
// #include <chrono>
// #include <math.h>
// #include <typeinfo>
// #include <iostream>
#define MAX_DETECT_SIZE 100
bool gRun;
std::chrono::steady_clock::time_point local_clock_start;
std::mutex mutexgRun;
std::string obj_class[10]{"person", "car", "truck", "bus", "motor", "bike", "rider", "traffic light", "traffic sign", "train"};
//mutex for some opencv operations
std::mutex mutex_cv;
Show_t updates;
bool SAVE_RESULT = false;
void sig_handler(int signo)
{
std::cout << "request gateway stop\n";
mutexgRun.lock();
void sig_handler(int signo) {
std::cout<<"request gateway stop\n";
gRun = false;
mutexgRun.unlock();
}
void *readVideoCapture(void *x_void_ptr)
{
std::cout << "readVideoCapture start...\n";
int main(int argc, char *argv[]) {
Frame_t *info_f = (Frame_t *)x_void_ptr;
mutex_cv.lock();
cv::VideoCapture cap(info_f->input, cv::CAP_FFMPEG);
mutex_cv.unlock();
cv::Mat frame_loc, frame0;
int frame_nbr_loc = 0;
// bool to_show = false;
if (!cap.isOpened())
{
mutexgRun.lock();
gRun = false;
mutexgRun.unlock();
}
else
std::cout << "camera started\n";
signal(SIGINT, sig_handler);
// cap.set(cv::CAP_PROP_BUFFERSIZE,3);
// std::cout<<"buf size: "<<cap.get(CV_CAP_PROP_BUFFERSIZE)<<std::endl;
auto start_t = std::chrono::steady_clock::now();
auto step_t = std::chrono::steady_clock::now();
auto end_t = std::chrono::steady_clock::now();
auto current_timestamp = std::chrono::steady_clock::now();
// compute fps and find camera's clock
double shift, mean_time = 0;
std::cout << "Frames per second using video.get(cv::CAP_PROP_FPS) : " << cap.get(cv::CAP_PROP_FPS) << std::endl;
std::cout << "readVideoCapture computes frame rate...\n";
// //compute frame rate
int i = 0;
int num_f = 120;
// the first 20 frames are null
while (i < 21)
{
cap >> frame_loc;
i++;
}
i = 0;
start_t = std::chrono::steady_clock::now();
while (i < num_f)
{
step_t = std::chrono::steady_clock::now();
cap >> frame_loc;
mean_time = mean_time + std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - step_t).count();
std::cout << " step " << i << " : " << std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - step_t).count() << " ms" << std::endl;
i++;
}
end_t = std::chrono::steady_clock::now();
std::cout << "Capturing " << num_f << " frames" << std::endl;
std::cout << " Time taken : " << std::chrono::duration_cast<std::chrono::milliseconds>(end_t - start_t).count() << " ms" << std::endl;
/*
mean_time indicates the milliseconds from a frame and the next. (frame rate)
local_clock_sync is the camera clock.
shift is the difference from local camera clock and local process clock.
a frame is allowed if its local timestamp minus its local clock is less then a tollerance,
otherwise it will be considered old.
*/
auto local_clock_sync = std::chrono::steady_clock::now();
mean_time = mean_time / num_f;
shift = ((double)std::chrono::duration_cast<std::chrono::milliseconds>(local_clock_sync - local_clock_start).count()) / mean_time;
shift = (shift - (int)shift) * mean_time;
std::cout << ".-------------------------------\n";
std::cout << " mean time: " << mean_time << std::endl;
std::cout << " shift: " << shift << std::endl;
std::cout << " TIMEDIFFERENCE: " << std::chrono::duration_cast<std::chrono::milliseconds>(local_clock_sync - local_clock_start).count() << std::endl;
std::cout << "\n\n\n\n";
std::cout << "readVideoCapture start to capture...\n";
while (gRun)
{
// mutex_cv.lock();
cap >> frame_loc;
// mutex_cv.unlock();
current_timestamp = std::chrono::steady_clock::now();
shift = std::chrono::duration_cast<std::chrono::milliseconds>(current_timestamp - local_clock_sync).count();
std::cout << " RELATIVE TIMESTAMP FRAME : " << shift << " ms" << std::endl;
shift = shift / mean_time;
shift = (shift - (int)shift) * mean_time;
shift = (shift - mean_time / 2 >= 0) ? -(mean_time - shift) : shift;
std::cout << "DELAY frame_" << frame_nbr_loc << " : " << shift << " ms" << std::endl;
// TODO: here introduce a tollerance to discard old frame
// std::cout<< "CV_CAP_PROP_POS_MSEC: "<< cap.get( cv::CAP_PROP_POS_MSEC) <<std::endl;
// std::cout<< "CV_CAP_PROP_POS_FRAMES: "<< cap.get( cv::CAP_PROP_POS_FRAMES) <<std::endl; // <-- the v4l2 'sequence' field
// std::cout<< "cv::CAP_PROP_FPS: "<< cap.get( cv::CAP_PROP_FPS)<<std::endl;
// std::cout << "Format: " << cap.get(CV_CAP_PROP_FORMAT) << "\n";
// CAP_PROP_POS_MSEC Current position of the video file in milliseconds or video capture timestamp.
std::cout << "id: " << cap.get(cv::CAP_PROP_POS_MSEC) << std::endl;
// CAP_PROP_FRAME_COUNT Number of frames in the video file.
std::cout << "id: " << cap.get(cv::CAP_PROP_FRAME_COUNT) << std::endl;
if (!frame_loc.data)
{
usleep(1000000);
mutex_cv.lock();
cap.open(info_f->input);
printf("cap reinitialize\n");
mutex_cv.unlock();
continue;
}
end_t = std::chrono::steady_clock::now();
std::cout << " VC-TIME 1 : " << std::chrono::duration_cast<std::chrono::milliseconds>(end_t - start_t).count() << " ms" << std::endl;
start_t = end_t;
info_f->sem_vc.lock();
info_f->frame = frame_loc.clone();
info_f->frame_nbr = frame_nbr_loc;
info_f->sem_vc.unlock();
// usleep(50000);
end_t = std::chrono::steady_clock::now();
std::cout << " VC-TIME 2 : " << std::chrono::duration_cast<std::chrono::milliseconds>(end_t - start_t).count() << " ms" << std::endl;
start_t = end_t;
frame_nbr_loc++;
}
return (void *)0;
}
void *computationTask(void *x_void_ptr)
{
Camera_t *camera = (Camera_t *)x_void_ptr;
pthread_t visual, originalshow, detectionshow, topviewshow, disparityshow;
pthread_t videocap;
tk::dnn::Yolo3Detection yolo = *(camera->yolo);
//create video capture thread
Frame_t info_f;
info_f.input = camera->input;
if (pthread_create(&videocap, NULL, readVideoCapture, (void *)&info_f))
{
fprintf(stderr, "Error creating thread\n");
return (void *)1;
};
bool to_show = camera->to_show;
double adfGeoTransform[6];
for (int i = 0; i < 6; i++)
adfGeoTransform[i] = camera->adfGeoTransform[i];
ModFrame_t info_show;
if (to_show)
{
// initialize updates struct
updates.update_o = false;
updates.update_de = false;
updates.update_t = false;
updates.update_di = false;
if (pthread_create(&visual, NULL, show_updates, (void *)NULL))
{
fprintf(stderr, "Error creating thread\n");
return (void *)1;
};
if (pthread_create(&originalshow, NULL, originalFrame, (void *)&info_f))
{
fprintf(stderr, "Error creating thread\n");
return (void *)1;
};
if (pthread_create(&disparityshow, NULL, disparityFrame, (void *)&info_f))
{
fprintf(stderr, "Error creating thread\n");
return (void *)1;
};
info_show.H = cv::Mat(cv::Size(3, 3), CV_64FC1);
if (pthread_create(&detectionshow, NULL, detectionFrame, (void *)&info_show))
{
fprintf(stderr, "Error creating thread\n");
return (void *)1;
};
if (pthread_create(&topviewshow, NULL, topviewFrame, (void *)&info_show))
{
fprintf(stderr, "Error creating thread\n");
return (void *)1;
};
}
char *pmatrix = camera->pmatrix;
/*projection matrix from camera to map*/
cv::Mat H(cv::Size(3, 3), CV_64FC1);
read_projection_matrix(H, pmatrix);
assert(cv::countNonZero(H) > 0);
// std::cout<<H<<std::endl;
// return (void*)0;
/*Camera calibration*/
cv::Mat cameraMat, distCoeff;
readCameraCalibrationYaml(camera->cameraCalib, cameraMat, distCoeff);
std::cout << cameraMat << std::endl;
std::cout << distCoeff << std::endl;
/*GPS information*/
std::vector<ObjCoords> coords;
/*socket*/
Communicator Comm(SOCK_DGRAM);
Comm.open_client_socket((char *)"127.0.0.1", 8888);
Message *m = new Message;
m->cam_idx = camera->CAM_IDX;
m->lights.clear();
/*Conversion for tracker, from gps to meters and viceversa*/
// mutex_cv.lock();
geodetic_converter::GeodeticConverter gc;
gc.initialiseReference(44.655540, 10.934315, 0);
// mutex_cv.unlock();
double east, north, up;
// double lat, lon, alt;
/*Mask info*/
cv::Mat mask = cv::imread(camera->maskfile, cv::IMREAD_GRAYSCALE);
cv::Mat maskOrient = cv::imread(camera->maskFileOrient);
// cv::Mat maskOrient = cv::imread(camera->maskFileOrient, 0);
/*for(int i=0; i< mask.cols; i++)
{
for(int j=0; j< mask.rows; j++)
{
std::cout<<maskOrient.at<cv::Vec3b>(i,j) <<std::endl;
}
}
// get config file path and read it
#ifdef __linux__
std::string config_file = "../demo/demoConfig.yaml";
#elif _WIN32
std::string config_file = "..\\..\\..\\demo\\demoConfig.yaml";
#endif
if(argc > 1)
config_file = argv[1];
return 0;*/
/*tracker infos*/
std::vector<Tracker> trackers;
std::vector<Data> cur_frame;
int initial_age = -5;
int age_threshold = -8;
int n_states = 5;
float dt = 0.03;
YAML::Node conf = YAMLloadConf(config_file);
if(!conf)
FatalError("Problem with config file");
int frame_nbr = 0;
// read settings from config file
std::string net = YAMLgetConf<std::string>(conf, "net", "yolo4tiny_fp32.rt");
if(!fileExist(net.c_str()))
FatalError("The given network does not exist. Create the rt first.");
//save video
/*cv::VideoWriter outputVideo;
cv::Size S = cv::Size((int)cap.get(cv::CAP_PROP_FRAME_WIDTH), //Acquire input size
(int)cap.get(cv::CAP_PROP_FRAME_HEIGHT));
outputVideo.open("test.avi", static_cast<int>(cap.get(cv::CAP_PROP_FOURCC)), cap.get(cv::CAP_PROP_FPS), S, true);*/
#ifdef __linux__
std::string input = YAMLgetConf<std::string>(conf, "input", "../demo/yolo_test.mp4");
#elif _WIN32
std::string input = YAMLgetConf<std::string>(conf, "win_input", "..\\..\\..\\demo\\yolo_test.mp4");
#endif
if(!fileExist(input.c_str()))
FatalError("The given input video does not exist.");
cv::Mat map1, map2;
auto start_t = std::chrono::steady_clock::now();
auto step_t = std::chrono::steady_clock::now();
auto end_t = std::chrono::steady_clock::now();
// auto step_t_segmentation = std::chrono::steady_clock::now();
// auto end_t_segmentation = std::chrono::steady_clock::now();
char ntype = YAMLgetConf<char>(conf, "ntype", 'y');
int n_classes = YAMLgetConf<int>(conf, "n_classes", 80);
int n_batch = YAMLgetConf<int>(conf, "n_batch", 1);
if(n_batch < 1 || n_batch > 64)
FatalError("Batch dim not supported");
float conf_thresh = YAMLgetConf<float>(conf, "conf_thresh", 0.3);
bool show = YAMLgetConf<bool>(conf, "show", true);
bool save = YAMLgetConf<bool>(conf, "save", false);
//TODO: move in a thread
// // information for the disparity map
// std::vector <cv::Rect> pre_rois;
// cv::Mat pre_frame;
cv::Mat orig_frame;
// cv::Mat canny, pre_canny, canny_RGB, pre_canny_RGB;
// cv::Mat canny_img;
std::cout <<"Net settings - net: "<< net
<<", ntype: "<< ntype
<<", n_classes: "<< n_classes
<<", n_batch: "<< n_batch
<<", conf_thresh: "<< conf_thresh<<"\n";
std::cout <<"Demo settings - input: "<< input
<<", show: "<< show
<<", save: "<< save<<"\n\n";
// create detection network
tk::dnn::Yolo3Detection yolo;
tk::dnn::CenternetDetection cnet;
tk::dnn::MobilenetDetection mbnet;
// box variable
tk::dnn::box b;
int x0, h, y1; //w, x1, y0;
int objClass;
std::string det_class;
;
// float prob;
cv::Scalar intensity;
tk::dnn::DetectionNN *detNN;
switch(ntype)
{
case 'y':
detNN = &yolo;
break;
case 'c':
detNN = &cnet;
break;
case 'm':
detNN = &mbnet;
n_classes++;
break;
default:
FatalError("Network type not allowed (3rd parameter)\n");
}
// cv::VideoWriter resultVideo;
// if(SAVE_RESULT) {
// int w = cap.get(cv::CAP_PROP_FRAME_WIDTH);
// int h = cap.get(cv::CAP_PROP_FRAME_HEIGHT);
// resultVideo.open("result.mp4", cv::VideoWriter::fourcc('M','P','4','V'), 30, cv::Size(w, h));
// }
detNN->init(net,n_classes,n_batch,conf_thresh);
// open video stream
cv::VideoCapture cap(input);
if(!cap.isOpened())
gRun = false;
else
std::cout<<"camera started\n";
cv::VideoWriter resultVideo;
if(save) {
int w = cap.get(cv::CAP_PROP_FRAME_WIDTH);
int h = cap.get(cv::CAP_PROP_FRAME_HEIGHT);
resultVideo.open("result.mp4", cv::VideoWriter::fourcc('M','P','4','V'), 30, cv::Size(w, h));
}
if(show)
cv::namedWindow("detection", cv::WINDOW_NORMAL);
cv::Mat frame;
cv::Mat frame_crop;
cv::Mat dnn_input;
bool first_iteration = true;
std::vector<cv::Mat> batch_frame;
std::vector<cv::Mat> batch_dnn_input;
while (gRun)
{
TIMER_START
start_t = std::chrono::steady_clock::now();
step_t = start_t;
// start detection loop
gRun = true;
while(gRun) {
batch_dnn_input.clear();
batch_frame.clear();
for(int bi=0; bi< n_batch; ++bi){
cap >> frame;
if(!frame.data)
break;
batch_frame.push_back(frame);
info_f.sem_vc.lock();
frame = info_f.frame.clone();
if (info_f.frame_nbr - frame_nbr > 1)
std::cout << "more than one - f_n (diff " << info_f.frame_nbr - frame_nbr << ")\n";
frame_nbr = info_f.frame_nbr;
info_f.sem_vc.unlock();
std::cout << "f_n: " << frame_nbr << std::endl;
// if (!frame.data)
if (frame_nbr == 0)
{
usleep(1000000);
printf("no frame received\n");
continue;
}
orig_frame = frame.clone();
// mutex_cv.lock();
if (first_iteration)
cv::initUndistortRectifyMap(cameraMat, distCoeff, cv::Mat(), cameraMat, frame.size(), CV_16SC2, map1, map2);
cv::Mat temp = frame.clone();
cv::remap(temp, frame, map1, map2, 1);
//undistort(temp, frame, cameraMat, distCoeff);
// mutex_cv.unlock();
// this will be resized to the net format
batch_dnn_input.push_back(frame.clone());
}
if(!frame.data)
break;
//inference
detNN->update(batch_dnn_input, n_batch);
detNN->draw(batch_frame);
// this will be resized to the net format
dnn_input = frame.clone();
// TODO: async infer
yolo.update(dnn_input);
int num_detected = yolo.detected.size();
if (num_detected > MAX_DETECT_SIZE)
num_detected = MAX_DETECT_SIZE;
coords.clear();
end_t = std::chrono::steady_clock::now();
std::cout << " TIME 1 : " << std::chrono::duration_cast<std::chrono::milliseconds>(end_t - step_t).count() << " ms" << std::endl;
step_t = end_t;
// draw dets
std::cout << "camera: " << camera->CAM_IDX << " - num detected: " << num_detected << std::endl;
//TODO: move in a thread
// //preprocessing frame
// step_t_segmentation = std::chrono::steady_clock::now();
// // src_gray
// canny_img = img_laplacian(orig_frame,0);
// cv::Canny(canny_img, canny, 100, 100*2 );
// // sprintf(buf_frame_crop_name,"../demo/demo/data/img_disparity/%d_%d_canny.jpg",frame_nbr, 999);
// // cv::imwrite(buf_frame_crop_name, canny);
// end_t_segmentation = std::chrono::steady_clock::now();
// std::cout << " - TIME END pre canny : "<<std::chrono::duration_cast<std::chrono::milliseconds>(end_t_segmentation - step_t_segmentation).count() << " ms"<<std::endl;
// step_t_segmentation = end_t_segmentation;
// // std::cout<<"o: "<<orig_frame.cols<<" - "<<orig_frame.rows<<std::endl;
// // std::cout<<"canny: "<<canny.cols<<" - "<<canny.rows<<std::endl;
// // std::cout<<"pre: "<<pre_canny.cols<<" - "<<pre_canny.rows<<std::endl;
// if(!first_iteration)
// {
// // backtorgb = cv::cvtColor(pre_canny,cv::COLOR_GRAY2RGB)
// cv::cvtColor(pre_canny, pre_canny_RGB, cv::COLOR_GRAY2RGB);
// cv::cvtColor(canny, canny_RGB, cv::COLOR_GRAY2RGB);
// disparity_frame = frame_disparity(pre_canny_RGB, canny_RGB, frame_nbr, 999, 0);
// std::cout<<"size: "<<disparity_frame.rows<<" - "<<disparity_frame.cols<<std::endl;
// if (disparity_frame.rows == 0 || disparity_frame.cols == 0)
// return -1;
// if (disparity_frame.empty())
// { // only fools don't check...
// std::cout << "image not loaded !" << std::endl;
// return -1;
// }
// end_t_segmentation = std::chrono::steady_clock::now();
// std::cout << " TIME canny : frame_disparity : "<<std::chrono::duration_cast<std::chrono::milliseconds>(end_t_segmentation - step_t_segmentation).count() << " ms"<<std::endl;
// step_t_segmentation = end_t_segmentation;
// // //--------------------------------
// // //frame box disparity on the original image
// // step_t_segmentation = std::chrono::steady_clock::now();
// // frame_box_disparity(pre_frame, frame, pre_rois, frame_nbr);
// // // reset pre_rois for the new roi of the current frame
// // // pre_rois.erase(pre_rois.begin(), pre_rois.end());
// // end_t_segmentation = std::chrono::steady_clock::now();
// // std::cout << " TIME Frame disparity : "<<std::chrono::duration_cast<std::chrono::milliseconds>(end_t_segmentation - step_t_segmentation).count() << " ms"<<std::endl;
// // step_t_segmentation = end_t_segmentation;
// // //frame box disparity on the preprocessed image
// // cv::cvtColor(pre_canny, pre_canny_RGB, cv::COLOR_GRAY2RGB);
// // cv::cvtColor(canny, canny_RGB, cv::COLOR_GRAY2RGB);
// // frame_box_disparity(pre_canny_RGB, canny_RGB, pre_rois, frame_nbr);
// // // reset pre_rois for the new roi of the current frame
// // pre_rois.erase(pre_rois.begin(), pre_rois.end());
// // end_t_segmentation = std::chrono::steady_clock::now();
// // std::cout << " TIME Canny Frame disparity : "<<std::chrono::duration_cast<std::chrono::milliseconds>(end_t_segmentation - step_t_segmentation).count() << " ms"<<std::endl;
// // step_t_segmentation = end_t_segmentation;
// // //---------------------------------
// }
// compute some metrics on the whole frame
// segmentation(pre_frame, frame, frame_nbr, 0, 0);
for (int i = 0; i < num_detected; i++)
{
b = yolo.detected[i];
x0 = b.x;
// w = b.w;
// x1 = b.x + w;
// y0 = b.y;
h = b.h;
y1 = b.y + h;
objClass = b.cl;
det_class = obj_class[b.cl];
// prob = b.prob;
intensity = mask.at<uchar>(cv::Point(int(x0 + b.w / 2), y1));
if (intensity[0])
{
if (objClass < 6)
{
// find the rectangular on the frame (sub-figure)
// roi.x = (x0 > 0)? x0 : 0;
// roi.y = (y0 > 0)? y0 : 0;
// // std::cout<<"x "<<roi.x<<" - y "<<roi.y<<std::endl;
// roi.width = (roi.x+w >= frame.cols)? frame.cols-1-roi.x : w;
// roi.height = (roi.y+h >= frame.rows)? frame.rows-1-roi.y : h;
// std::cout<<"w "<<roi.width<<" - h "<<roi.height<<std::endl;
// std::cout<<"wf "<<frame.cols<<" - hf "<<frame.rows<<std::endl;
// std::cout<<"---"<<std::endl;
// std::cout<<"x "<<roi.x<<" to "<<roi.width+roi.x<<" wf "<<frame.cols<<std::endl;
// std::cout<<"y "<<roi.y<<" to "<<roi.height+roi.y<<" hf "<<frame.rows<<std::endl;
//update pre_roi for the next frame
// pre_rois.push_back(roi);
// segmentation(frame(roi), frame(roi), frame_nbr, i, 1);
/////
convert_coords(coords, x0 + b.w / 2, y1, objClass, H, adfGeoTransform);
// //std::cout<<objClass<<" ("<<prob<<"): "<<x0<<" "<<y0<<" "<<x1<<" "<<y1<<"\n";
// cv::rectangle(frame, cv::Point(x0, y0), cv::Point(x1, y1), camera->yolo.colors[objClass], 2);
// // draw label
// int baseline = 0;
// float fontScale = 0.5;
// int thickness = 2;
// cv::Size textSize = getTextSize(det_class, cv::FONT_HERSHEY_SIMPLEX, fontScale, thickness, &baseline);
// cv::rectangle(frame, cv::Point(x0, y0), cv::Point((x0 + textSize.width - 2), (y0 - textSize.height - 2)), camera->yolo.colors[b.cl], -1);
// cv::putText(frame, det_class, cv::Point(x0, (y0 - (baseline / 2))), cv::FONT_HERSHEY_SIMPLEX, fontScale, cv::Scalar(255, 255, 255), thickness);
}
if(show){
for(int bi=0; bi< n_batch; ++bi){
cv::imshow("detection", batch_frame[bi]);
cv::waitKey(1);
}
}
end_t = std::chrono::steady_clock::now();
std::cout << " TIME 2 : " << std::chrono::duration_cast<std::chrono::milliseconds>(end_t - step_t).count() << " ms" << std::endl;
step_t = end_t;
//convert from latitude and longitude to meters for ekf
cur_frame.clear();
for (size_t i = 0; i < coords.size(); i++)
{
gc.geodetic2Enu(coords[i].lat_, coords[i].long_, 0, &east, &north, &up);
cur_frame.push_back(Data(east, north, frame_nbr, coords[i].class_));
}
if (first_iteration)
{
// if there aren't detections and it is the first iteration, we can't initialize the tracker, so continue
if (cur_frame.empty())
continue;
for (auto f : cur_frame)
trackers.push_back(Tracker(f, initial_age, dt, n_states));
}
else
{
Track(cur_frame, dt, n_states, initial_age, age_threshold, trackers);
}
std::cout << "There are " << trackers.size() << " trackers" << std::endl;
//prepare message with tracker info
if (trackers.size() != 0)
{
// mutex_cv.lock();
addRoadUserfromTracker(trackers, m, gc, maskOrient, adfGeoTransform, H);
// mutex_cv.unlock();
//prepare the message with detection info
//prepare_message(m, coords, CAM_IDX);
//send message
if (!m->objects.empty())
Comm.send_message(m);
}
if (to_show)
{
//populate the ModFrame_t
info_show.sem.lock();
info_show.original_frame = frame.clone();
// std::vector<Tracker> trackers;
info_show.trackers = trackers;
// geodetic_converter::GeodeticConverter gc;
info_show.gc = gc;
for (int i = 0; i < 6; i++)
info_show.adfGeoTransform[i] = adfGeoTransform[i];
// cv::Mat H;
info_show.H = H.clone();
info_show.yolo = yolo;
// std::copy(camera->yolo.begin(), camera->yolo.end(), info_show.yolo.begin());
info_show.mask = mask.clone();
info_show.sem.unlock();
}
// update pre_frame for the disparity map
// pre_frame = orig_frame.clone();
// pre_canny = canny.clone();
if (first_iteration)
first_iteration = false;
frame_nbr++;
std::cout << camera->CAM_IDX << " camera thread: ";
TIMER_STOP
if(n_batch == 1 && save)
resultVideo << frame;
}
return (void *)0;
std::cout<<"detection end\n";
double mean = 0;
std::cout<<COL_GREENB<<"\n\nTime stats:\n";
std::cout<<"Min: "<<*std::min_element(detNN->stats.begin(), detNN->stats.end())<<" ms\n";
std::cout<<"Max: "<<*std::max_element(detNN->stats.begin(), detNN->stats.end())<<" ms\n";
for(int i=0; i<detNN->stats.size(); i++) mean += detNN->stats[i]; mean /= detNN->stats.size();
std::cout<<"Avg: "<<mean<<" ms\t"<<1000/(mean)<<" FPS\n"<<COL_END;
return 0;
}
int main(int argc, char *argv[])
{
std::cout << "detection\n";
signal(SIGINT, sig_handler);
srand(time(NULL));
Parameters_t par;
if(!read_parameters(argc, argv, &par))
return -1;
tk::dnn::Yolo3Detection yolo[par.n_cameras];
for(int i=0; i<par.n_cameras; i++)
{
yolo[i].init(par.net);
yolo[i].thresh = 0.25;
// if(SAVE_RESULT)
// resultVideo << frame;
}
// tk::dnn::Yolo3Detection yolo;
// yolo.init(net);
// yolo.thresh = 0.25;
gRun = true;
// start the local clock. It is used to check the incoming frames (by different cameras)
local_clock_start = std::chrono::steady_clock::now();
/*GPS information*/
double *adfGeoTransform = (double *)malloc(6 * sizeof(double));
readTiff(par.tiffile, adfGeoTransform);
// Camera_t cameras[par.n_cameras];
for(int i=0; i<par.n_cameras; i++)
{
for(int j = 0; j < 6; j++ )
par.cameras[i].adfGeoTransform[j] = adfGeoTransform[j];
par.cameras[i].yolo = &yolo[i];
// par.cameras[i].yolo.init(par.net);
// par.cameras[i].yolo.thresh = 0.25;
// cameras[i].yolo = yolo[i];
// cameras[i].yolo = yolo;
}
pthread_t camera_task[par.n_cameras];
for(int i=0; i<par.n_cameras; i++)
{
std::cout<<"creating thread\n";
if(pthread_create(&camera_task[i], NULL, computationTask, (void*)&(par.cameras[i])))
{
fprintf(stderr, "error creating thread\n");
return 1;
}
}
for(int i=0; i<par.n_cameras; i++)
{
pthread_join(camera_task[i], NULL);
}
std::cout <<" free adfGeoT \n";
free(adfGeoTransform);
std::cout << "detection end\n";
return 0;
}
+159
View File
@@ -0,0 +1,159 @@
#include <iostream>
#include <signal.h>
#include <stdlib.h> /* srand, rand */
//#include <unistd.h>
#include <mutex>
#include "demo_utils.h"
#include "CenternetDetection3D.h"
bool gRun;
bool SAVE_RESULT = false;
void sig_handler(int signo) {
std::cout<<"request gateway stop\n";
gRun = false;
}
int main(int argc, char *argv[]) {
std::cout<<"detection\n";
signal(SIGINT, sig_handler);
std::string net = "dla34_cnet3d_fp32.rt";
if(argc > 1)
net = argv[1];
#ifdef __linux__
std::string input = "../demo/yolo_test.mp4";
#elif _WIN32
std::string input = "..\\..\\..\\demo\\yolo_test.mp4";
#endif
if(argc > 2)
input = argv[2];
std::string calib_params = "";
if(argc > 3)
calib_params = argv[3];
char ntype = 'c';
if(argc > 4)
ntype = argv[4][0];
int n_classes = 3;
if(argc > 5)
n_classes = atoi(argv[5]);
int n_batch = 1;
if(argc > 6)
n_batch = atoi(argv[6]);
bool show = true;
if(argc > 7)
show = atoi(argv[7]);
float conf_thresh=0.3;
if(argc > 8)
conf_thresh = atof(argv[8]);
if(n_batch < 1 || n_batch > 64)
FatalError("Batch dim not supported");
if(!show)
SAVE_RESULT = true;
tk::dnn::CenternetDetection3D cnet;
tk::dnn::DetectionNN3D *detNN;
switch(ntype)
{
case 'c':
detNN = &cnet;
break;
default:
FatalError("Network type not allowed (3rd parameter)\n");
}
std::vector<cv::Mat> calibs;
if(!calib_params.empty() && calib_params!="NULL") {
std::cout<<"calib_params: "<<calib_params<<std::endl;
cv::Mat calib;
// the calibration matrix must be a 3x3 matrix
readCalibrationMatrix(calib_params, calib);
for(int bi=0; bi< n_batch; ++bi)
calibs.push_back(calib);
}
detNN->init(net, n_classes, n_batch, conf_thresh, calibs);
gRun = true;
cv::VideoCapture cap(input);
if(!cap.isOpened())
gRun = false;
else
std::cout<<"camera started\n";
cv::VideoWriter resultVideo;
if(SAVE_RESULT) {
int w = cap.get(cv::CAP_PROP_FRAME_WIDTH);
int h = cap.get(cv::CAP_PROP_FRAME_HEIGHT);
resultVideo.open("result.mp4", cv::VideoWriter::fourcc('M','P','4','V'), 30, cv::Size(w, h));
}
cv::Mat frame;
if(show)
cv::namedWindow("detection", cv::WINDOW_NORMAL);
std::vector<cv::Mat> batch_frame;
std::vector<cv::Mat> batch_dnn_input;
while(gRun) {
batch_dnn_input.clear();
batch_frame.clear();
for(int bi=0; bi< n_batch; ++bi){
cap >> frame;
if(!frame.data)
break;
batch_frame.push_back(frame);
// this will be resized to the net format
batch_dnn_input.push_back(frame.clone());
}
if(!frame.data)
break;
//inference
detNN->update(batch_dnn_input, n_batch, false, nullptr, false);
detNN->draw(batch_frame);
if(show){
for(int bi=0; bi< n_batch; ++bi){
cv::imshow("detection", batch_frame[bi]);
cv::waitKey(1);
}
}
if(n_batch == 1 && SAVE_RESULT)
resultVideo << frame;
}
std::cout<<"detection end\n";
double mean = 0;
std::cout<<COL_GREENB<<"\n\nTime preprocessing stats:\n";
std::cout<<"Min: "<<*std::min_element(detNN->pre_stats.begin(), detNN->pre_stats.end())<<" ms\n";
std::cout<<"Max: "<<*std::max_element(detNN->pre_stats.begin(), detNN->pre_stats.end())<<" ms\n";
for(int i=0; i<detNN->pre_stats.size(); i++) mean += detNN->pre_stats[i]; mean /= detNN->pre_stats.size();
std::cout<<"Avg: "<<mean<<" ms\n"<<COL_END;
mean=0;
std::cout<<COL_GREENB<<"\n\nTime stats:\n";
std::cout<<"Min: "<<*std::min_element(detNN->stats.begin(), detNN->stats.end())<<" ms\n";
std::cout<<"Max: "<<*std::max_element(detNN->stats.begin(), detNN->stats.end())<<" ms\n";
for(int i=0; i<detNN->stats.size(); i++) mean += detNN->stats[i]; mean /= detNN->stats.size();
std::cout<<"Avg: "<<mean<<" ms\n"<<COL_END;
mean=0;
std::cout<<COL_GREENB<<"\n\nTime postprocessing stats:\n";
std::cout<<"Min: "<<*std::min_element(detNN->post_stats.begin(), detNN->post_stats.end())<<" ms\n";
std::cout<<"Max: "<<*std::max_element(detNN->post_stats.begin(), detNN->post_stats.end())<<" ms\n";
for(int i=0; i<detNN->post_stats.size(); i++) mean += detNN->post_stats[i]; mean /= detNN->post_stats.size();
std::cout<<"Avg: "<<mean<<" ms\n"<<COL_END;
return 0;
}
+106
View File
@@ -0,0 +1,106 @@
#include <iostream>
#include <signal.h>
#include <stdlib.h> /* srand, rand */
//#include <unistd.h>
#include <mutex>
#include "tkDNN/DepthNN.h"
bool gRun;
void sig_handler(int signo) {
std::cout<<"request gateway stop\n";
gRun = false;
}
int main(int argc, char *argv[]) {
signal(SIGINT, sig_handler);
std::string net = "monodepth2_fp32.rt";
if(argc > 1)
net = argv[1];
#ifdef __linux__
std::string input = "../demo/yolo_test.mp4";
#elif _WIN32
std::string input = "..\\..\\..\\demo\\yolo_test.mp4";
#endif
if(argc > 2)
input = argv[2];
bool show = true;
if(argc > 3)
show = atoi(argv[3]);
bool save = true;
if(argc > 4)
save = atoi(argv[4]);
std::cout <<"Net settings - net: "<< net
<<"\n";
std::cout <<"Demo settings - input: "<< input
<<", show: "<< show
<<", save: "<< save<<"\n\n";
tk::dnn::DepthNN depthNN;
// create depth network
int n_batch = 1;
depthNN.init(net, n_batch);
// open video stream
cv::VideoCapture cap(input);
if(!cap.isOpened())
gRun = false;
else
std::cout<<"camera started\n";
cv::VideoWriter resultVideo;
if(save) {
int w = depthNN.output_w;
int h = depthNN.output_h;
resultVideo.open("result.mp4", cv::VideoWriter::fourcc('M','P','4','V'), 30, cv::Size(w, h));
}
if(show)
cv::namedWindow("depth", cv::WINDOW_NORMAL);
cv::Mat frame;
std::vector<cv::Mat> batch_frame;
std::vector<cv::Mat> batch_dnn_input;
// start detection loop
gRun = true;
while(gRun) {
batch_dnn_input.clear();
batch_frame.clear();
//read frame
cap >> frame;
if(!frame.data)
break;
batch_frame.push_back(frame);
batch_dnn_input.push_back(frame.clone());
//inference
depthNN.update(batch_dnn_input, 1);
if(show){
cv::imshow("depth", depthNN.depthMats[0]);
cv::waitKey(1);
}
if(save)
resultVideo << depthNN.depthMats[0];
}
std::cout<<"detection end\n";
double mean = 0;
std::cout<<COL_GREENB<<"\n\nTime stats depth:\n";
std::cout<<"Min: "<<*std::min_element(depthNN.stats.begin(), depthNN.stats.end())<<" ms\n";
std::cout<<"Max: "<<*std::max_element(depthNN.stats.begin(), depthNN.stats.end())<<" ms\n";
for(int i=0; i<depthNN.stats.size(); i++) mean += depthNN.stats[i]; mean /= depthNN.stats.size();
std::cout<<"Avg: "<<mean<<" ms\t"<<1000/(mean)<<" FPS\n";
return 0;
}
+160
View File
@@ -0,0 +1,160 @@
#include <iostream>
#include <signal.h>
#include <stdlib.h> /* srand, rand */
//#include <unistd.h>
#include <mutex>
#include "demo_utils.h"
#include "CenterTrack.h"
bool gRun;
bool SAVE_RESULT = false;
void sig_handler(int signo) {
std::cout<<"request gateway stop\n";
gRun = false;
}
int main(int argc, char *argv[]) {
std::cout<<"detection\n";
signal(SIGINT, sig_handler);
std::string net = "dla34_cnet3d_track_fp32.rt";
if(argc > 1)
net = argv[1];
#ifdef __linux__
std::string input = "../demo/yolo_test.mp4";
#elif _WIN32
std::string input = "..\\..\\..\\demo\\yolo_test.mp4";
#endif
if(argc > 2)
input = argv[2];
std::string calib_params = "";
if(argc > 3)
calib_params = argv[3];
char ntype = 'c';
if(argc > 4)
ntype = argv[4][0];
int n_classes = 3;
if(argc > 5)
n_classes = atoi(argv[5]);
int n_batch = 1;
if(argc > 6)
n_batch = atoi(argv[6]);
bool show = true;
if(argc > 7)
show = atoi(argv[7]);
float conf_thresh=0.3;
if(argc > 8)
conf_thresh = atof(argv[8]);
bool t3d = true;
if(argc > 9)
t3d = atoi(argv[9]);
if(n_batch < 1 || n_batch > 64)
FatalError("Batch dim not supported");
if(!show)
SAVE_RESULT = true;
tk::dnn::CenterTrack ctrack;
tk::dnn::TrackingNN *trackNN;
switch(ntype)
{
case 'c':
trackNN = &ctrack;
break;
default:
FatalError("Network type not allowed (3rd parameter)\n");
}
std::vector<cv::Mat> calibs;
if(!calib_params.empty() && calib_params!="NULL") {
std::cout<<"calib_params: "<<calib_params<<std::endl;
cv::Mat calib;
// the calibration matrix must be a 3x3 matrix
readCalibrationMatrix(calib_params, calib);
for(int bi=0; bi< n_batch; ++bi)
calibs.push_back(calib);
}
trackNN->init(net, n_classes, n_batch, conf_thresh, t3d, calibs);
gRun = true;
cv::VideoCapture cap(input);
if(!cap.isOpened())
gRun = false;
else
std::cout<<"camera started\n";
cv::VideoWriter resultVideo;
if(SAVE_RESULT) {
int w = cap.get(cv::CAP_PROP_FRAME_WIDTH);
int h = cap.get(cv::CAP_PROP_FRAME_HEIGHT);
resultVideo.open("result.mp4", cv::VideoWriter::fourcc('M','P','4','V'), 30, cv::Size(w, h));
}
cv::Mat frame;
if(show)
cv::namedWindow("detection", cv::WINDOW_NORMAL);
std::vector<cv::Mat> batch_frame;
std::vector<cv::Mat> batch_dnn_input;
while(gRun) {
batch_dnn_input.clear();
batch_frame.clear();
for(int bi=0; bi< n_batch; ++bi){
cap >> frame;
if(!frame.data)
break;
batch_frame.push_back(frame);
// this will be resized to the net format
batch_dnn_input.push_back(frame.clone());
}
if(!frame.data)
break;
//inference
trackNN->update(batch_dnn_input, n_batch, false, nullptr, false);
trackNN->draw(batch_frame);
if(show){
for(int bi=0; bi< n_batch; ++bi){
cv::imshow("detection", batch_frame[bi]);
cv::waitKey(1);
}
}
if(n_batch == 1 && SAVE_RESULT)
resultVideo << frame;
}
std::cout<<"detection end\n";
double mean = 0;
std::cout<<COL_GREENB<<"\n\nTime preprocessing stats:\n";
std::cout<<"Min: "<<*std::min_element(trackNN->pre_stats.begin(), trackNN->pre_stats.end())<<" ms\n";
std::cout<<"Max: "<<*std::max_element(trackNN->pre_stats.begin(), trackNN->pre_stats.end())<<" ms\n";
for(int i=0; i<trackNN->pre_stats.size(); i++) mean += trackNN->pre_stats[i]; mean /= trackNN->pre_stats.size();
std::cout<<"Avg: "<<mean<<" ms\n"<<COL_END;
mean=0;
std::cout<<COL_GREENB<<"\n\nTime stats:\n";
std::cout<<"Min: "<<*std::min_element(trackNN->stats.begin(), trackNN->stats.end())<<" ms\n";
std::cout<<"Max: "<<*std::max_element(trackNN->stats.begin(), trackNN->stats.end())<<" ms\n";
for(int i=0; i<trackNN->stats.size(); i++) mean += trackNN->stats[i]; mean /= trackNN->stats.size();
std::cout<<"Avg: "<<mean<<" ms\n"<<COL_END;
mean=0;
std::cout<<COL_GREENB<<"\n\nTime postprocessing stats:\n";
std::cout<<"Min: "<<*std::min_element(trackNN->post_stats.begin(), trackNN->post_stats.end())<<" ms\n";
std::cout<<"Max: "<<*std::max_element(trackNN->post_stats.begin(), trackNN->post_stats.end())<<" ms\n";
for(int i=0; i<trackNN->post_stats.size(); i++) mean += trackNN->post_stats[i]; mean /= trackNN->post_stats.size();
std::cout<<"Avg: "<<mean<<" ms\n"<<COL_END;
return 0;
}
+264
View File
@@ -0,0 +1,264 @@
#include <iostream>
#include <signal.h>
#include <stdlib.h> /* srand, rand */
#ifdef __linux__
#include <unistd.h>
#endif
#include <mutex>
#include "utils.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include "Yolo3Detection.h"
#include "CenternetDetection.h"
#include "MobilenetDetection.h"
#include "evaluation.h"
#include <map>
void convertFilename(std::string &filename,const std::string l_folder, const std::string i_folder, const std::string l_ext,const std::string i_ext)
{
filename.replace(filename.find(l_folder),l_folder.length(),i_folder);
filename.replace(filename.find(l_ext),l_ext.length(),i_ext);
}
int main(int argc, char *argv[])
{
char ntype = 'y';
const char *config_filename = "../demo/config.yaml";
const char * net = "yolo4tiny_fp32.rt";
const char * labels_path = "../demo/COCO_val2017/all_labels.txt";
int n_batches = 1;
float confidence_thresh = 0.3;
bool show = false;
bool write_dets = false;
bool write_res_on_file = true;
bool write_coco_json = false;
int n_images = 5000;
bool verbose;
int classes, map_points, map_levels;
float map_step, IoU_thresh, conf_thresh;
double vm_total = 0, rss_total = 0;
double vm, rss;
//read args
if(argc > 1)
net = argv[1];
if(argc > 2)
ntype = argv[2][0];
if(argc > 3)
labels_path = argv[3];
if(argc > 4)
config_filename = argv[4];
if(argc > 5)
n_batches = atoi(argv[5]);
if(argc > 6)
confidence_thresh = atof(argv[6]);
std::cout<<"conf t: "<<confidence_thresh<<std::endl;
//check if files needed exist
if(!fileExist(config_filename))
FatalError("Wrong config file path.");
if(!fileExist(net))
FatalError("Wrong net file path.");
if(!fileExist(labels_path))
FatalError("Wrong labels file path.");
//read mAP parameters
tk::dnn::readmAPParams( config_filename, classes, map_points, map_levels, map_step,
IoU_thresh, conf_thresh, verbose);
//extract network name from rt path
std::string net_name;
removePathAndExtension(net, net_name);
std::cout<<"Network: "<<net_name<<std::endl;
//open files (if needed)
std::ofstream times, memory, coco_json;
if(write_coco_json){
coco_json.open(net_name+"_COCO_res.json");
coco_json << "[\n";
}
if(write_res_on_file){
times.open("times_"+net_name+"_"+ std::to_string(n_batches)+"_"+std::to_string(confidence_thresh)+".csv");
memory.open("memory.csv", std::ios_base::app);
memory<<net_name+"_"+ std::to_string(n_batches)+"_"+std::to_string(confidence_thresh)<<";";
}
// instantiate detector
tk::dnn::Yolo3Detection yolo;
tk::dnn::CenternetDetection cnet;
tk::dnn::MobilenetDetection mbnet;
tk::dnn::DetectionNN *detNN;
int n_classes = classes;
switch(ntype){
case 'y':
detNN = &yolo;
break;
case 'c':
detNN = &cnet;
break;
case 'm':
detNN = &mbnet;
n_classes++;
break;
default:
FatalError("Network type not allowed (3rd parameter)\n");
}
detNN->init(net,n_classes, 1, conf_thresh);
//read images
std::ifstream all_labels(labels_path);
std::string l_filename;
std::vector<tk::dnn::Frame> images;
std::vector<tk::dnn::box> detected_bbox;
std::cout<<"Reading groundtruth and generating detections"<<std::endl;
if(show)
cv::namedWindow("detection", cv::WINDOW_NORMAL);
bool file_ok = false;
int images_done;
for (images_done=0 ; images_done < n_images ;) {
int cur_batches = 0;
std::vector<cv::Mat> batch_frames;
std::vector<cv::Mat> batch_dnn_input;
std::vector<tk::dnn::Frame> cur_frames;
for(;cur_batches<n_batches && images_done < n_images;cur_batches++, ++images_done){
std::getline(all_labels, l_filename);
file_ok = all_labels ? true : false ;
if (!file_ok)
break;
tk::dnn::Frame f;
f.lFilename = l_filename;
f.iFilename = l_filename;
convertFilename(f.iFilename, "labels", "images", ".txt", ".jpg");
// read frame
if(!fileExist(f.iFilename.c_str()))
FatalError("Wrong image file path.");
cv::Mat frame = cv::imread(f.iFilename.c_str(), cv::IMREAD_COLOR);
batch_frames.push_back(frame);
f.height = frame.rows;
f.width = frame.cols;
if(!frame.data)
break;
batch_dnn_input.push_back(frame.clone());
// read and save groundtruth labels
if(fileExist(f.lFilename.c_str()))
{
std::ifstream labels(f.lFilename);
for(std::string line; std::getline(labels, line); ){
std::istringstream in(line);
tk::dnn::BoundingBox b;
in >> b.cl >> b.x >> b.y >> b.w >> b.h;
b.prob = 1;
b.truthFlag = 1;
f.gt.push_back(b);
if(show)// draw rectangle for groundtruth
cv::rectangle(batch_frames[cur_batches], cv::Point((b.x-b.w/2)*f.width, (b.y-b.h/2)*f.height), cv::Point((b.x+b.w/2)*f.width,(b.y+b.h/2)*f.height), cv::Scalar(0, 255, 0), 2);
}
}
cur_frames.push_back(f);
}
if (!file_ok)
break;
//inference
detNN->update(batch_dnn_input,cur_batches,write_res_on_file, &times, write_coco_json);
detNN->draw(batch_frames);
for(int j=0;j<cur_frames.size(); ++j){
if(write_coco_json)
printJsonCOCOFormat(&coco_json, cur_frames[j].iFilename.c_str(), detNN->batchDetected[j], classes, cur_frames[j].width, cur_frames[j].height);
std::ofstream myfile;
if(write_dets)
myfile.open ("det/"+cur_frames[j].lFilename.substr(cur_frames[j].lFilename.find("labels/") + 7));
// save detections labels
for(auto d:detNN->batchDetected[j]){
//convert detected bb in the same format as label
//<x_center>/<image_width> <y_center>/<image_width> <width>/<image_width> <height>/<image_width>
tk::dnn::BoundingBox b;
b.x = (d.x + d.w/2) / cur_frames[j].width;
b.y = (d.y + d.h/2) / cur_frames[j].height;
b.w = d.w / cur_frames[j].width;
b.h = d.h / cur_frames[j].height;
b.prob = d.prob;
b.cl = d.cl;
cur_frames[j].det.push_back(b);
if(write_dets)
myfile << d.cl << " "<< d.prob << " "<< b.x << " "<< b.y << " "<< b.w << " "<< b.h <<"\n";
if(show)// draw rectangle for detection
cv::rectangle(batch_frames[j], cv::Point(d.x, d.y), cv::Point(d.x + d.w, d.y + d.h), cv::Scalar(0, 0, 255), 2);
}
if(write_dets)
myfile.close();
images.push_back(cur_frames[j]);
if(show){
cv::imshow("detection", batch_frames[j]);
cv::waitKey(0);
}
}
std::cout <<COL_ORANGEB<< "Images done:\t" << images_done<< "\tcur batch:\t"<<cur_batches<< "\n"<<COL_END;
getMemUsage(vm, rss);
vm_total += vm;
rss_total += rss;
}
if(write_coco_json){
coco_json.seekp (coco_json.tellp() - std::streampos(2));
coco_json << "\n]\n";
coco_json.close();
}
std::cout << "Avg VM[MB]: " << vm_total/images_done/1024.0 << ";Avg RSS[MB]: " << rss_total/images_done/1024.0 << std::endl;
//compute mAP
double AP = tk::dnn::computeMapNIoULevels(images,classes,IoU_thresh,confidence_thresh, map_points, map_step, map_levels, verbose, write_res_on_file, net_name+"_"+ std::to_string(n_batches)+"_"+std::to_string(confidence_thresh));
std::cout<<"mAP "<<IoU_thresh<<":"<<IoU_thresh+map_step*(map_levels-1)<<" = "<<AP<<std::endl;
//compute average precision, recall and f1score
tk::dnn::computeTPFPFN(images,classes,IoU_thresh,confidence_thresh, verbose, write_res_on_file, net_name +"_"+ std::to_string(n_batches)+"_"+std::to_string(confidence_thresh));
if(write_res_on_file){
memory<<vm_total/images_done/1024.0<<";"<<rss_total/images_done/1024.0<<"\n";
times.close();
memory.close();
}
return 0;
}
+150
View File
@@ -0,0 +1,150 @@
#include <iostream>
#include <signal.h>
#include <stdlib.h> /* srand, rand */
#ifdef __linux__
#include <unistd.h>
#endif
#include <mutex>
#include "SegmentationNN.h"
bool gRun;
bool SAVE_RESULT = true;
void sig_handler(int signo) {
std::cout<<"request gateway stop\n";
gRun = false;
}
void writePred(const std::string& images_names, const std::string& gt_folder, const std::string& out_folder, tk::dnn::SegmentationNN& segNN, int& width, int& height, bool show=false){
std::ifstream all_gt(images_names);
std::string filename;
cv::Mat frame;
for (; std::getline(all_gt, filename); ) {
std::cout<<filename<<std::endl;
frame = cv::imread(gt_folder + filename);
height = frame.rows;
width = frame.cols;
segNN.updateOriginal(frame, false);
if(show)
segNN.draw();
cv::imwrite(out_folder + filename, segNN.segmented[0]);
}
}
int main(int argc, char *argv[]) {
std::cout<<"detection\n";
signal(SIGINT, sig_handler);
std::string net = "shelfnet_fp32.rt";
if(argc > 1)
net = argv[1];
std::string input = "../demo/yolo_test.mp4";
if(argc > 2)
input = argv[2];
int n_batch = 1;
if(argc > 3)
n_batch = atoi(argv[3]);
int n_classes = 19;
if(argc > 4)
n_classes = atoi(argv[4]);
bool resize = false;
if(argc > 5)
resize = atoi(argv[5]);
int baseline_resize = 1024;
if(argc > 6)
baseline_resize = atoi(argv[6]);
bool show = true;
if(argc > 7)
show = atoi(argv[7]);
bool write_pred = false;
if(argc > 8)
write_pred = atoi(argv[8]);
if(resize && (baseline_resize < 0 || baseline_resize > 5000))
FatalError("Problem with baseline resize")
if(n_batch < 1 || n_batch > 64)
FatalError("Batch dim not supported");
//net initialization
tk::dnn::SegmentationNN segNN;
segNN.init(net, n_classes, n_batch);
int height = 0, width = 0;
int basewidth=baseline_resize, hsize;
if(write_pred){
std::string gt_folder = "../demo/CityScapes_val/images/";
std::string images_names = "../demo/CityScapes_val/all_images.txt";
std::string out_folder = "seg/";
writePred(images_names, gt_folder, out_folder, segNN, width, height, show);
}
else{
if(!show)
SAVE_RESULT = true;
gRun = true;
cv::VideoCapture cap(input);
if(!cap.isOpened())
gRun = false;
else
std::cout<<"camera started\n";
cv::VideoWriter resultVideo;
if(SAVE_RESULT) {
int w,h;
if(resize){
w = basewidth;
h = int((float(cap.get(cv::CAP_PROP_FRAME_HEIGHT))*float(basewidth/float(cap.get(cv::CAP_PROP_FRAME_WIDTH)))));
}
else{
w = cap.get(cv::CAP_PROP_FRAME_WIDTH);
h = cap.get(cv::CAP_PROP_FRAME_HEIGHT);
}
resultVideo.open("result.mp4", cv::VideoWriter::fourcc('M','P','4','V'), 30, cv::Size(w, h));
}
cv::Mat frame;
while(gRun) {
cap >> frame;
if(!frame.data)
break;
if(resize){
hsize = int((float(frame.rows)*float(basewidth/float(frame.cols))));
cv::resize(frame, frame, cv::Size(basewidth, hsize));
}
height = frame.rows;
width = frame.cols;
//inference
segNN.updateOriginal(frame, true);
if(show)
segNN.draw();
if(SAVE_RESULT)
resultVideo << segNN.segmented[0];
}
}
std::cout<<"segmentation end\n";
double mean = 0, mean_pre = 0, mean_post = 0;
std::cout<<COL_GREENB<<"\n\nTime stats for size ["<<width<<","<<height<<"] :\n";
for(int i=0; i<segNN.stats.size(); i++) mean += segNN.stats[i]; mean /= segNN.stats.size();
for(int i=0; i<segNN.stats_pre.size(); i++) mean_pre += segNN.stats_pre[i]; mean_pre /= segNN.stats_pre.size();
for(int i=0; i<segNN.stats_post.size(); i++) mean_post += segNN.stats_post[i]; mean_post /= segNN.stats_post.size();
std::cout<<"Avg pre:\t"<<mean_pre<<" ms\t"<<1000/(mean_pre)<<" FPS\n";
std::cout<<"Avg inf:\t"<<mean<<" ms\t"<<1000/(mean)<<" FPS\n";
std::cout<<"Avg post:\t"<<mean_post<<" ms\t"<<1000/(mean_post)<<" FPS\n\n";
std::cout<<"Avg tot:\t"<<(mean_pre + mean_post + mean) <<" ms\t"<<1000/((mean_pre + mean_post + mean))<<" FPS\n"<<COL_END;
return 0;
}
+14
View File
@@ -0,0 +1,14 @@
# video input
input : "../demo/yolo_test.mp4"
win_input : "..\\..\\..\\demo\\yolo_test.mp4"
# network config
net : "yolo4_berkeley_fp32.rt"
ntype : 'y'
n_classes : 80
n_batch : 1
conf_thresh : 0.3
# demo config
show : true
save : false
+7
View File
@@ -0,0 +1,7 @@
FROM ceccocats/tkdnn:latest
LABEL maintainer "Francesco Gatti"
RUN cd && git clone https://github.com/ceccocats/tkDNN.git && cd tkDNN && mkdir build && cd build \
&& cmake .. && make -j12
+140
View File
@@ -0,0 +1,140 @@
FROM nvidia/cudagl:11.3.1-devel-ubuntu20.04
LABEL maintainer "TKDNN AUTHORS"
LABEL Description="tkDNN+cudagl"
LABEL com.tkdnn.nvidia.version="11.3.1"
ENV DEBIAN_FRONTEND noninteractive
ENV CC gcc
ENV CXX g++
RUN apt-get update && apt-get install -y \
libblkid-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y \
libcudnn8-dev=8.2.1.32-1+cuda11.3 \
libcudnn8=8.2.1.32-1+cuda11.3 \
libnvinfer-dev=8.0.3-1+cuda11.3 \
libnvinfer8=8.0.3-1+cuda11.3 && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y --no-install-recommends \
libblkid-dev \
locales \
lsb-release \
mesa-utils \
git \
nano \
terminator \
wget \
curl \
libssl-dev \
htop \
dbus-x11 \
libqt5opengl5-dev \
libgtk-3-dev \
libvtk7-dev \
libv4l-dev \
tar \
libgoogle-glog-dev \
libgflags-dev \
gfortran-9 \
libtbb-dev \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libdc1394-22-dev \
libavresample-dev \
libatlas-cpp-0.6-dev \
python3-dev \
gdb \
python3-pip \
unzip libtbb-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y --no-install-recommends \
software-properties-common && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-add-repository universe
RUN apt-get update && apt-get install -y python3-pip python3 openssh-server ssh pyqt5-dev sip-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN pip3 install --upgrade pip
RUN pip3 install --upgrade virtualenv
RUN pip3 install --upgrade paramiko
RUN pip3 install --ignore-installed --upgrade numpy protobuf
RUN cd ~ && mkdir build
RUN cd ~/build && wget https://github.com/Kitware/CMake/releases/download/v3.21.4/cmake-3.21.4.tar.gz && \
tar -xvf cmake-3.21.4.tar.gz && cd cmake-3.21.4 && ./configure --prefix=/usr/local --qt-gui --parallel=12 && \
make -j8 && make install
RUN apt-get update && apt-get install -y automake autoconf pkg-config libevent-dev libncurses5-dev bison && \
apt-get clean && rm -rf /var/lib/apt/lists/
RUN git clone https://github.com/tmux/tmux.git && \
cd tmux && git checkout tags/3.2 && ls -la && sh autogen.sh && ./configure && make -j8 && make install
RUN apt-get update && apt-get install -y zsh && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true
RUN chsh -s /usr/bin/zsh root
RUN git clone https://github.com/sindresorhus/pure /root/.oh-my-zsh/custom/pure
RUN ln -s /root/.oh-my-zsh/custom/pure/pure.zsh-theme /root/.oh-my-zsh/custom/
RUN ln -s /root/.oh-my-zsh/custom/pure/async.zsh /root/.oh-my-zsh/custom/
RUN sed -i -e 's/robbyrussell/refined/g' /root/.zshrc
RUN sed -i '/plugins=(/c\plugins=(git git-flow adb pyenv tmux)' /root/.zshrc
RUN mkdir -p /root/.config/terminator/
COPY assets/terminator_config /root/.config/terminator/config
RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf && \
echo "/usr/local/cuda/lib64" >> /etc/ld.so.conf.d/nvidia.conf
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/local/cuda/lib64:/usr/lib:/usr/lib/x86_64-linux-gnu:/usr/local/lib:${LD_LIBRARY_PATH}
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,graphics
RUN cd ~/build && wget https://github.com/opencv/opencv/archive/4.5.4.tar.gz && tar -xf 4.5.4.tar.gz && rm 4.5.4.tar.gz
RUN cd ~/build && wget https://github.com/opencv/opencv_contrib/archive/4.5.4.tar.gz && tar -xf 4.5.4.tar.gz && rm 4.5.4.tar.gz
RUN cd ~/build && \
cd opencv-4.5.4 && mkdir build && cd build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH='~/build/opencv_contrib-4.5.4/modules' \
-D BUILD_EXAMPLES=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_DOCS=OFF \
-D WITH_CUDA=ON \
-D WITH_OPENGL=ON \
-D WITH_NVCUVID=ON \
-D CUDA_ARCH_BIN=7.2 \
-D CUDA_ARCH_PTX=7.2 \
-D ENABLE_FAST_MATH=ON \
-D CUDA_FAST_MATH=ON \
-D WITH_CUBLAS=ON \
-D WITH_CUDNN=ON \
-D WITH_OPENMP=ON \
-D WITH_NONFREE=ON \
-D WITH_LIBV4L=ON \
-D WITH_GSTREAMER=ON \
-D WITH_GSTREAMER_0_10=OFF \
-D WITH_TBB=ON \
../ && make -j12 && make install && ldconfig
RUN cd ~ && rm -rf build
RUN cd ~ && mkdir Development && cd Development && \
git clone https://github.com/ceccocats/tkDNN.git && cd tkDNN && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make -j6
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
COPY assets/entrypoint_setup.sh /
ENTRYPOINT ["/entrypoint_setup.sh"]
CMD ["terminator"]
+18
View File
@@ -0,0 +1,18 @@
# Use the prebuilt image
```
# build image
docker build -t tkdnn:build -f Dockerfile .
```
# Build Base Docker image
```
# make nvidia docker working
# follow this guide: https://github.com/NVIDIA/nvidia-docker
# build image
docker build -t ceccocats/tkdnn:latest -f Dockerfile.base .
# run image
./docker_launch.sh
```
+123
View File
@@ -0,0 +1,123 @@
#! /bin/bash
CMD=
# Functions
# TOOD: Check if we can use: getent passwd $USER to extract all variables
# TODO: Check for valid inputs, cause now it will go through even with bad inputs
check_envs () {
DOCKER_CUSTOM_USER_OK=true;
if [ -z ${DOCKER_USER_NAME+x} ]; then
DOCKER_CUSTOM_USER_OK=false;
return;
fi
if [ -z ${DOCKER_USER_ID+x} ]; then
DOCKER_CUSTOM_USER_OK=false;
return;
else
if ! [ -z "${DOCKER_USER_ID##[0-9]*}" ]; then
echo -e "\033[1;33mWarning: User-ID should be a number. Falling back to defaults.\033[0m"
DOCKER_CUSTOM_USER_OK=false;
return;
fi
fi
if [ -z ${DOCKER_USER_GROUP_NAME+x} ]; then
DOCKER_CUSTOM_USER_OK=false;
return;
fi
if [ -z ${DOCKER_USER_GROUP_ID+x} ]; then
DOCKER_CUSTOM_USER_OK=false;
return;
else
if ! [ -z "${DOCKER_USER_GROUP_ID##[0-9]*}" ]; then
echo -e "\033[1;33mWarning: Group-ID should be a number. Falling back to defaults.\033[0m"
DOCKER_CUSTOM_USER_OK=false;
return;
fi
fi
}
setup_env_user () {
USER=$1
USER_ID=$2
GROUP=$3
GROUP_ID=$4
## Create user
useradd -m $USER
## Copy zsh/sh configs
cp /root/.profile /home/$USER/
cp /root/.bashrc /home/$USER/
cp /root/.zshrc /home/$USER/
## Copy terminator configs
mkdir -p /home/$USER/.config/terminator
cp /root/.config/terminator/config /home/$USER/.config/terminator/config
cp /root/.config/terminator/background.png /home/$USER/.config/terminator/background.png
cp -rf /root/.oh-my-zsh /home/$USER/
cp -rf /root/tkDNN /home/$USER/
rm -rf /home/$USER/.oh-my-zsh/custom/pure.zsh-theme /home/$USER/.oh-my-zsh/custom/async.zsh
ln -s /home/$USER/.oh-my-zsh/custom/pure/pure.zsh-theme /home/$USER/.oh-my-zsh/custom/
ln -s /home/$USER/.oh-my-zsh/custom/pure/async.zsh /home/$USER/.oh-my-zsh/custom/
sed -i -e 's@ZSH=\"/root@ZSH=\"/home/$USER@g' /home/$USER/.zshrc
# Copy SSH keys & fix owner
if [ -d "/root/.ssh" ]; then
cp -rf /root/.ssh /home/$USER/
chown -R $USER:$GROUP /home/$USER/.ssh
fi
## Fix owner
chown $USER:$GROUP /home/$USER
chown -R $USER:$GROUP /home/$USER/.config
chown $USER:$GROUP /home/$USER/.profile
chown $USER:$GROUP /home/$USER/.bashrc
chown $USER:$GROUP /home/$USER/.zshrc
chown -R $USER:$GROUP /home/$USER/.oh-my-zsh
chown -R $USER:$GROUP /home/$USER/tkDNN
## This a trick to keep the evnironmental variables of root which is important!
echo "if ! [ \"$DOCKER_USER_NAME\" = \"$(id -un)\" ]; then" >> /root/.bashrc
echo " cd /home/$DOCKER_USER_NAME" >> /root/.bashrc
echo " su $DOCKER_USER_NAME" >> /root/.bashrc
echo "fi" >> /root/.bashrc
echo "if ! [ \"$DOCKER_USER_NAME\" = \"$(id -un)\" ]; then" >> /root/.zshrc
echo " cd /home/$DOCKER_USER_NAME" >> /root/.zshrc
echo " su $DOCKER_USER_NAME" >> /root/.zshrc
echo "fi" >> /root/.zshrc
## Setup Password-file
PASSWDCONTENTS=$(grep -v "^${USER}:" /etc/passwd)
GROUPCONTENTS=$(grep -v -e "^${GROUP}:" -e "^docker:" /etc/group)
(echo "${PASSWDCONTENTS}" && echo "${USER}:x:$USER_ID:$GROUP_ID::/home/$USER:/bin/bash") > /etc/passwd
(echo "${GROUPCONTENTS}" && echo "${GROUP}:x:${GROUP_ID}:") > /etc/group
(if test -f /etc/sudoers ; then echo "${USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers ; fi)
}
# ---Main---
# Create new user
## Check Inputs
check_envs
## Determine user & Setup Environment
if [ $DOCKER_CUSTOM_USER_OK == true ]; then
echo " -->DOCKER_USER Input is set to '$DOCKER_USER_NAME:$DOCKER_USER_ID:$DOCKER_USER_GROUP_NAME:$DOCKER_USER_GROUP_ID'";
echo -e "\033[0;32mSetting up environment for user=$DOCKER_USER_NAME\033[0m"
setup_env_user $DOCKER_USER_NAME $DOCKER_USER_ID $DOCKER_USER_GROUP_NAME $DOCKER_USER_GROUP_ID
else
echo " -->DOCKER_USER* variables not set. Using 'root'.";
echo -e "\033[0;32mSetting up environment for user=root\033[0m"
DOCKER_USER_NAME="root"
fi
# Change shell to zsh
chsh -s /usr/bin/zsh $DOCKER_USER_NAME
# Run CMD from Docker
"$@"
+18
View File
@@ -0,0 +1,18 @@
[global_config]
title_transmit_bg_color = "#2e3436"
[keybindings]
[layouts]
[[default]]
[[[child1]]]
parent = window0
type = Terminal
[[[window0]]]
parent = ""
type = Window
[plugins]
[profiles]
[[default]]
background_color = "#282828"
cursor_color = "#aaaaaa"
foreground_color = "#f3f3f3"
palette = "#000000:#aa0000:#00aa00:#c4a000:#3465a4:#75507b:#06989a:#d3d7cf:#88807c:#f15d22:#73c48f:#ffce51:#48b9c7:#ad7fa8:#34e2e2:#eeeeec"
+9
View File
@@ -0,0 +1,9 @@
xhost local:root
docker run --rm -it --runtime=nvidia --privileged --net=host --cap-add sys_ptrace -d --ipc=host \
-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY \
-v $HOME/.Xauthority:/home/$(id -un)/.Xauthority -e XAUTHORITY=/home/$(id -un)/.Xauthority \
-e DOCKER_USER_NAME=$(id -un) \
-e DOCKER_USER_ID=$(id -u) \
-e DOCKER_USER_GROUP_NAME=$(id -gn) \
-e DOCKER_USER_GROUP_ID=$(id -g) \
-v $HOME/.ssh:/home/$(id -un)/.ssh ceccocats/tkdnn
+92
View File
@@ -0,0 +1,92 @@
# 2D/3D Object Detection and Tracking
Currently tkDNN supports only CenterTrack as 3DOD & 2D/3D Tracker network.
## 3D Object Detection
To run the 3D object detection demo follow these steps (example with CenterNet based on DLA34):
```
rm dla34_cnet3d_fp32.rt # be sure to delete(or move) old tensorRT files
./test_dla34_cnet3d # run the yolo test (is slow)
./demo3D dla34_cnet3d_fp32.rt ../demo/yolo_test.mp4 NULL c
```
The demo3D program takes the same parameters of the demo program:
```
./demo3D <network-rt-file> <path-to-video> <calibration-file> <kind-of-network> <number-of-classes> <n-batches> <show-flag> <conf-thresh>
```
where
* ```<calibration-file>``` is the camera calibration file (opencv format). It is important that the file contains entry "camera_matrix" with sub-entry "rows", "cols", "data". If you do not want to pass the calibration file, pass "NULL" instead.
![demo](https://user-images.githubusercontent.com/11939259/126784875-c4285497-d369-424f-abda-58274cd747ac.gif)
## Object Detection and Tracking
To run the 3D object detection & tracking demo follow these steps (example with CenterTrack based on DLA34):
```
rm dla34_ctrack_fp32.rt # be sure to delete(or move) old tensorRT files
./test_dla34_ctrack # run the yolo test (is slow)
./demoTracker dla34_ctrack_fp32.rt ../demo/yolo_test.mp4 NULL c
```
The demoTracker program takes the same parameters of the demo program:
```
./demoTracker <network-rt-file> <path-to-video> <calibration-file> <kind-of-network> <number-of-classes> <n-batches> <show-flag> <conf-thresh> <2D/3D-flag>
```
where
* ```<calibration-file>``` is the camera calibration file (opencv format). It is important that the file contains entry "camera_matrix" with sub-entry "rows", "cols", "data". If you do not want to pass the calibration file, pass "NULL" instead.
* ```<2D/3D-flag>``` if set to 0 the demo will be in the 2D mode, while if set to 1 the demo will be in the 3D mode (Default is 1 - 3D mode).
![demo](https://user-images.githubusercontent.com/11939259/126784878-513fa9e8-864a-4c24-b4bd-199737184708.gif)
## FPS Results
Inference FPS of shelfnet with tkDNN, average of 1200 images on:
* RTX 2080Ti (CUDA 10.2, TensorRT 7.0.0, Cudnn 7.6.5);
* Xavier AGX, Jetpack 4.3 (CUDA 10.0, CUDNN 7.6.3, tensorrt 6.0.1 );
### 3D OD and Tracking
| Platform | Test | Phase | FP32, ms | FP32, FPS | FP16, ms | FP16, FPS | INT8, ms | INT8, FPS |
| :------: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: |
| RTX 2080Ti | CenterTrack3D 512x512 (B=1) | pre | 4.43883 | 225.285 | 4.42951 | 225.759 | 4.44278 | 225.084 |
| RTX 2080Ti | CenterTrack3D 512x512 (B=1) | inf | 9.03454 | 110.686 | 6.02013 | 166.109 | 5.31611 | 188.108 |
| RTX 2080Ti | CenterTrack3D 512x512 (B=1) | post | 0.96631 | 1034.87 | 0.96824 | 1032.80 | 0.95066 | 1051.90 |
| RTX 2080Ti | CenterTrack3D 512x512 (B=1) | tot | 14.4397 | 69.2535 | 11.4179 | 87.5818 | 10.7095 | 93.3750 |
| RTX 2080Ti | CenterTrack3D 512x512 (B=4) | pre | 4.60075 | 217.356 | 4.28658 | 233.286 | 4.29473 | 232.844 |
| RTX 2080Ti | CenterTrack3D 512x512 (B=4) | inf | 8.48365 | 117.874 | 5.25150 | 190.422 | 4.58463 | 218.120 |
| RTX 2080Ti | CenterTrack3D 512x512 (B=4) | post | 0.99484 | 1005.19 | 0.91776 | 1089.61 | 0.89853 | 1112.93 |
| RTX 2080Ti | CenterTrack3D 512x512 (B=4) | tot | 14.0792 | 71.0266 | 10.4558 | 95.6405 | 9.77788 | 102.272 |
| AGX Xavier | CenterTrack3D 512x512 (B=1) | pre | 34.9915 | 28.5784 | 33.5976 | 29.7440 | 34.4425 | 29.0339 |
| AGX Xavier | CenterTrack3D 512x512 (B=1) | inf | 76.3579 | 13.0962 | 52.4759 | 19.0564 | 51.4610 | 19.4322 |
| AGX Xavier | CenterTrack3D 512x512 (B=1) | post | 3.38576 | 295.355 | 3.26010 | 306.739 | 3.19770 | 312.725 |
| AGX Xavier | CenterTrack3D 512x512 (B=1) | tot | 114.735 | 8.71574 | 89.3336 | 11.1940 | 89.1012 | 11.2232 |
| AGX Xavier | CenterTrack3D 512x512 (B=4) | pre | 32.8933 | 30.4014 | 32.7950 | 30.4925 | 32.9603 | 30.3396 |
| AGX Xavier | CenterTrack3D 512x512 (B=4) | inf | 74.2840 | 13.4618 | 50.3858 | 19.8469 | 49.2030 | 20.3240 |
| AGX Xavier | CenterTrack3D 512x512 (B=4) | post | 3.14888 | 317.574 | 3.13615 | 318.862 | 3.02550 | 330.524 |
| AGX Xavier | CenterTrack3D 512x512 (B=4) | tot | 110.326 | 9.06404 | 86.3169 | 11.5852 | 85.1888 | 11.7386 |
### 2D OD and Tracking
| Platform | Test | Phase | FP32, ms | FP32, FPS | FP16, ms | FP16, FPS | INT8, ms | INT8, FPS |
| :------: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: |
| RTX 2080Ti | CenterTrack2D 512x512 (B=1) | pre | 4.44386 | 225.030 | 4.43828 | 225.313 | 4.47747 | 223.340 |
| RTX 2080Ti | CenterTrack2D 512x512 (B=1) | inf | 9.08365 | 110.088 | 6.04842 | 165.332 | 5.34787 | 186.990 |
| RTX 2080Ti | CenterTrack2D 512x512 (B=1) | post | 0.98593 | 1014.27 | 0.97745 | 1023.07 | 0.96595 | 1035.25 |
| RTX 2080Ti | CenterTrack2D 512x512 (B=1) | tot | 14.5134 | 68.9018 | 11.4642 | 87.2281 | 10.7913 | 92.6672 |
| RTX 2080Ti | CenterTrack2D 512x512 (B=4) | pre | 4.41188 | 226.661 | 4.50800 | 221.828 | 4.29238 | 232.971 |
| RTX 2080Ti | CenterTrack2D 512x512 (B=4) | inf | 8.29015 | 120.625 | 5.38630 | 185.656 | 4.58500 | 218.103 |
| RTX 2080Ti | CenterTrack2D 512x512 (B=4) | post | 0.96847 | 1032.55 | 0.97997 | 1020.44 | 0.91791 | 1089.43 |
| RTX 2080Ti | CenterTrack2D 512x512 (B=4) | tot | 13.6705 | 73.1502 | 10.8743 | 91.9602 | 9.79528 | 102.090 |
| AGX Xavier | CenterTrack2D 512x512 (B=1) | pre | 33.4745 | 29.8735 | 33.4847 | 29.8643 | 33.5022 | 29.8488 |
| AGX Xavier | CenterTrack2D 512x512 (B=1) | inf | 76.2077 | 13.1220 | 52.5111 | 19.0436 | 51.6057 | 19.3777 |
| AGX Xavier | CenterTrack2D 512x512 (B=1) | post | 3.26055 | 306.697 | 3.26806 | 305.992 | 3.21988 | 310.571 |
| AGX Xavier | CenterTrack2D 512x512 (B=1) | tot | 111.943 | 8.93312 | 89.2639 | 11.2027 | 88.3278 | 11.3215 |
| AGX Xavier | CenterTrack2D 512x512 (B=4) | pre | 32.8323 | 30.4579 | 32.8595 | 30.4326 | 32.8195 | 30.4697 |
| AGX Xavier | CenterTrack2D 512x512 (B=4) | inf | 74.3075 | 13.4576 | 50.3555 | 19.8588 | 49.1805 | 20.3333 |
| AGX Xavier | CenterTrack2D 512x512 (B=4) | post | 3.12360 | 320.143 | 3.13570 | 318.908 | 3.04943 | 327.931 |
| AGX Xavier | CenterTrack2D 512x512 (B=4) | tot | 110.263 | 9.06920 | 86.3507 | 11.5807 | 85.0494 | 11.7579 |
+54
View File
@@ -0,0 +1,54 @@
# Monocular depth estimation with tkDNN
Currently tkDNN supports only Monodepth2 as monocular depth esitmation network.
## Run the demo
To run the depth estimation demo follow these steps (example with monodepth2):
```
rm monodepth2_fp32.rt # be sure to delete(or move) old tensorRT files
./test_monodepth2 # run the yolo test (is slow)
./demoDepth monodepth2_fp32.rt ../demo/yolo_test.mp4
```
In general the demo program takes the following parameters:
```
./demoDepth <network-rt-file> <path-to-video> <show-flag> <save-flag>
```
where
* ```<network-rt-file>``` is the rt file generated by a test
* ```<<path-to-video>``` is the path to a video file or a camera input
* ```<show-flag>``` if set to 0 the demo will not show the visualization, it will otherwise (default=1)
* ```<save-flag>``` if set to 1 the demo will save the video into result.mp4, it won't otherwise (default=1)
NB) By default it is used FP32 inference
![demo](https://user-images.githubusercontent.com/11939259/160845358-0d6ab15d-c5f4-46ae-b9da-bfaf3903389d.gif "Results on yolo_test.mp4")
<!-- ## FPS Results
Inference FPS of shelfnet with tkDNN, average of 1200 images on:
* RTX 2080Ti (CUDA 10.2, TensorRT 7.0.0, Cudnn 7.6.5);
* Xavier AGX, Jetpack 4.3 (CUDA 10.0, CUDNN 7.6.3, tensorrt 6.0.1 );
| Platform | Test | Phase | FP32, ms | FP32, FPS | FP16, ms | FP16, FPS | INT8, ms | INT8, FPS |
| :------: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: |
| RTX 2080Ti | shelfnet 1024x1024 (B=1) | pre | 6.11863 | 163.435 | 5.81465 | 171.979 | 5.88699 | 169.866 |
| RTX 2080Ti | shelfnet 1024x1024 (B=1) | inf | 11.5464 | 86.6074 | 7.35396 | 135.981 | 6.37623 | 156.832 |
| RTX 2080Ti | shelfnet 1024x1024 (B=1) | post | 4.09058 | 244.464 | 3.91961 | 255.128 | 4.07343 | 245.493 |
| RTX 2080Ti | shelfnet 1024x1024 (B=1) | tot | 21.7556 | 45.9652 | 17.0882 | 58.5199 | 16.3366 | 61.2121 |
| RTX 2080Ti | shelfnet 2048x2048 (B=4) | pre | 25.435 | 39.3158 | 25.2953 | 39.5331 | 25.9303 | 38.565 |
| RTX 2080Ti | shelfnet 2048x2048 (B=4) | inf | 36.5015 | 27.3961 | 17.0534 | 58.6395 | 15.6061 | 64.0773 |
| RTX 2080Ti | shelfnet 2048x2048 (B=4) | post | 17.3917 | 57.4985 | 17.1649 | 58.2583 | 17.5539 | 56.9675 |
| RTX 2080Ti | shelfnet 2048x2048 (B=4) | tot | 79.3283 | 12.6058 | 59.5136 | 16.8029 | 59.0903 | 16.9233 |
| AGX Xavier | shelfnet 1024x1024 (B=1) | pre | 8.0174 | 124.729 | 7.5117 | 133.126 | 7.47333 | 133.809 |
| AGX Xavier | shelfnet 1024x1024 (B=1) | inf | 72.4173 | 13.8089 | 37.505 | 26.6631 | 31.3286 | 31.9197 |
| AGX Xavier | shelfnet 1024x1024 (B=1) | post | 8.89958 | 112.365 | 8.83576 | 113.176 | 9.42655 | 106.083 |
| AGX Xavier | shelfnet 1024x1024 (B=1) | tot | 89.3342 | 11.1939 | 53.8525 | 18.5692 | 48.2285 | 20.7346 |
| AGX Xavier | shelfnet 2048x2048 (B=4) | pre | 47.1454 | 21.211 | 21.6475 | 46.1947 | 21.4201 | 46.6851 |
| AGX Xavier | shelfnet 2048x2048 (B=4) | inf | 266.537 | 3.75183 | 128.321 | 7.79293 | 107.621 | 9.29185 |
| AGX Xavier | shelfnet 2048x2048 (B=4) | post | 44.0711 | 22.6906 | 40.1732 | 24.8922 | 39.873 | 25.0796 |
| AGX Xavier | shelfnet 2048x2048 (B=4) | tot | 357.753 | 2.79522 | 190.142 | 5.25922 | 168.914 | 5.92016 | -->
+68
View File
@@ -0,0 +1,68 @@
# Semantic Segmentation with tkDNN
Currently tkDNN supports only ShelfNet as semantic segmentation network.
## Run the demo
To run the semantic segmentation demo follow these steps (example with shelfnet):
```
rm shelfnet_fp32.rt # be sure to delete(or move) old tensorRT files
export TKDNN_BATCHSIZE=4 # be sure you have batch size > than 1 if you want to run inference on images bigger than 1024
./test_shelfnet # run the yolo test (is slow)
./demo shelfnet_fp32.rt ../demo/yolo_test.mp4 1 19
```
In general the demo program takes the following parameters:
```
./seg_demo <network-rt-file> <path-to-video> <n-batches> <number-of-classes> <resize-flag> <baseline-resize> <show-flag> <write-pred>
```
where
* ```<network-rt-file>``` is the rt file generated by a test
* ```<<path-to-video>``` is the path to a video file or a camera input
* ```<n-batches>``` number of batches to use in inference (N.B. you should first export TKDNN_BATCHSIZE to the required n_batches and create again the rt file for the network).
* ```<number-of-classes>```is the number of classes the network is trained on
* ```<resize-flag>``` if set to 0 the demo will not resize the input frames, but use it as it is, otherwise it will resize it.
* ```<baseline-resize>``` is ```<resize-flag>``` is set to 1, then the input frames will be proportionally resized using ```<baseline-resize>``` as width baseline.
* ```<show-flag>``` if set to 0 the demo will not show the visualization but save the video into result.mp4 (if n-batches ==1)
* ```<write-pred>``` if set to 0 (default) the demo will run, otherwise the evaluation of a dataset will run and the output of the segmentation will be saved. Attention: this is under development and paths are embedded, so change them in the code in advance.
NB) By default it is used FP32 inference
NB) The batching is not used to work on more streams, rather to work on more tiles of the same image. Shelfnet never resized the input image, therefore for images greater than 1024x1024 tiles of 1024x1024 are given in input to the network in batch.
![demo](https://user-images.githubusercontent.com/11939259/126784236-38d24fc3-02df-4514-81c4-497e87e40b65.gif "Results on yolo_test.mp4")
For other demo videos refer to [this playlist](https://www.youtube.com/playlist?list=PLv0nEQYDD45y5EdSiywwCGPBmJVUzIWwe).
NB) The gif and the videos are obtained with Mapillary Vistas weights, that we cannot publicly share due to its license restrictions. However, you can train Shelfnet using Mapillary and [this](https://git.hipert.unimore.it/mverucchi/shelfnet) fork of the original repo.
## FPS Results
Inference FPS of shelfnet with tkDNN, average of 1200 images on:
* RTX 2080Ti (CUDA 10.2, TensorRT 7.0.0, Cudnn 7.6.5);
* Xavier AGX, Jetpack 4.3 (CUDA 10.0, CUDNN 7.6.3, tensorrt 6.0.1 );
| Platform | Test | Phase | FP32, ms | FP32, FPS | FP16, ms | FP16, FPS | INT8, ms | INT8, FPS |
| :------: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: | :-----: |
| RTX 2080Ti | shelfnet 1024x1024 (B=1) | pre | 6.11863 | 163.435 | 5.81465 | 171.979 | 5.88699 | 169.866 |
| RTX 2080Ti | shelfnet 1024x1024 (B=1) | inf | 11.5464 | 86.6074 | 7.35396 | 135.981 | 6.37623 | 156.832 |
| RTX 2080Ti | shelfnet 1024x1024 (B=1) | post | 4.09058 | 244.464 | 3.91961 | 255.128 | 4.07343 | 245.493 |
| RTX 2080Ti | shelfnet 1024x1024 (B=1) | tot | 21.7556 | 45.9652 | 17.0882 | 58.5199 | 16.3366 | 61.2121 |
| RTX 2080Ti | shelfnet 2048x2048 (B=4) | pre | 25.435 | 39.3158 | 25.2953 | 39.5331 | 25.9303 | 38.565 |
| RTX 2080Ti | shelfnet 2048x2048 (B=4) | inf | 36.5015 | 27.3961 | 17.0534 | 58.6395 | 15.6061 | 64.0773 |
| RTX 2080Ti | shelfnet 2048x2048 (B=4) | post | 17.3917 | 57.4985 | 17.1649 | 58.2583 | 17.5539 | 56.9675 |
| RTX 2080Ti | shelfnet 2048x2048 (B=4) | tot | 79.3283 | 12.6058 | 59.5136 | 16.8029 | 59.0903 | 16.9233 |
| AGX Xavier | shelfnet 1024x1024 (B=1) | pre | 8.0174 | 124.729 | 7.5117 | 133.126 | 7.47333 | 133.809 |
| AGX Xavier | shelfnet 1024x1024 (B=1) | inf | 72.4173 | 13.8089 | 37.505 | 26.6631 | 31.3286 | 31.9197 |
| AGX Xavier | shelfnet 1024x1024 (B=1) | post | 8.89958 | 112.365 | 8.83576 | 113.176 | 9.42655 | 106.083 |
| AGX Xavier | shelfnet 1024x1024 (B=1) | tot | 89.3342 | 11.1939 | 53.8525 | 18.5692 | 48.2285 | 20.7346 |
| AGX Xavier | shelfnet 2048x2048 (B=4) | pre | 47.1454 | 21.211 | 21.6475 | 46.1947 | 21.4201 | 46.6851 |
| AGX Xavier | shelfnet 2048x2048 (B=4) | inf | 266.537 | 3.75183 | 128.321 | 7.79293 | 107.621 | 9.29185 |
| AGX Xavier | shelfnet 2048x2048 (B=4) | post | 44.0711 | 22.6906 | 40.1732 | 24.8922 | 39.873 | 25.0796 |
| AGX Xavier | shelfnet 2048x2048 (B=4) | tot | 357.753 | 2.79522 | 190.142 | 5.25922 | 168.914 | 5.92016 |
## Known issues
When creating the rt file all the checks returns errors. It is due to a different resize function and handling of the original ShelfNet outputs.
However, the network is supposed to work.
+120
View File
@@ -0,0 +1,120 @@
# 2D Object Detection with tkDNN
## Supported Networks
* Yolo4, Yolo4-csp, Yolo4x, Yolo4_berkeley, Yolo4tiny
* Yolo3, Yolo3_berkeley, Yolo3_coco4, Yolo3_flir, Yolo3_512, Yolo3tiny, Yolo3tiny_512
* Yolo2, Yolo2_voc, Yolo2tiny
* Csresnext50-panet-spp, Csresnext50-panet-spp_berkeley
* Resnet101_cnet, Dla34_cnet
* Mobilenetv2ssd, Mobilenetv2ssd512, Bdd-mobilenetv2ssd
## Index
- [2D Object Detection](#2d-object-detection)
- [FP16 inference](#fp16-inference)
- [INT8 inference](#int8-inference)
- [Batching](#batching)
### 2D Object Detection
This is an example using yolov4.
To run the an object detection first create the .rt file by running:
```
rm yolo4_fp32.rt # be sure to delete(or move) old tensorRT files
./test_yolo4 # run the yolo test (is slow)
```
If you get problems in the creation, try to check the error activating the debug of TensorRT in this way:
```
cmake .. -DCMAKE_BUILD_TYPE=Debug -DDEBUG=True
make
```
Once you have successfully created your rt file, run the demo:
```
./ demo <path-to-config>
```
In general the demo program takes 1 parameter, the ```<path-to-config>``` that is the path to che configuration file. The parameter is optional and its default value is ```"../demo/demoConfig.yaml"```.
The config file is a yaml file with the following attributes:
* ```net``` is the rt file generated by a test
* ```input``` is the path to a video file or a camera input (on Linux)
* ```win_input``` is the path to a video file or a camera input (on Windows)
* ```ntype``` is the type of network. Thee types are currently supported: ```y``` (YOLO family), ```c``` (CenterNet family) and ```m``` (MobileNet-SSD family)
* ```n_classes``` is the number of classes the network is trained on
* ```n_batch``` number of batches to use in inference (N.B. you should first export TKDNN_BATCHSIZE to the required n_batches and create again the rt file for the network).
* ```conf_thresh``` confidence threshold for the detector. Only bounding boxes with threshold greater than conf-thresh will be displayed.
* ```show``` if set to 0 the demo will not show the visualization (if n-batches ==1)
* ```save``` if set to 1 the demo will save the video of the demo into result.mp4 (if n-batches ==1)
N.B. By default it is used FP32 inference
![demo](https://user-images.githubusercontent.com/11562617/72547657-540e7800-388d-11ea-83c6-49dfea2a0607.gif)
### FP16 inference
To run the demo with FP16 inference follow these steps (example with yolov3):
```
export TKDNN_MODE=FP16 # set the half floating point optimization
rm yolo4_fp16.rt # be sure to delete(or move) old tensorRT files
./test_yolo4 # run the yolo test (is slow)
#set net: yolo4_fp16.rt in the config file
./demo
```
N.B. Using FP16 inference will lead to some errors in the results (first or second decimal).
### INT8 inference
To run the demo with INT8 inference three environment variables need to be set:
* ```export TKDNN_MODE=INT8```: set the 8-bit integer optimization
* ```export TKDNN_CALIB_IMG_PATH=/path/to/calibration/image_list.txt``` : image_list.txt has in each line the absolute path to a calibration image
* ```export TKDNN_CALIB_LABEL_PATH=/path/to/calibration/label_list.txt```: label_list.txt has in each line the absolute path to a calibration label
You should provide image_list.txt and label_list.txt, using training images. However, if you want to quickly test the INT8 inference you can run (from this repo root folder)
```
bash scripts/download_validation.sh COCO
```
to automatically download COCO2017 validation (inside demo folder) and create those needed file. Use BDD instead of COCO to download BDD validation.
Then a complete example using yolo3 and COCO dataset would be:
```
export TKDNN_MODE=INT8
export TKDNN_CALIB_LABEL_PATH=../demo/COCO_val2017/all_labels.txt
export TKDNN_CALIB_IMG_PATH=../demo/COCO_val2017/all_images.txt
rm yolo4_int8.rt # be sure to delete(or move) old tensorRT files
./test_yolo4 # run the yolo test (is slow)
#set net: yolo4_int8.rt in the config file
./demo
```
N.B.
* Using INT8 inference will lead to some errors in the results.
* The test will be slower: this is due to the INT8 calibration, which may take some time to complete.
* INT8 calibration requires TensorRT version greater than or equal to 6.0
* Only 100 images are used to create the calibration table by default (set in the code).
### Batching
#### BatchSize bigger than 1
```
export TKDNN_BATCHSIZE=2
# build tensorRT files
```
This will create a TensorRT file with the desired **max** batch size.
The test will still run with a batch of 1, but the created tensorRT can manage the desired batch size.
#### Test batch Inference
This will test the network with random input and check if the output of each batch is the same.
```
./test_rtinference <network-rt-file> <number-of-batches>
# <number-of-batches> should be less or equal to the max batch size of the <network-rt-file>
# example
export TKDNN_BATCHSIZE=4 # set max batch size
rm yolo3_fp32.rt # be sure to delete(or move) old tensorRT files
./test_yolo3 # build RT file
./test_rtinference yolo3_fp32.rt 4 # test with a batch size of 4
```
+127
View File
@@ -0,0 +1,127 @@
# tkDNN export weights
## Index
- [How to export weights](#how-to-export-weights)
- [1)Export weights from darknet](#1export-weights-from-darknet)
- [2)Export weights for DLA34 and ResNet101](#2export-weights-for-dla34-and-resnet101)
- [3)Export weights for CenterNet](#3export-weights-for-centernet)
- [4)Export weights for MobileNetSSD](#4export-weights-for-mobilenetssd)
- [5)Export weights for CenterTrack](#5export-weights-for-centertrack)
- [6)Export weights for ShelfNet](#6export-weights-for-shelfnet)
- [Darknet Parser](#darknet-parser)
## How to export weights
Weights are essential for any network to run inference. For each test a folder organized as follow is needed (in the build folder):
```
test_nn
|---- layers/ (folder containing a binary file for each layer with the corresponding wieghts and bias)
|---- debug/ (folder containing a binary file for each layer with the corresponding outputs)
```
Therefore, once the weights have been exported, the folders layers and debug should be placed in the corresponding test.
### 1)Export weights from darknet
To export weights for NNs that are defined in darknet framework, use [this](https://git.hipert.unimore.it/fgatti/darknet.git) fork of darknet and follow these steps to obtain a correct debug and layers folder, ready for tkDNN.
```
git clone https://git.hipert.unimore.it/fgatti/darknet.git
cd darknet
make
mkdir layers debug
./darknet export <path-to-cfg-file> <path-to-weights> layers
```
N.B. Use compilation with CPU (leave GPU=0 in Makefile) if you also want debug.
### 2)Export weights for DLA34 and ResNet101
To get weights and outputs needed to run the tests dla34 and resnet101 use the Python script and the Anaconda environment included in the repository.
Create Anaconda environment and activate it:
```
conda env create -f file_name.yml
source activate env_name
python <script name>
```
### 3)Export weights for CenterNet
To get the weights needed to run Centernet tests use [this](https://github.com/sapienzadavide/CenterNet.git) fork of the original Centernet.
```
git clone https://github.com/sapienzadavide/CenterNet.git
```
* follow the instruction in the README.md and INSTALL.md
```
python demo.py --input_res 512 --arch resdcn_101 ctdet --demo /path/to/image/or/folder/or/video/or/webcam --load_model ../models/ctdet_coco_resdcn101.pth --exp_wo --exp_wo_dim 512
python demo.py --input_res 512 --arch dla_34 ctdet --demo /path/to/image/or/folder/or/video/or/webcam --load_model ../models/ctdet_coco_dla_2x.pth --exp_wo --exp_wo_dim 512
```
### 4)Export weights for MobileNetSSD
To get the weights needed to run Mobilenet tests use [this](https://github.com/mive93/pytorch-ssd) fork of a Pytorch implementation of SSD network.
```
git clone https://github.com/mive93/pytorch-ssd
cd pytorch-ssd
conda env create -f env_mobv2ssd.yml
python run_ssd_live_demo.py mb2-ssd-lite <pth-model-fil> <labels-file>
```
### 5)Export weights for CenterTrack
To get the weights needed to run CenterTrack tests use [this](https://github.com/sapienzadavide/CenterTrack.git) fork of the original CenterTrack.
```
git clone https://github.com/sapienzadavide/CenterTrack.git
```
* follow the instruction in the README.md and INSTALL.md
```
python demo.py tracking,ddd --load_model ../models/nuScenes_3Dtracking.pth --dataset nuscenes --pre_hm --track_thresh 0.1 --demo /path/to/image/or/folder/or/video/or/webcam --test_focal_length 633 --exp_wo --exp_wo_dim 512 --input_h 512 --input_w 512
```
### 6)Export weights for ShelfNet
To get the weights needed to run Shelfnet tests use [this](https://git.hipert.unimore.it/mverucchi/shelfnet) fork of a Pytorch implementation of Shelfnet network.
```
git clone https://git.hipert.unimore.it/mverucchi/shelfnet
cd shelfnet
cd ShelfNet18_realtime
conda env create --file shelfnet_env.yml
conda activate shelfnet
mkdir layer debug
python export.py
```
### 6)Export weights for monodepth2
To get the weights needed to run Shelfnet tests use [this](https://github.com/perseusdg/monodepth2) fork of a Pytorch implementation of monodepth2 network.
```
git clone https://github.com/perseusdg/monodepth2
cd monodepth2
mkdir models # Download the official weights and put depth.pth and encorder.pth inside this new folder
conda env create --file monodepth.yaml
conda activate monodepth2
python exporter.py # you will find the weights inside the tkDNN_bin folder
```
## Darknet Parser
tkDNN implement and easy parser for darknet cfg files, a network can be converted with *tk::dnn::darknetParser*:
```
// example of parsing yolo4
tk::dnn::Network *net = tk::dnn::darknetParser("yolov4.cfg", "yolov4/layers", "coco.names");
net->print();
```
All models from darknet are now parsed directly from cfg, you still need to export the weights with the described tools in the previous section.
<details>
<summary>Supported layers</summary>
convolutional
maxpool
avgpool
shortcut
upsample
route
reorg
region
yolo
</details>
<details>
<summary>Supported activations</summary>
relu
leaky
mish
logistic
</details>
+32
View File
@@ -0,0 +1,32 @@
# Run the mAP demo
To compute mAP, precision, recall and f1score to evaluate 2D object detectors, run the map_demo.
A validation set is needed.
To download COCO_val2017 (80 classes) run (form the root folder):
```
bash scripts/download_validation.sh COCO
```
To download Berkeley_val (10 classes) run (form the root folder):
```
bash scripts/download_validation.sh BDD
```
To compute the map, the following parameters are needed:
```
./map_demo <network rt> <network type [y|c|m]> <labels file path> <config file path>
```
where
* ```<network rt>```: rt file of a chosen network on which compute the mAP.
* ```<network type [y|c|m]>```: type of network. Right now only y(yolo), c(centernet) and m(mobilenet) are allowed
* ```<labels file path>```: path to a text file containing all the paths of the ground-truth labels. It is important that all the labels of the ground-truth are in a folder called 'labels'. In the folder containing the folder 'labels' there should be also a folder 'images', containing all the ground-truth images having the same same as the labels. To better understand, if there is a label path/to/labels/000001.txt there should be a corresponding image path/to/images/000001.jpg.
* ```<config file path>```: path to a yaml file with the parameters needed for the mAP computation, similar to demo/config.yaml
Example:
```
cd build
./map_demo dla34_cnet_FP32.rt c ../demo/COCO_val2017/all_labels.txt ../demo/config.yaml
```
This demo also creates a json file named ```net_name_COCO_res.json``` containing all the detections computed. The detections are in COCO format, the correct format to submit the results to [CodaLab COCO detection challenge](https://competitions.codalab.org/competitions/20794#participate).
+102
View File
@@ -0,0 +1,102 @@
# tkDNN on Windows
## Index
- [Dependencies-Windows](#dependencies-windows)
- [Compiling tkDNN on Windows](#compiling-tkdnn-on-windows)
- [Run the demo on Windows](#run-the-demo-on-windows)
- [FP16 inference windows](#fp16-inference-windows)
- [INT8 inference windows](#int8-inference-windows)
- [Run tkDNN on WSL2 with cuda](#tkdnn-on-cuda-wsl)
- [Known issues with tkDNN on Windows](#known-issues-with-tkdnn-on-windows)
### Dependencies-Windows
This branch should work on every NVIDIA GPU supported in windows with the following dependencies:
* WINDOWS 10 1803/WINDOWS 11 or HIGHER
* CUDA 11.2
* CUDNN 8.1.1
* TENSORRT 7.2.3
* OPENCV 4.2
* MSVC 16.9+
* YAML-CPP
* EIGEN3
* 7ZIP (ADD TO PATH)
* NINJA 1.10
All the above mentioned dependencies except 7ZIP can be installed using Microsoft's [VCPKG](https://github.com/microsoft/vcpkg.git) .
After bootstrapping VCPKG the dependencies can be built and installed using the following command :
```
opencv4(normal) - vcpkg.exe install opencv4[tbb,jpeg,tiff,opengl,openmp,png,ffmpeg,eigen]:x64-windows yaml-cpp:x64-windows eigen3:x64-windows --x-install-root=C:\opt --x-buildtrees-root=C:\temp_vcpkg_build
opencv4(cuda) - vcpkg.exe install opencv4[cuda,nonfree,contrib,eigen,tbb,jpeg,tiff,opengl,openmp,png,ffmpeg]:x64-windows yaml-cpp:x64-windows eigen3:x64-windows --x-install-root=C:\opt --x-buildtrees-root=C:\temp_vcpkg_build
```
To build opencv4 with cuda and cudnn version corresponding to your cuda version,vcpkg's cudnn portfile needs to be modified by adding ```$ENV{CUDA_PATH}``` at lines 16 and 17 in the portfile.cmake
After VCPKG finishes building and installing all the packages delete C:\temp_vcpkg_build and add C:\opt\x64-windows\bin and C:\opt\x64-windows\debug\bin to path
### Compiling tkDNN on Windows
tkDNN is built with cmake(3.15+) on windows along with ninja.Msbuild and NMake Makefiles are drastically slower when compiling the library compared to windows
```
git clone https://github.com/ceccocats/tkDNN.git
cd tkdnn-windows
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -G"Ninja" ..
ninja -j4
```
### Run the demo on Windows
This example uses yolo4_tiny.\
To run the object detection file create .rt file bu running:
```
.\test_yolo4tiny.exe
```
Once the rt file has been successfully create,run the demo using the following command:
```
.\demo.exe yolo4_fp32.rt ..\demo\yolo_test.mp4 y 80 ..\tests\darknet\cfg\yolo4.cfg ..\tests\darknet\names\cococ.names
```
For general info on more demo paramters,check Run the demo section on top
To run the test_all_tests.sh on windows,use git bash or msys2
### FP16 inference windows
This is an untested feature on windows.To run the object detection demo with FP16 interference follow the below steps(example with yolo4tiny):
```
set TKDNN_MODE=FP16
del /f yolo4tiny_fp16.rt
.\test_yolo4tiny.exe
.\demo.exe yolo4tiny_fp16.rt ..\demo\yolo_test.mp4
```
### INT8 inference windows
To run object detection demo with INT8 (example with yolo4tiny):
```
set TKDNN_MODE=INT8
set TKDNN_CALIB_LABEL_PATH=..\demo\COCO_val2017\all_labels.txt
set TKDNN_CALIB_IMG_PATH=..\demo\COCO_val2017\all_images.txt
del /f yolo4tiny_int8.rt # be sure to delete(or move) old tensorRT files
.\test_yolo4tiny.exe # run the yolo test (is slow)
.\demo.exe yolo4tiny_int8.rt ..\demo\yolo_test.mp4 y
```
### Run tkDNN on WSL2 with cuda
tkDNN works on wsl2 with cuda,although not all networks (centernet,mobilenet) work properly.
If you encounter issues with running the network as a result of driver not found or cuda launch error,running the following command should solve the issue
```cp /usr/lib/wsl/lib/lib* /usr/lib/x86_64-linux-gnu/ ```
### Known issues with tkDNN on Windows
In theory all models (centernet,mobilenet,darknet,centertrack,cnet3d and shelfnet) should work on Windows.
On pascal cards(sm 6x) ,nvidia cuda wsl driver 510.06 don't work well with tkDNN both on windows and cuda wsl , Nvidia drivers >465+ and < 500 are completely supported .
-44
View File
@@ -1,44 +0,0 @@
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <stdlib.h>
#include <cstring>
#include <cstdlib>
#include <time.h>
#include <chrono>
#include "cuda.h"
#include "cuda_runtime_api.h"
#include <cublas_v2.h>
#include <cudnn.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
//saliency
#include <opencv2/core/utility.hpp>
//#include <opencv2/saliency.hpp>
#include <opencv2/highgui.hpp>
#define SAVE false
#define SAVE_TO(name, fn, i, var) {sprintf(buf_frame_crop_name,name,fn,i);\
cv::imwrite(buf_frame_crop_name, var);}
// cv::Mat img_threshold(cv::Mat frame_crop);
// cv::Mat img_background(cv::Mat frame_crop);
// cv::Mat img_dist_transform(cv::Mat frame_crop);
// cv::Mat img_watershed(cv::Mat frame_crop);
void image_segmentation(cv::Mat frame_crop, int frame_nbr, int i);
void image_gradients(cv::Mat frame_crop, int frame_nbr, int i);
void image_find_contours(cv::Mat frame_crop, int frame_nbr, int i);
void image_saliency(cv::Mat frame_crop, int frame_nbr, int i);
void frame_box_disparity(cv::Mat pre_frame, cv::Mat frame, std::vector <cv::Rect> pre_rois, int frame_nbr);
void segmentation(cv::Mat pre_frame, cv::Mat frame_crop, int frame_nbr, int i, int mode);
//canny
cv::Mat img_laplacian(cv::Mat frame_crop, int ret);
cv::Mat frame_disparity(cv::Mat pre_frame, cv::Mat frame, int frame_nbr, int i, int ret);
-32
View File
@@ -1,32 +0,0 @@
#ifndef CALIBRATION_H
#define CALIBRATION_H
#include "gdal.h"
#include <gdal_priv.h>
#include <gdal/gdal.h>
#include "gdal/gdal_priv.h"
#include "gdal/cpl_conv.h"
#include <yaml-cpp/yaml.h>
#include <opencv2/calib3d.hpp>
#include <opencv2/core.hpp>
#include <iostream>
#include <cstring>
struct ObjCoords
{
double lat_;
double long_;
int class_;
};
void readTiff(char *filename, double *adfGeoTransform);
void readCameraCalibrationYaml(const std::string &cameraCalib, cv::Mat &cameraMat, cv::Mat &distCoeff);
void pixel2coord(int x, int y, double &lat, double &lon, double *adfGeoTransform);
void coord2pixel(double lat, double lon, int &x, int &y, double *adfGeoTransform);
void fillMatrix(cv::Mat &H, double *matrix, bool show = false);
void read_projection_matrix(cv::Mat &H, char *path);
void convert_coords(std::vector<ObjCoords> &coords, int x, int y, int detected_class, cv::Mat H, double *adfGeoTransform);
#endif /*CALIBRATION_H*/
-45
View File
@@ -1,45 +0,0 @@
#ifndef CAMERAUTILS_H
#define CAMERAUTILS_H
#include <vector>
#include <mutex>
#include <opencv2/core/core.hpp>
#include "tracker.h"
#include "Yolo3Detection.h"
struct Camera_t
{
int CAM_IDX;
char *input;
char *pmatrix;
char *maskfile;
char *cameraCalib;
char *maskFileOrient;
bool to_show;
tk::dnn::Yolo3Detection *yolo;
double adfGeoTransform[6];
};
struct Frame_t
{
char *input;
cv::Mat frame;
int frame_nbr;
// sem_vc for mainthread, videocapturethread, originalthread and disparitythread
std::mutex sem_vc;
};
struct ModFrame_t
{
std::vector<Tracker> trackers;
geodetic_converter::GeodeticConverter gc;
double adfGeoTransform[6];
cv::Mat H;
cv::Mat original_frame;
tk::dnn::Yolo3Detection yolo;
cv::Mat mask;
// sem for mainthread, detectionthread and topviewthread
std::mutex sem;
};
#endif /*CAMERAUTILS_H*/

Some files were not shown because too many files have changed in this diff Show More