Skip to content

Commit

Permalink
devcontainer: Downgrade tensorrt
Browse files Browse the repository at this point in the history
  • Loading branch information
marcojob committed Nov 5, 2024
1 parent fa8d35e commit 4c03a36
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
10 changes: 5 additions & 5 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"]
ENTRYPOINT ["/bin/bash"]
2 changes: 1 addition & 1 deletion .devcontainer/build_and_push_images.sh
Original file line number Diff line number Diff line change
@@ -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 .
30 changes: 15 additions & 15 deletions src/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions src/usb_cam_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Raft>("resources/raft.onnx", 240, 320));
// networks.push_back(std::make_unique<Raft>("resources/raft.onnx", 240, 320));

// Advertise the main image topic
image_transport::ImageTransport it(m_node);
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 4c03a36

Please sign in to comment.