소스 정보
- 저장소
- MIUAV/vibe-coding-ros2
- 최근 소스 활동
- 2026년 4월 3일 16:37
- 감지된 SKILL.md 언어
- 중국어
- 스타
- 26
- 포크
- 2
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
SOC 직업 분류 기준
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/MIUAV/vibe-coding-ros2 --skill multi-object-tracking명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | multi-object-tracking |
| description | 多目标跟踪技能 - SORT、DeepSORT、ByteTrack、ROS2 跟踪节点 |
| argument-hint | 多目标跟踪 OR MOT OR SORT OR DeepSORT OR tracking |
| user-invocable | true |
视频序列中的多目标跟踪
当需要以下帮助时使用此技能:
import numpy as np
from scipy.optimize import linear_sum_assignment
class SORTTracker:
def __init__(self, max_age=1, min_hits=3, iou_threshold=0.3):
self.max_age = max_age
self.min_hits = min_hits
self.iou_threshold = iou_threshold
self.tracks = []
self.track_id_count = 0
def update(self, detections):
"""更新跟踪器"""
# 预测所有轨迹
for track in self.tracks:
track.predict()
# 匹配
matched, unmatched_dets, unmatched_tracks = self.associate(
detections, self.tracks)
# 更新匹配轨迹
for det_idx, track_idx in matched:
self.tracks[track_idx].update(detections[det_idx])
# 创建新轨迹
for det_idx in unmatched_dets:
self.tracks.append(self.create_track(detections[det_idx]))
# 移除丢失轨迹
self.tracks = [t for t in self.tracks if t.time_since_update <= self.max_age]
return [t.get_state() for t in self.tracks]
def associate(self, detections, tracks):
"""匈牙利算法匹配"""
if len(tracks) == 0:
return [], list(range(len(detections))), []
iou_matrix = np.zeros((len(detections), len(tracks)))
for d, det in enumerate(detections):
for t, track in enumerate(tracks):
iou_matrix[d, t] = self.compute_iou(det, track.get_bbox())
# 匈牙利算法
row_ind, col_ind = linear_sum_assignment(-iou_matrix)
matched = []
unmatched_dets = list(range(len(detections)))
unmatched_tracks = list(range(len(tracks)))
for r, c in zip(row_ind, col_ind):
if iou_matrix[r, c] >= self.iou_threshold:
matched.append([r, c])
unmatched_dets.remove(r)
unmatched_tracks.remove(c)
return matched, unmatched_dets, unmatched_tracks
@staticmethod
def compute_iou(box1, box2):
"""计算 IOU"""
x1 = max(box1[0], box2[0])
y1 = max(box1[1], box2[1])
x2 = min(box1[0] + box1[2], box2[0] + box2[2])
y2 = min(box1[1] + box1[3], box2[1] + box2[3])
inter = max(0, x2 - x1) * max(0, y2 - y1)
area1 = box1[2] * box1[3]
area2 = box2[2] * box2[3]
union = area1 + area2 - inter
return inter / union if union > 0 else 0
def create_track(self, detection):
return Track(detection, self.track_id_count++)
def get_track_id(self):
return self.track_id_count
class DeepSORTTracker:
def __init__(self, max_age=30, min_hits=3, nn_budget=100):
self.max_age = max_age
self.min_hits = min_hits
self.nn_budget = nn_budget
# 外观描述符管理器
self.descriptors = {}
# 卡尔曼滤波器
self.kf = KalmanBoxFilter()
def update(self, detections, features=None):
"""DeepSORT 更新"""
# 预测
for track in self.tracks:
track.predict()
# 外观匹配
if features is not None:
self.update_descriptors(features)
# 级联匹配
matches, unmatched_dets, unmatched_tracks = self.matching(
detections, features)
# 更新轨迹
for det_idx, track_idx in matches:
self.tracks[track_idx].update(detections[det_idx], features[det_idx])
# 处理未匹配
for det_idx in unmatched_dets:
self.tracks.append(Track(detections[det_idx], features[det_idx]))
self.tracks = [t for t .tracks t.time_since_update <= .max_age]
.tracks
():
- np.dot(feat1, feat2) / (np.linalg.norm(feat1) * np.linalg.norm(feat2))
import rclpy
from rclpy.node import Node
from vision_msgs.msg import Detection2DArray
from geometry_msgs.msg import PoseArray
import numpy as np
class TrackingNode(Node):
def __init__(self):
super().__init__('tracking_node')
self.det_sub = self.create_subscription(
Detection2DArray, '/detections_2d', self.callback, 10)
self.track_pub = self.create_publisher(PoseArray, '/tracked_objects', 10)
self.tracker = DeepSORTTracker()
def callback(self, msg):
detections = []
for det in msg.detections:
bbox = [
det.bbox.center.position.x - det.bbox.size_x / 2,
det.bbox.center.position.y - det.bbox.size_y / 2,
det.bbox.size_x,
det.bbox.size_y
]
detections.append(bbox)
tracks = self.tracker.update(detections)
# 发布跟踪结果
pose_array = PoseArray()
pose_array.header = msg.header
for track in tracks:
pose = Pose()
pose.position.x = track['x']
pose.position.y = track['y']
pose.position.z = track.get(, )
pose_array.poses.append(pose)
.track_pub.publish(pose_array)