A high-performance C++ headers for real-time object detection using YOLO models, leveraging ONNX Runtime and OpenCV for seamless integration. Supports multiple YOLO versions (v5, v7, v8, v10, v11) with optimized inference on CPU and GPU. Includes sample code, scripts for image, video, and live camera inference, and tools for quantization.
307
stars
28
forks
source link
Compilation error: 'clamp' is not a member of 'std' #5
std::clamp has been available since the C++17 standard, but it is claimed in your README that the code is compatible with C++14, and in CMakeLists.txt, you have defined set(CMAKE_CXX_STANDARD 14).
Compilation output
Build Code ...
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- ONNXRUNTIME_DIR: /home/xue/yolo_relative_pose/YOLOs-CPP/onnxruntime-linux-x64-1.19.2
-- Found OpenCV: /usr (found version "4.2.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xue/yolo_relative_pose/YOLOs-CPP/build
Scanning dependencies of target video_inference
[ 16%] Building CXX object CMakeFiles/video_inference.dir/src/video_inference.cpp.o
In file included from /home/xue/yolo_relative_pose/YOLOs-CPP/src/video_inference.cpp:54:
/home/xue/yolo_relative_pose/YOLOs-CPP/include/YOLO11.hpp: In function ‘BoundingBox utils::scaleCoords(const Size&, BoundingBox, const Size&, bool)’:
/home/xue/yolo_relative_pose/YOLOs-CPP/include/YOLO11.hpp:244:29: error: ‘clamp’ is not a member of ‘std’
244 | result.x = std::clamp(result.x, 0, imageOriginalShape.width);
| ^~~~~
/home/xue/yolo_relative_pose/YOLOs-CPP/include/YOLO11.hpp:245:29: error: ‘clamp’ is not a member of ‘std’
245 | result.y = std::clamp(result.y, 0, imageOriginalShape.height);
| ^~~~~
/home/xue/yolo_relative_pose/YOLOs-CPP/include/YOLO11.hpp:246:33: error: ‘clamp’ is not a member of ‘std’
246 | result.width = std::clamp(result.width, 0, imageOriginalShape.width - result.x);
| ^~~~~
/home/xue/yolo_relative_pose/YOLOs-CPP/include/YOLO11.hpp:247:34: error: ‘clamp’ is not a member of ‘std’
247 | result.height = std::clamp(result.height, 0, imageOriginalShape.height - result.y);
| ^~~~~
make[2]: *** [CMakeFiles/video_inference.dir/build.make:63: CMakeFiles/video_inference.dir/src/video_inference.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:80: CMakeFiles/video_inference.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
std::clamp
has been available since the C++17 standard, but it is claimed in yourREADME
that the code is compatible with C++14, and in CMakeLists.txt, you have defined set(CMAKE_CXX_STANDARD 14).Compilation output