Renamed project.

This commit is contained in:
Daniel
2024-10-14 16:28:34 +02:00
parent 256fd26f3f
commit 9e03533704
15 changed files with 44 additions and 44 deletions

4
.gitignore vendored
View File

@ -1,5 +1,5 @@
spt_wrap.* rpt_wrap.*
spt.py rpt.py
*.bin *.bin
# Prerequisites # Prerequisites

View File

@ -45,5 +45,5 @@ RUN apt-get update && apt-get install -y --no-install-recommends libopencv-dev
COPY ./skelda/ /skelda/ COPY ./skelda/ /skelda/
RUN pip3 install --no-cache-dir -e /skelda/ RUN pip3 install --no-cache-dir -e /skelda/
WORKDIR /SimplePoseTriangulation/ WORKDIR /RapidPoseTriangulation/
CMD ["/bin/bash"] CMD ["/bin/bash"]

View File

@ -1,6 +1,6 @@
# SimplePoseTriangulation # RapidPoseTriangulation
Triangulation of multiple persons from multiple camera views. Fast triangulation of multiple persons from multiple camera views.
<div align="center"> <div align="center">
<img src="media/2d-k.jpg" alt="2D detections"" width="65%"/> <img src="media/2d-k.jpg" alt="2D detections"" width="65%"/>
@ -17,25 +17,25 @@ Triangulation of multiple persons from multiple camera views.
- Clone this project with submodules: - Clone this project with submodules:
```bash ```bash
git clone --recurse-submodules https://gitlab.com/Percipiote/SimplePoseTriangulation.git git clone --recurse-submodules https://gitlab.com/Percipiote/RapidPoseTriangulation.git
cd SimplePoseTriangulation/ cd RapidPoseTriangulation/
``` ```
- Build docker container: - Build docker container:
```bash ```bash
docker build --progress=plain -t simpleposetriangulation . docker build --progress=plain -t rapidposetriangulation .
./run_container.sh ./run_container.sh
``` ```
- Test with samples: - Test with samples:
```bash ```bash
python3 /SimplePoseTriangulation/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 /SimplePoseTriangulation/scripts/test_skelda_dataset.py python3 /RapidPoseTriangulation/scripts/test_skelda_dataset.py
``` ```
<br> <br>
@ -43,5 +43,5 @@ Triangulation of multiple persons from multiple camera views.
## Debugging ## Debugging
```bash ```bash
cd /SimplePoseTriangulation/swig/ && make all && cd ../tests/ && python3 test_interface.py cd /RapidPoseTriangulation/swig/ && make all && cd ../tests/ && python3 test_interface.py
``` ```

4
run_container.sh Normal file → Executable file
View File

@ -3,9 +3,9 @@
xhost + xhost +
docker run --privileged --rm --network host -it \ docker run --privileged --rm --network host -it \
--gpus all --shm-size=16g --ulimit memlock=-1 --ulimit stack=67108864 \ --gpus all --shm-size=16g --ulimit memlock=-1 --ulimit stack=67108864 \
--volume "$(pwd)"/:/SimplePoseTriangulation/ \ --volume "$(pwd)"/:/RapidPoseTriangulation/ \
--volume "$(pwd)"/../datasets/:/datasets/ \ --volume "$(pwd)"/../datasets/:/datasets/ \
--volume "$(pwd)"/skelda/:/skelda/ \ --volume "$(pwd)"/skelda/:/skelda/ \
--volume /tmp/.X11-unix:/tmp/.X11-unix \ --volume /tmp/.X11-unix:/tmp/.X11-unix \
--env DISPLAY --env QT_X11_NO_MITSHM=1 \ --env DISPLAY --env QT_X11_NO_MITSHM=1 \
simpleposetriangulation rapidposetriangulation

View File

