From 4c03a36ee9ad37f1136b4f88c7d7893211f31c4f Mon Sep 17 00:00:00 2001 From: marcojob <44396071+marcojob@users.noreply.github.com> Date: Mon, 4 Nov 2024 17:35:42 +0100 Subject: [PATCH] devcontainer: Downgrade tensorrt --- .devcontainer/Dockerfile | 10 ++++----- .devcontainer/build_and_push_images.sh | 2 +- src/interface.cpp | 30 +++++++++++++------------- src/usb_cam_node.cpp | 14 ++++++------ 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 3140129a..ba7d683e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -30,9 +30,10 @@ RUN echo 'export PATH=$PATH:/usr/local/cuda/bin' >> /home/asl/.bash_aliases && \ echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64' >> /home/asl/.bash_aliases # TensorRT: Install from .deb file -COPY resources/nv-tensorrt-local-repo-ubuntu2004-10.6.0-cuda-12.6_1.0-1_amd64.deb /tmp/tensorrt.deb -RUN sudo dpkg -i /tmp/tensorrt.deb || sudo apt-get install -f -y -RUN sudo cp /var/nv-tensorrt-local-repo-ubuntu2004-10.6.0-cuda-12.6/*-keyring.gpg /usr/share/keyrings/ && sudo apt update && sudo apt install -y tensorrt +COPY resources/nv-tensorrt-repo-ubuntu2004-cuda11.6-trt8.4.3.1-ga-20220813_1-1_amd64.deb /tmp/ +RUN sudo dpkg -i /tmp/resources/nv-tensorrt-repo-ubuntu2004-cuda11.6-trt8.4.3.1-ga-20220813_1-1_amd64.deb || sudo apt-get install -f -y +# RUN sudo cp /var/nv-tensorrt-repo-ubuntu2004-cuda11.6-trt8.4.3.1-ga-20220813/*-keyring.gpg /usr/share/keyrings/ && sudo apt update && sudo apt install -y tensorrt +RUN sudo apt update && sudo apt install -y tensorrt # OpenCV Build Stage FROM base AS opencv_build @@ -63,5 +64,4 @@ USER root # Clean up RUN rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* /var/cache/apt/archives/* - -ENTRYPOINT ["/bin/bash"] \ No newline at end of file +ENTRYPOINT ["/bin/bash"] diff --git a/.devcontainer/build_and_push_images.sh b/.devcontainer/build_and_push_images.sh index 35ec1b1f..9cc14abd 100755 --- a/.devcontainer/build_and_push_images.sh +++ b/.devcontainer/build_and_push_images.sh @@ -1 +1 @@ -docker buildx build -t omavteam/v4l2_camera:latest -f .devcontainer/Dockerfile --push . +docker buildx build --tag omavteam/v4l2_camera:latest -f .devcontainer/Dockerfile --push . diff --git a/src/interface.cpp b/src/interface.cpp index 6c93eca3..1a402f48 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -30,23 +30,23 @@ void LearningInterface::load_model() { // Allocate buffers for input and output size_t input_size; size_t output_size; - for (int io = 0; io < _engine->getNbIOTensors(); io++) { - const char* name = _engine->getIOTensorName(io); - std::cout << io << ": " << name; - const nvinfer1::Dims dims = _engine->getTensorShape(name); + // for (int io = 0; io < _engine->getNbIOTensors(); io++) { + // const char* name = _engine->getIOTensorName(io); + // std::cout << io << ": " << name; + // const nvinfer1::Dims dims = _engine->getTensorShape(name); - size_t total_dims = 1; - for (int d = 0; d < dims.nbDims; d++) { - total_dims *= dims.d[d]; - } + // size_t total_dims = 1; + // for (int d = 0; d < dims.nbDims; d++) { + // total_dims *= dims.d[d]; + // } - std::cout << " size: " << total_dims << std::endl; - if (io == 0) { - input_size = total_dims * sizeof(float); - } else if (io == 1) { - output_size = total_dims * sizeof(float); - } - } + // std::cout << " size: " << total_dims << std::endl; + // if (io == 0) { + // input_size = total_dims * sizeof(float); + // } else if (io == 1) { + // output_size = total_dims * sizeof(float); + // } + // } // Allocate device buffers cudaMalloc(&_buffers[0], input_size); diff --git a/src/usb_cam_node.cpp b/src/usb_cam_node.cpp index de1d0761..388fa13b 100644 --- a/src/usb_cam_node.cpp +++ b/src/usb_cam_node.cpp @@ -72,7 +72,7 @@ class UsbCamNode { UsbCamNode() : m_node("~") { // Setup the network that outputs derivates of the image captured - networks.push_back(std::make_unique("resources/raft.onnx", 240, 320)); + // networks.push_back(std::make_unique("resources/raft.onnx", 240, 320)); // Advertise the main image topic image_transport::ImageTransport it(m_node); @@ -177,12 +177,12 @@ class UsbCamNode { m_image_pub.publish(m_image, *ci); // Run all the networks - for (const auto& net : networks) { - net->set_input(m_image.data.data(), 1920, 1200); - if (net->run_inference(1)) { - net->publish(); - } - } + // for (const auto& net : networks) { + // net->set_input(m_image.data.data(), 1920, 1200); + // if (net->run_inference(1)) { + // net->publish(); + // } + // } return true; }