Some mixed cleanups.

This commit is contained in:
Daniel
2025-02-28 14:01:12 +01:00
parent 1d259846fc
commit 2e1d401dd4
8 changed files with 23 additions and 67 deletions

View File

@ -16,6 +16,7 @@ Fast triangulation of multiple persons from multiple camera views.
## Build ## Build
- Clone this project with submodules: - Clone this project with submodules:
```bash ```bash
git clone --recurse-submodules https://gitlab.com/Percipiote/RapidPoseTriangulation.git git clone --recurse-submodules https://gitlab.com/Percipiote/RapidPoseTriangulation.git
cd RapidPoseTriangulation/ cd RapidPoseTriangulation/
@ -40,17 +41,19 @@ Fast triangulation of multiple persons from multiple camera views.
- Restart docker: `sudo systemctl restart docker` - Restart docker: `sudo systemctl restart docker`
- Build docker container: - Build docker container:
```bash ```bash
docker build --progress=plain -t rapidposetriangulation . docker build --progress=plain -t rapidposetriangulation .
./run_container.sh ./run_container.sh
``` ```
- Build triangulator: - Build triangulator:
```bash ```bash
cd /RapidPoseTriangulation/swig/ && make all && cd ../tests/ && python3 test_interface.py && cd .. cd /RapidPoseTriangulation/swig/ && make all && cd ../tests/ && python3 test_interface.py && cd ..
cd /RapidPoseTriangulation/scripts/ && \ cd /RapidPoseTriangulation/scripts/ && \
g++ -std=c++2a -fPIC -O3 -march=native -Wall -Werror -flto=auto -fopenmp -fopenmp-simd \ g++ -std=c++2a -fPIC -O3 -march=native -Wall -Werror -flto=auto \
-I /RapidPoseTriangulation/rpt/ \ -I /RapidPoseTriangulation/rpt/ \
-isystem /usr/include/opencv4/ \ -isystem /usr/include/opencv4/ \
-isystem /onnxruntime/include/ \ -isystem /onnxruntime/include/ \
@ -72,11 +75,13 @@ Fast triangulation of multiple persons from multiple camera views.
``` ```
- Test with samples: - Test with samples:
```bash ```bash
python3 /RapidPoseTriangulation/scripts/test_triangulate.py python3 /RapidPoseTriangulation/scripts/test_triangulate.py
``` ```
- Test with _skelda_ dataset: - Test with _skelda_ dataset:
```bash ```bash
export CUDA_VISIBLE_DEVICES=0 export CUDA_VISIBLE_DEVICES=0
python3 /RapidPoseTriangulation/scripts/test_skelda_dataset.py python3 /RapidPoseTriangulation/scripts/test_skelda_dataset.py

View File

@ -1,6 +1,6 @@
# Test ONNX with EasyPose # Test ONNX with EasyPose
Code files originally from: https://github.com/Dominic23331/EasyPose.git Code files originally from: <https://github.com/Dominic23331/EasyPose.git>
<br> <br>

View File

@ -8,7 +8,7 @@ Tested with a _Jetson AGX Orin Developer Kit_ module.
## Base installation ## Base installation
- Install newest software image: \ - Install newest software image: \
(https://developer.nvidia.com/sdk-manager) (<https://developer.nvidia.com/sdk-manager>)
- Use manual recovery mode setup for first installation - Use manual recovery mode setup for first installation
@ -19,7 +19,7 @@ Tested with a _Jetson AGX Orin Developer Kit_ module.
``` ```
- Initialize system: \ - Initialize system: \
(https://developer.nvidia.com/embedded/learn/get-started-jetson-agx-orin-devkit) (<https://developer.nvidia.com/embedded/learn/get-started-jetson-agx-orin-devkit>)
- Connect via _ssh_, because using _screen_ did not work, skip _oem-config_ step - Connect via _ssh_, because using _screen_ did not work, skip _oem-config_ step
@ -53,7 +53,7 @@ Tested with a _Jetson AGX Orin Developer Kit_ module.
``` ```
- Enable _docker_ without _sudo_: \ - Enable _docker_ without _sudo_: \
(https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) (<https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user>)
- Enable GPU-access for docker building: - Enable GPU-access for docker building:
@ -97,7 +97,7 @@ Tested with a _Jetson AGX Orin Developer Kit_ module.
cd /RapidPoseTriangulation/swig/ && make all && cd ../tests/ && python3 test_interface.py && cd .. cd /RapidPoseTriangulation/swig/ && make all && cd ../tests/ && python3 test_interface.py && cd ..
cd /RapidPoseTriangulation/scripts/ && \ cd /RapidPoseTriangulation/scripts/ && \
g++ -std=c++2a -fPIC -O3 -march=native -Wall -Werror -flto=auto -fopenmp -fopenmp-simd \ g++ -std=c++2a -fPIC -O3 -march=native -Wall -Werror -flto=auto \
-I /RapidPoseTriangulation/rpt/ \ -I /RapidPoseTriangulation/rpt/ \
-isystem /usr/include/opencv4/ \ -isystem /usr/include/opencv4/ \
-isystem /usr/local/include/onnxruntime/ \ -isystem /usr/local/include/onnxruntime/ \

View File

@ -6,9 +6,9 @@ if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD 99)
endif() endif()
# Default to C++17 # Default to C++20
if(NOT CMAKE_CXX_STANDARD) if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 20)
endif() endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@ -20,8 +20,6 @@ find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED) find_package(rclcpp REQUIRED)
find_package(rpt_msgs REQUIRED) find_package(rpt_msgs REQUIRED)
find_package(std_msgs REQUIRED) find_package(std_msgs REQUIRED)
find_package(OpenCV REQUIRED)
find_package(OpenMP REQUIRED)
# Add RapidPoseTriangulation implementation # Add RapidPoseTriangulation implementation
set(RAPID_POSE_TRIANGULATION_DIR "/RapidPoseTriangulation") set(RAPID_POSE_TRIANGULATION_DIR "/RapidPoseTriangulation")
@ -33,14 +31,9 @@ ${RAPID_POSE_TRIANGULATION_DIR}/rpt/camera.cpp
target_include_directories(rapid_pose_triangulation PUBLIC target_include_directories(rapid_pose_triangulation PUBLIC
${RAPID_POSE_TRIANGULATION_DIR}/extras/include ${RAPID_POSE_TRIANGULATION_DIR}/extras/include
${RAPID_POSE_TRIANGULATION_DIR}/rpt ${RAPID_POSE_TRIANGULATION_DIR}/rpt
${OpenCV_INCLUDE_DIRS}
)
target_link_libraries(rapid_pose_triangulation PUBLIC
${OpenCV_LIBS}
OpenMP::OpenMP_CXX
) )
target_compile_options(rapid_pose_triangulation PUBLIC target_compile_options(rapid_pose_triangulation PUBLIC
-fPIC -O3 -march=native -Wall -Werror -fopenmp -fopenmp-simd -fPIC -O3 -march=native -Wall -Werror
) )
# Build the executable # Build the executable
@ -51,7 +44,6 @@ target_include_directories(rpt3d_wrapper PUBLIC
$<INSTALL_INTERFACE:include>) $<INSTALL_INTERFACE:include>)
target_link_libraries(rpt3d_wrapper target_link_libraries(rpt3d_wrapper
${OpenCV_LIBS}
rapid_pose_triangulation rapid_pose_triangulation
) )

