Update README.md,windows.md and demo.cpp
Small fixes in DeformableConvRT.cpp
This commit is contained in:
+11
-5
@@ -3,10 +3,12 @@ project(tkDNN)
|
|||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
|
||||||
|
option(ENABLE_OPENCV_CUDA_CONTRIB "Enable OpenCV CUDA Contrib" OFF )
|
||||||
|
|
||||||
find_package(CUDA 9.0 REQUIRED)
|
find_package(CUDA 9.0 REQUIRED)
|
||||||
if (CUDA_FOUND)
|
if (CUDA_FOUND)
|
||||||
#Get CUDA compute capability
|
|
||||||
set(OUTPUTFILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cuda_script) # No suffix required
|
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)
|
set(CUDAFILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/getCudaArch.cu)
|
||||||
execute_process(COMMAND ${CUDA_NVCC_EXECUTABLE} -lcuda ${CUDAFILE} -o ${OUTPUTFILE})
|
execute_process(COMMAND ${CUDA_NVCC_EXECUTABLE} -lcuda ${CUDAFILE} -o ${OUTPUTFILE})
|
||||||
execute_process(COMMAND ${OUTPUTFILE}
|
execute_process(COMMAND ${OUTPUTFILE}
|
||||||
@@ -25,10 +27,7 @@ if (CUDA_FOUND)
|
|||||||
message(STATUS "CUDA Path: ${CUDA_TOOLKIT_ROOT_DIR}")
|
message(STATUS "CUDA Path: ${CUDA_TOOLKIT_ROOT_DIR}")
|
||||||
message(STATUS "CUDA Libararies: ${CUDA_LIBRARIES}")
|
message(STATUS "CUDA Libararies: ${CUDA_LIBRARIES}")
|
||||||
message(STATUS "CUDA Performance Primitives: ${CUDA_npp_LIBRARY}")
|
message(STATUS "CUDA Performance Primitives: ${CUDA_npp_LIBRARY}")
|
||||||
|
|
||||||
set(CUDA_NVCC_FLAGS "${ARCH}")
|
set(CUDA_NVCC_FLAGS "${ARCH}")
|
||||||
add_definitions(-DGPU) #You may not require this
|
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(WARNING ${ARCH})
|
message(WARNING ${ARCH})
|
||||||
endif()
|
endif()
|
||||||
@@ -51,7 +50,7 @@ endif()
|
|||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(CMAKE_BUILD_TYPE MATCHES Release)
|
if(CMAKE_BUILD_TYPE MATCHES Release)
|
||||||
set(CMAKE_CXX_FLAGS "/O2 /FS /EHsc /Md")
|
set(CMAKE_CXX_FLAGS "/O2 /FS /EHsc /MD")
|
||||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --maxrregcount=32)
|
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --maxrregcount=32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -105,6 +104,13 @@ include_directories(${EIGEN3_INCLUDE_DIR})
|
|||||||
|
|
||||||
find_package(OpenCV REQUIRED)
|
find_package(OpenCV REQUIRED)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOPENCV")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOPENCV")
|
||||||
|
if(ENABLE_OPENCV_CUDA_CONTRIB)
|
||||||
|
if (OpenCV_FOUND)
|
||||||
|
find_package(OpenCV COMPONENTS cudawarping cudaarithm)
|
||||||
|
add_compile_definitions(OPENCV_CUDACONTRIB)
|
||||||
|
message("OpenCV Cuda Contrib modules found")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
# if(OpenCV_CUDA_VERSION)
|
# if(OpenCV_CUDA_VERSION)
|
||||||
# add_compile_definitions(OPENCV_CUDACONTRIB)
|
# add_compile_definitions(OPENCV_CUDACONTRIB)
|
||||||
# endif()
|
# endif()
|
||||||
|
|||||||
@@ -105,13 +105,14 @@ When using openCV not compiled with contrib, comment the definition of OPENCV_CU
|
|||||||
|
|
||||||
## How to compile this repo
|
## How to compile this repo
|
||||||
Build with cmake. If using Ubuntu 18.04 a new version of cmake is needed (3.15 or above).
|
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
|
git clone https://github.com/ceccocats/tkDNN
|
||||||
cd tkDNN
|
cd tkDNN
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake ..
|
cmake -DCMAKE_BUILD_TYPE=Release -G"Ninja" ..
|
||||||
make
|
ninja
|
||||||
```
|
```
|
||||||
|
|
||||||
## Workflow
|
## Workflow
|
||||||
@@ -136,7 +137,7 @@ For specific details on how to run:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
## tkDNN on Windows 10 (experimental)
|
## tkDNN on Windows 10/11 (experimental)
|
||||||
|
|
||||||
For specific details on how to run tkDNN on Windows 10 see [HERE](./docs/windows.md).
|
For specific details on how to run tkDNN on Windows 10 see [HERE](./docs/windows.md).
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -45,16 +45,16 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
char ntype = 'y';
|
char ntype = 'y';
|
||||||
if(argc > 2)
|
if(argc > 2)
|
||||||
ntype = argv[2][0];
|
input = argv[2];
|
||||||
int n_classes = 80;
|
|
||||||
if(argc > 3)
|
if(argc > 3)
|
||||||
n_classes = atoi(argv[3]);
|
ntype = argv[3][0];
|
||||||
|
int n_classes = 80;
|
||||||
if(argc > 4)
|
if(argc > 4)
|
||||||
cfgPath = argv[4];
|
n_classes = atoi(argv[4]);
|
||||||
if(argc > 5)
|
if(argc > 5)
|
||||||
namePath = argv[5];
|
cfgPath = argv[5];
|
||||||
if(argc > 6)
|
if(argc > 6)
|
||||||
input = argv[6];
|
namePath = argv[6];
|
||||||
int n_batch = 1;
|
int n_batch = 1;
|
||||||
if(argc > 7)
|
if(argc > 7)
|
||||||
n_batch = atoi(argv[7]);
|
n_batch = atoi(argv[7]);
|
||||||
|
|||||||
+12
-4
@@ -26,17 +26,23 @@ rm yolo4_fp32.rt # be sure to delete(or move) old tensorRT files
|
|||||||
```
|
```
|
||||||
If you get problems in the creation, try to check the error activating the debug of TensorRT in this way:
|
If you get problems in the creation, try to check the error activating the debug of TensorRT in this way:
|
||||||
```
|
```
|
||||||
cmake .. -DDEBUG=True
|
cmake .. -DCMAKE_BUILD_TYPE=Debug -DDEBUG=True
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
Once you have successfully created your rt file, run the demo:
|
Once you have successfully created your rt file, run the demo(yolo) :
|
||||||
```
|
```
|
||||||
./demo yolo4_fp32.rt ../demo/yolo_test.mp4 y
|
./demo yolo4_fp32.rt ../demo/yolo_test.mp4 y 80 ../tests/darknet/cfg/yolo4.cfg ../tests/darknet/names/cococ.names
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To run demo for mobilenet and centernet for the created rt file :
|
||||||
|
```
|
||||||
|
./demo mobilenetv2ssd_fp32.rt m 20
|
||||||
|
```
|
||||||
|
|
||||||
In general the demo program takes 7 parameters:
|
In general the demo program takes 7 parameters:
|
||||||
```
|
```
|
||||||
./demo <network-rt-file> <path-to-video> <kind-of-network> <number-of-classes> <n-batches> <show-flag> <conf-thresh>
|
./demo <network-rt-file> <path-to-video> <kind-of-network> <number-of-classes> <cfg-path> <name-path> <n-batches> <show-flag> <conf-thresh>
|
||||||
```
|
```
|
||||||
where
|
where
|
||||||
|
|
||||||
@@ -44,6 +50,8 @@ where
|
|||||||
* ```<<path-to-video>``` is the path to a video file or a camera input
|
* ```<<path-to-video>``` is the path to a video file or a camera input
|
||||||
* ```<kind-of-network>``` is the type of network. Thee types are currently supported: ```y``` (YOLO family), ```c``` (CenterNet family) and ```m``` (MobileNet-SSD family)
|
* ```<kind-of-network>``` is the type of network. Thee types are currently supported: ```y``` (YOLO family), ```c``` (CenterNet family) and ```m``` (MobileNet-SSD family)
|
||||||
* ```<number-of-classes>```is the number of classes the network is trained on
|
* ```<number-of-classes>```is the number of classes the network is trained on
|
||||||
|
* ```<cfg-path> ```is the relative path to the config file (only for darknet based networks) used to train the network
|
||||||
|
* ```<name-path>```is the relative path to the names file (only for darknet based networks) used to train the network
|
||||||
* ```<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).
|
* ```<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).
|
||||||
* ```<show-flag>``` if set to 0 the demo will not show the visualization but save the video into result.mp4 (if n-batches ==1)
|
* ```<show-flag>``` if set to 0 the demo will not show the visualization but save the video into result.mp4 (if n-batches ==1)
|
||||||
* ```<conf-thresh>``` confidence threshold for the detector. Only bounding boxes with threshold greater than conf-thresh will be displayed.
|
* ```<conf-thresh>``` confidence threshold for the detector. Only bounding boxes with threshold greater than conf-thresh will be displayed.
|
||||||
|
|||||||
+16
-9
@@ -7,17 +7,18 @@
|
|||||||
- [Run the demo on Windows](#run-the-demo-on-windows)
|
- [Run the demo on Windows](#run-the-demo-on-windows)
|
||||||
- [FP16 inference windows](#fp16-inference-windows)
|
- [FP16 inference windows](#fp16-inference-windows)
|
||||||
- [INT8 inference windows](#int8-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)
|
- [Known issues with tkDNN on Windows](#known-issues-with-tkdnn-on-windows)
|
||||||
|
|
||||||
### Dependencies-Windows
|
### Dependencies-Windows
|
||||||
This branch should work on every NVIDIA GPU supported in windows with the following dependencies:
|
This branch should work on every NVIDIA GPU supported in windows with the following dependencies:
|
||||||
|
|
||||||
* WINDOWS 10 1803 or HIGHER
|
* WINDOWS 10 1803 or HIGHER
|
||||||
* CUDA 10.0 (Recommended CUDA 11.2 )
|
* CUDA 11.2
|
||||||
* CUDNN 7.6 (Recommended CUDNN 8.1.1 )
|
* CUDNN 8.1.1
|
||||||
* TENSORRT 6.0.1 (Recommended TENSORRT 7.2.3.4 )
|
* TENSORRT 7.2.3
|
||||||
* OPENCV 3.4 (Recommended OPENCV 4.2.0 )
|
* OPENCV 4.2
|
||||||
* MSVC 16.7
|
* MSVC 16.9+
|
||||||
* YAML-CPP
|
* YAML-CPP
|
||||||
* EIGEN3
|
* EIGEN3
|
||||||
* 7ZIP (ADD TO PATH)
|
* 7ZIP (ADD TO PATH)
|
||||||
@@ -58,7 +59,7 @@ To run the object detection file create .rt file bu running:
|
|||||||
|
|
||||||
Once the rt file has been successfully create,run the demo using the following command:
|
Once the rt file has been successfully create,run the demo using the following command:
|
||||||
```
|
```
|
||||||
.\demo.exe yolo4tiny_fp32.rt ..\demo\yolo_test.mp4 y
|
.\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
|
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
|
To run the test_all_tests.sh on windows,use git bash or msys2
|
||||||
@@ -85,11 +86,17 @@ del /f yolo4tiny_int8.rt # be sure to delete(or move) old tensorRT files
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 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
|
### Known issues with tkDNN on Windows
|
||||||
|
|
||||||
Mobilenet and Centernet demos work properly only when built with msvc 16.7 in Release Mode,when built in debug mode for the mentioned networks one might encounter opencv assert errors
|
In theory all models (centernet,mobilenet,darknet,centertrack,cnet3d and shelfnet) should work on Windows.
|
||||||
|
|
||||||
All Darknet models work properly with demo using MSVC version(16.7-16.9)
|
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 .
|
||||||
|
|
||||||
It is recommended to use Nvidia Driver(465+),Cuda unknown errors have been observed when using older drivers on pascal(SM 61) devices.
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ DeformableConvRT::~DeformableConvRT() {
|
|||||||
checkCuda( cudaFree(offset) );
|
checkCuda( cudaFree(offset) );
|
||||||
checkCuda( cudaFree(mask) );
|
checkCuda( cudaFree(mask) );
|
||||||
checkCuda( cudaFree(ones_d2) );
|
checkCuda( cudaFree(ones_d2) );
|
||||||
cublasDestroy(handle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DeformableConvRT::DeformableConvRT(const void *data, size_t length) {
|
DeformableConvRT::DeformableConvRT(const void *data, size_t length) {
|
||||||
@@ -229,7 +228,9 @@ void DeformableConvRT::serialize(void *buffer) const NOEXCEPT {
|
|||||||
assert(buf == a + getSerializationSize());
|
assert(buf == a + getSerializationSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeformableConvRT::destroy() NOEXCEPT { delete this; }
|
void DeformableConvRT::destroy() NOEXCEPT {
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *DeformableConvRT::getPluginNamespace() const NOEXCEPT {
|
const char *DeformableConvRT::getPluginNamespace() const NOEXCEPT {
|
||||||
|
|||||||
Reference in New Issue
Block a user