add dockerfile trt8_cuda11 (#1010)

* add dockerfile trt8_cuda11

* update docker readme
This commit is contained in:
haku 2022-06-11 11:51:41 +08:00 committed by GitHub
parent 6636cc26fd
commit e418cb9e66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 0 deletions

4
docker/trt8/Dockerfile Normal file
View File

@ -0,0 +1,4 @@
ARG TENSORRT="8"
ARG CUDA="11"
FROM hakuyyf/tensorrtx:trt${TENSORRT}_cuda${CUDA}

30
docker/trt8/README.md Normal file
View File

@ -0,0 +1,30 @@
# Tutorials
## Pull docker image And build opencv with dnn module from source
- docker pull hakuyyf/tensorrtx:trt8_cuda11
- sudo docker run -it --name={yourname} --gpus all --privileged --net=host --ipc=host --pid=host -v {localpath}:{dockerpath} hakuyyf/tensorrtx:trt8_cuda11 /bin/bash
- docker start {container_id}
- docker attach {container_id}
- apt update
- cd /home
- git clone https://github.com/opencv/opencv.git
- git clone https://github.com/opencv/opencv_contrib.git
- cd opencv
- git checkout 4.5.5
- cd ../
- cd opencv_contrib
- git checkout 4.5.5
- cd ../
- cd opencv
- mkdir build && cd build
- cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF -D OPENCV_ENABLE_NONFREE=ON -D WITH_CUDA=ON -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D CUDA_ARCH_BIN={[Your GPU Compute Capability](https://developer.nvidia.com/zh-cn/cuda-gpus#compute)} -D WITH_CUBLAS=1 -D OPENCV_EXTRA_MODULES_PATH=/home/opencv_contrib/modules/ -D HAVE_opencv_python3=ON -D PYTHON_EXECUTABLE=/usr/bin/python3 -D BUILD_EXAMPLES=ON ..
- make -j
- make install
- ldconfig
- ln -s /usr/local/lib/python3.8/site-packages/cv2/python-3.8/cv2.cpython-38-x86_64-linux-gnu.so /usr/lib/python3.8/cv2.so
## Test
- cd /home
- python3 -c "import cv2; print(cv2.__version__)"
- git clone https://github.com/wang-xinyu/tensorrtx.git