@ -12,8 +12,8 @@ import test_triangulate
import utils_2d_pose import utils_2d_pose
from skelda import evals, utils_pose from skelda import evals, utils_pose
sys.path.append("/SimplePoseTriangulation/swig/") sys.path.append("/RapidPoseTriangulation/swig/")
import spt import rpt
# ================================================================================================== # ==================================================================================================
@ -100,7 +100,7 @@ if dataset_use.endswith("_wb"):
# eval_joints[eval_joints.index("head")] = "nose" # eval_joints[eval_joints.index("head")] = "nose"
eval_joints = list(joint_names_2d) eval_joints = list(joint_names_2d)
# output_dir = "/SimplePoseTriangulation/data/testoutput/" # output_dir = "/RapidPoseTriangulation/data/testoutput/"
output_dir = "" output_dir = ""
# ================================================================================================== # ==================================================================================================
@ -271,7 +271,7 @@ def main():
all_ids = [] all_ids = []
all_paths = [] all_paths = []
times = [] times = []
triangulator = spt.Triangulator(min_score=minscore, min_group_size=min_group_size) triangulator = rpt.Triangulator(min_score=minscore, min_group_size=min_group_size)
old_scene = "" old_scene = ""
old_index = -1 old_index = -1
for label in tqdm.tqdm(labels): for label in tqdm.tqdm(labels):
@ -318,10 +318,10 @@ def main():
if sum(np.sum(p) for p in poses_2d) == 0: if sum(np.sum(p) for p in poses_2d) == 0:
poses3D = np.zeros([1, len(joint_names_3d), 4]).tolist() poses3D = np.zeros([1, len(joint_names_3d), 4]).tolist()
else: else:
spt_cameras = spt.convert_cameras(label["cameras"]) rpt_cameras = rpt.convert_cameras(label["cameras"])
roomparams = [label["room_size"], label["room_center"]] roomparams = [label["room_size"], label["room_center"]]
poses3D = triangulator.triangulate_poses( poses3D = triangulator.triangulate_poses(
poses_2d, spt_cameras, roomparams, joint_names_2d poses_2d, rpt_cameras, roomparams, joint_names_2d
) )
time_3d = time.time() - start time_3d = time.time() - start

View File

