diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..033d048 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,31 @@ +{ + "name": "object-detection-inference", + // Use the image property instead of dockerFile + "image": "object-detection-inference:tensorrt", // Replace with your image name and tag + + "features": { + "ghcr.io/devcontainers/features/nvidia-cuda:1": {} + }, + + "overrideCommand": true, + "runArgs": [ + "--gpus", "all" + ], + "postCreateCommand": "bash", + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools", + "kaysonwu.cpptask", + "ms-vscode.cpptools-extension-pack", + "franneck94.c-cpp-runner", + "DamianKoper.gdb-debug" + ] + } + } // Or your desired entrypoint command + + // OR: Run a specific command. Example: run your app with arguments + // "overrideCommand": true, + // "command": ["./object-detection-inference", "-m", "your_model.engine", "-i", "your_input.mp4"] +} + diff --git a/cmake/AddCompileDefinitions.cmake b/cmake/AddCompileDefinitions.cmake index a3618b7..3bba0d4 100644 --- a/cmake/AddCompileDefinitions.cmake +++ b/cmake/AddCompileDefinitions.cmake @@ -25,7 +25,7 @@ elseif (DEFAULT_BACKEND STREQUAL "LIBTORCH") # Tell the compiler to use glog instead of the default c10 logging system by defining C10_USE_GLOG add_definitions(-DC10_USE_GLOG) elseif (DEFAULT_BACKEND STREQUAL "TENSORRT") - set(TRT_VERSION "8.6.1.6" CACHE STRING "Tensorrt version") # modify accordingly + set(TRT_VERSION "10.7.0.23" CACHE STRING "Tensorrt version") # modify accordingly set(TENSORRT_DIR $ENV{HOME}/TensorRT-${TRT_VERSION}/) message(STATUS "TENSORRT_DIR: ${TENSORRT_DIR}") find_package(CUDA REQUIRED) diff --git a/detectors/src/DetectorSetup.cpp b/detectors/src/DetectorSetup.cpp index 1a3d358..865d06a 100644 --- a/detectors/src/DetectorSetup.cpp +++ b/detectors/src/DetectorSetup.cpp @@ -12,6 +12,7 @@ std::unique_ptr DetectorSetup::createDetector(const std::string& detec auto it = detectorCreators.find(detectorType); if (it != detectorCreators.end()) { + LOG(INFO) << "Creating detector '" << detectorType << "'"; return it->second(); } else { LOG(ERROR) << "Unknown detector type '" << detectorType << "' requested. Available types are: "; diff --git a/detectors/src/models/Detector.hpp b/detectors/src/models/Detector.hpp index f852bcd..43b4a12 100644 --- a/detectors/src/models/Detector.hpp +++ b/detectors/src/models/Detector.hpp @@ -28,8 +28,14 @@ class Detector { channels_ = static_cast(first_input[0]); network_height_ = static_cast(first_input[1]); network_width_ = static_cast(first_input[2]); - } else { - LOG(ERROR) << "Input shape does not match expected format (CHW)"; + LOG(INFO) << "Sizes: " << channels_ << " " << network_width_ << " " << network_height_; + } + else { + LOG(ERROR) << "Input shape does not match expected format (CHW), Found " << first_input.size() << " inputs: "; + for(auto& s : first_input) + LOG(ERROR) << s; + throw std::runtime_error("Input shape does not match expected format "); + } } else { LOG(ERROR) << "No input layers found in model"; diff --git a/download_trt.sh b/download_trt.sh new file mode 100644 index 0000000..1c2c426 --- /dev/null +++ b/download_trt.sh @@ -0,0 +1,12 @@ +#!/bin/bash +TRT_MAJOR=10 +TRT_MINOR=.7 +TRT_PATCH=.0 +TRT_BUILD=.23 +TRT_VERSION=${TRT_MAJOR}${TRT_MINOR}${TRT_PATCH}${TRT_BUILD} +TRT_CUDA_VERSION=12.6 +#wget https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/${TRT_MAJOR}${TRT_MINOR}${TRT_PATCH}/tars/TensorRT-${TRT_VERSION}.Linux.x86_64-gnu.cuda-${TRT_CUDA_VERSION}.tar.gz + +tar -xvf TensorRT-${TRT_VERSION}.Linux.x86_64-gnu.cuda-${TRT_CUDA_VERSION}.tar.gz + +mv TensorRT-${TRT_VERSION} $HOME/TensorRT-${TRT_VERSION} \ No newline at end of file