View File

@ -2812,7 +2812,6 @@ Results of the model in various experiments on different datasets. \
### Tsinghua ### Tsinghua
(duration 00:01:51)
```json ```json
{ {
"img_loading": 0.111981, "img_loading": 0.111981,

View File

@ -1,8 +1,10 @@
#include <algorithm>
#include <chrono> #include <chrono>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric> #include <numeric>
#include <unordered_map>
#include <omp.h>
#include <opencv2/opencv.hpp>
#include "camera.hpp" #include "camera.hpp"
#include "triangulator.hpp" #include "triangulator.hpp"
@ -10,45 +12,6 @@
// ================================================================================================= // =================================================================================================
// ================================================================================================= // =================================================================================================
[[maybe_unused]] static void print_2d_mat(const cv::Mat &mat)
{
// Ensure the matrix is 2D
if (mat.dims != 2)
{
std::cerr << "Error: The matrix is not 2D." << std::endl;
return;
}
// Retrieve matrix dimensions
int rows = mat.rows;
int cols = mat.cols;
// Print the matrix in a NumPy-like style
std::cout << "cv::Mat('shape': (" << rows << ", " << cols << ")";
std::cout << ", 'data': [" << std::endl;
for (int i = 0; i < rows; ++i)
{
std::cout << " [";
for (int j = 0; j < cols; ++j)
{
std::cout << std::fixed << std::setprecision(3) << mat.at<float>(i, j);
if (j < cols - 1)
{
std::cout << ", ";
}
}
std::cout << "]";
if (i < rows - 1)
{
std::cout << "," << std::endl;
}
}
std::cout << "])" << std::endl;
}
// =================================================================================================
[[maybe_unused]] static void print_2d_poses(const std::vector<std::array<float, 3>> &poses) [[maybe_unused]] static void print_2d_poses(const std::vector<std::array<float, 3>> &poses)
{ {
std::cout << "Poses: (" << poses.size() << ", 3)[" << std::endl; std::cout << "Poses: (" << poses.size() << ", 3)[" << std::endl;

View File

@ -1,12 +1,9 @@
#pragma once #pragma once
#include <array> #include <array>
#include <iostream>
#include <string> #include <string>
#include <vector> #include <vector>
#include <opencv2/opencv.hpp>
#include "camera.hpp" #include "camera.hpp"
// ================================================================================================= // =================================================================================================

View File

@ -1,5 +1,5 @@
# Standard compile options for the C++ executable # Standard compile options for the C++ executable
FLAGS = -fPIC -O3 -march=native -Wall -Werror -flto=auto -fopenmp -fopenmp-simd FLAGS = -fPIC -O3 -march=native -Wall -Werror -flto=auto
# The Python interface through SWIG # The Python interface through SWIG
PYTHON_VERSION = $(shell python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}");') PYTHON_VERSION = $(shell python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}");')
@ -8,7 +8,7 @@ PYTHONL = -Xlinker -export-dynamic
# Default super-target # Default super-target
all: all:
cd ../rpt/ && g++ $(FLAGS) -std=c++2a -isystem /usr/include/opencv4/ -c *.cpp ; cd ../swig/ cd ../rpt/ && g++ $(FLAGS) -std=c++2a -c *.cpp ; cd ../swig/
swig -c++ -python -keyword -o rpt_wrap.cxx rpt.i swig -c++ -python -keyword -o rpt_wrap.cxx rpt.i
g++ $(FLAGS) $(PYTHONI) -c rpt_wrap.cxx -o rpt_wrap.o g++ $(FLAGS) $(PYTHONI) -c rpt_wrap.cxx -o rpt_wrap.o
g++ $(FLAGS) $(PYTHONL) -shared ../rpt/*.o rpt_wrap.o -lopencv_core -lopencv_imgproc -lopencv_calib3d -o _rpt.so g++ $(FLAGS) $(PYTHONL) -shared ../rpt/*.o rpt_wrap.o -o _rpt.so