reid_stuff

This commit is contained in:
Aditya Pulipaka
2026-03-15 19:58:52 -05:00
parent 5c7b26c94a
commit 53999d6023
9 changed files with 884 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
"""Reid pipeline in headless mode (no cv2 display windows).
To view output:
ros2 run rqt_image_view rqt_image_view → select /reid/annotated
rviz2 → add MarkerArray on /reid/track_markers and /keypoint_markers
"""
import os
from launch import LaunchDescription
from launch.actions import ExecuteProcess
def generate_launch_description():
python_exe = os.path.expanduser('~/miniconda3/envs/mmpose/bin/python3')
keyreID_path = os.path.expanduser('~/KeyRe-ID')
return LaunchDescription([
ExecuteProcess(
cmd=[
python_exe, '-m', 'tracking_re_id.single_person_loc_node',
'--ros-args',
'-p', 'threshold:=0.3',
'-p', 'device:=cuda:0',
'-p', 'max_residual:=0.10',
'-p', 'headless:=true',
],
output='screen',
env={**os.environ},
),
ExecuteProcess(
cmd=[
python_exe, '-m', 'tracking_re_id.reid_node',
'--ros-args',
'-p', f'keyreID_path:={keyreID_path}',
'-p', 'num_classes:=150',
'-p', 'camera_num:=2',
'-p', 'device:=cuda:0',
'-p', 'seq_len:=4',
'-p', 'kp_threshold:=0.3',
'-p', 'match_threshold:=0.65',
'-p', 'track_dist_px:=120.0',
'-p', 'track_timeout:=3.0',
'-p', 'headless:=true',
],
output='screen',
env={**os.environ},
),
])

View File

@@ -0,0 +1,70 @@
"""Launch the KeyRe-ID re-identification pipeline alongside the existing
stereo triangulation pipeline.
Nodes started
─────────────
1. single_person_loc_node (unchanged stereo 3-D triangulation)
publishes: /keypoint_markers (MarkerArray)
/keypoints_3d (PointCloud2)
2. reid_node (self-contained left-camera MMPose + KeyRe-ID)
publishes: /reid/annotated (Image)
/reid/track_markers (MarkerArray)
The two nodes are independent: reid_node runs its own MMPose instance on
the left camera only and does not depend on single_person_loc_node output.
Run them together to get both 3-D triangulation and persistent person IDs,
or launch reid_node on its own if only re-identification is needed.
Viewing the output
──────────────────
ros2 run rqt_image_view rqt_image_view → /reid/annotated
rviz2 → add MarkerArray /reid/track_markers and /keypoint_markers
"""
import os
from launch import LaunchDescription
from launch.actions import ExecuteProcess
def generate_launch_description():
python_exe = os.path.expanduser('~/miniconda3/envs/mmpose/bin/python3')
keyreID_path = os.path.expanduser('~/KeyRe-ID')
return LaunchDescription([
# # ── 1. Stereo keypoint triangulator (3-D, unchanged) ─────────────────
# ExecuteProcess(
# cmd=[
# python_exe, '-m', 'tracking_re_id.single_person_loc_node',
# '--ros-args',
# '-p', 'threshold:=0.3',
# '-p', 'device:=cuda:0',
# '-p', 'max_residual:=0.10',
# '-p', 'headless:=true',
# ],
# output='screen',
# env={**os.environ},
# ),
# ── 2. KeyRe-ID re-identification (self-contained) ───────────────────
ExecuteProcess(
cmd=[
python_exe, '-m', 'tracking_re_id.reid_node',
'--ros-args',
'-p', f'keyreID_path:={keyreID_path}',
'-p', 'num_classes:=150',
'-p', 'camera_num:=2',
'-p', 'device:=cuda:0',
'-p', 'seq_len:=4',
'-p', 'kp_threshold:=0.3',
'-p', 'match_threshold:=0.65',
'-p', 'track_dist_px:=120.0',
'-p', 'track_timeout:=3.0',
'-p', 'headless:=false',
],
output='screen',
env={**os.environ},
),
])