@ -12,8 +12,8 @@ import numpy as np
import utils_2d_pose import utils_2d_pose
from skelda import utils_pose, utils_view from skelda import utils_pose, utils_view
sys.path.append("/SimplePoseTriangulation/swig/") sys.path.append("/RapidPoseTriangulation/swig/")
import spt import rpt
# ================================================================================================== # ==================================================================================================
@ -338,9 +338,9 @@ def main():
poses3D = np.zeros([1, len(joint_names_3d), 4]) poses3D = np.zeros([1, len(joint_names_3d), 4])
poses2D = np.zeros([len(images_2d), 1, len(joint_names_3d), 3]) poses2D = np.zeros([len(images_2d), 1, len(joint_names_3d), 3])
else: else:
cameras = spt.convert_cameras(camparams) cameras = rpt.convert_cameras(camparams)
roomp = [roomparams["room_size"], roomparams["room_center"]] roomp = [roomparams["room_size"], roomparams["room_center"]]
triangulator = spt.Triangulator(min_score=0.95) triangulator = rpt.Triangulator(min_score=0.95)
stime = time.time() stime = time.time()
poses_3d = triangulator.triangulate_poses( poses_3d = triangulator.triangulate_poses(

View File

@ -7,7 +7,7 @@ PYTHONL = -Xlinker -export-dynamic
# Default super-target # Default super-target
all: all:
cd ../spt/ && g++ $(FLAGS) -std=c++2a -I/usr/include/opencv4 -c *.cpp ; cd ../swig/ cd ../rpt/ && g++ $(FLAGS) -std=c++2a -I/usr/include/opencv4 -c *.cpp ; cd ../swig/
swig -c++ -python -keyword -o spt_wrap.cxx spt.i swig -c++ -python -keyword -o rpt_wrap.cxx rpt.i
g++ $(FLAGS) $(PYTHONI) -c spt_wrap.cxx -o spt_wrap.o g++ $(FLAGS) $(PYTHONI) -c rpt_wrap.cxx -o rpt_wrap.o
g++ $(FLAGS) $(PYTHONL) -shared ../spt/*.o spt_wrap.o -lopencv_core -lopencv_imgproc -lopencv_calib3d -o _spt.so g++ $(FLAGS) $(PYTHONL) -shared ../rpt/*.o rpt_wrap.o -lopencv_core -lopencv_imgproc -lopencv_calib3d -o _rpt.so

View File

@ -1,8 +1,8 @@
%module spt %module rpt
%{ %{
// Includes the header in the wrapper code // Includes the header in the wrapper code
#include "../spt/camera.hpp" #include "../rpt/camera.hpp"
#include "../spt/interface.hpp" #include "../rpt/interface.hpp"
%} %}
// Some modules need extra imports beside the main .hpp file // Some modules need extra imports beside the main .hpp file
@ -47,8 +47,8 @@ namespace std {
#pragma SWIG nowarn=511 #pragma SWIG nowarn=511
// Parse the header file to generate wrappers // Parse the header file to generate wrappers
%include "../spt/camera.hpp" %include "../rpt/camera.hpp"
%include "../spt/interface.hpp" %include "../rpt/interface.hpp"
// Add additional Python code to the module // Add additional Python code to the module
%pythoncode %{ %pythoncode %{

View File

@ -5,7 +5,7 @@ import time
import numpy as np import numpy as np
sys.path.append("../swig/") sys.path.append("../swig/")
import spt import rpt
# ================================================================================================== # ==================================================================================================
@ -14,7 +14,7 @@ def main():
print("") print("")
# Test camera structure # Test camera structure
camera = spt.Camera() camera = rpt.Camera()
camera.name = "Camera 1" camera.name = "Camera 1"
camera.K = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] camera.K = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
camera.DC = [0, 0, 0, 0, 0] camera.DC = [0, 0, 0, 0, 0]
@ -49,18 +49,18 @@ def main():
"shoulder_middle", "shoulder_middle",
"head", "head",
] ]
cpath = "/SimplePoseTriangulation/data/h1/sample.json" cpath = "/RapidPoseTriangulation/data/h1/sample.json"
ppath = "/SimplePoseTriangulation/tests/poses_h1.json" ppath = "/RapidPoseTriangulation/tests/poses_h1.json"
with open(cpath, "r") as file: with open(cpath, "r") as file:
cdata = json.load(file) cdata = json.load(file)
with open(ppath, "r") as file: with open(ppath, "r") as file:
pdata = json.load(file) pdata = json.load(file)
cams = cdata["cameras"] cams = cdata["cameras"]
poses_2d = pdata["2D"] poses_2d = pdata["2D"]
cameras = spt.convert_cameras(cams) cameras = rpt.convert_cameras(cams)
# Run triangulation # Run triangulation
triangulator = spt.Triangulator(min_score=0.95) triangulator = rpt.Triangulator(min_score=0.95)
stime = time.time() stime = time.time()
poses_3d = triangulator.triangulate_poses( poses_3d = triangulator.triangulate_poses(
poses_2d, cameras, roomparams, joint_names poses_2d, cameras, roomparams, joint_names
@ -71,15 +71,15 @@ def main():
# Load input data # Load input data
roomparams = [[5.6, 6.4, 2.4], [0, -0.5, 1.2]] roomparams = [[5.6, 6.4, 2.4], [0, -0.5, 1.2]]
cpath = "/SimplePoseTriangulation/data/p1/sample.json" cpath = "/RapidPoseTriangulation/data/p1/sample.json"
ppath = "/SimplePoseTriangulation/tests/poses_p1.json" ppath = "/RapidPoseTriangulation/tests/poses_p1.json"
with open(cpath, "r") as file: with open(cpath, "r") as file:
cdata = json.load(file) cdata = json.load(file)
with open(ppath, "r") as file: with open(ppath, "r") as file:
pdata = json.load(file) pdata = json.load(file)
cams = cdata["cameras"] cams = cdata["cameras"]
poses_2d = pdata["2D"] poses_2d = pdata["2D"]
cameras = spt.convert_cameras(cams) cameras = rpt.convert_cameras(cams)
# Run triangulation # Run triangulation
triangulator.reset() triangulator.reset()
@ -102,15 +102,15 @@ def main():
# Load input data # Load input data
roomparams = [[6.0, 5.0, 2.0], [1.5, 1.0, -0.5]] roomparams = [[6.0, 5.0, 2.0], [1.5, 1.0, -0.5]]
cpath = "/SimplePoseTriangulation/data/e1/sample.json" cpath = "/RapidPoseTriangulation/data/e1/sample.json"
ppath = "/SimplePoseTriangulation/tests/poses_e1.json" ppath = "/RapidPoseTriangulation/tests/poses_e1.json"
with open(cpath, "r") as file: with open(cpath, "r") as file:
cdata = json.load(file) cdata = json.load(file)
with open(ppath, "r") as file: with open(ppath, "r") as file:
pdata = json.load(file) pdata = json.load(file)
cams = cdata["cameras"] cams = cdata["cameras"]
poses_2d = pdata["2D"] poses_2d = pdata["2D"]
cameras = spt.convert_cameras(cams) cameras = rpt.convert_cameras(cams)
# Run triangulation # Run triangulation
triangulator.reset() triangulator.reset()