Kalman Filter

Hyungseop Lee·2026년 3월 12일

Kalman filter란?

  • a classic state estimation technique.
    시간에 따라 변하는 system의 state를 estimation하는 방법 중 하나.

  • Kalman filter에 대해 직관적인 설명으로 도움이 되었던 영상: https://www.youtube.com/watch?v=ul3u2yLPwU0


1. System Definition

  • xtx_t: tracking하고자 하는 object의 current state vector
  • ztz_t: sensor (object detector)가 알려주는 measurement vector

2. State & Error Covariance Prediction

과거의 정보와 물리 법칙을 이용해 현재 object가 어디 있을지 추측하는 과정.
Δt\Delta t = t(t1)t - (t-1)

  • 고전 역학의 등속도 운동 법칙 (위치 = 이전 위치 + 이전 속도 ×\times 시간)을 matrix로 표현하면 다음과 같음:
    State Transition Matrix, FtF_t:
    Ft=[10Δt0010Δt00100001]F_t = \begin{bmatrix} 1 & 0 & \Delta t & 0 \\ 0 & 1 & 0 & \Delta t \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}

2.1. State Prediction, x^tt1\hat{x}_{t|t-1}

  • 이전 시간 (t1)(t-1)의 추정치를 바탕으로 현재 시간 tt의 status x^tt1\hat{x}_{t|t-1}를 prediction. (외부 제어 입력은 없다고 가정)

2.2. Error Covariance Prediction, Ptt1P_{t|t-1}

  • 예측이 얼마나 불확실한지를 나타내는 Error Covariance Matrix(PP)를 upate

3. Update

  • prediction과 실제 measurement를 섞어서 가장 정확한 최적의 위치를 찾아내는 과정

3.1. Observation Matrix, HtH_t

  • 먼저, predicted state vector xtx_t와 sensor measurement vector ztz_t와 비교할 수 있도록 변환해줘야 함.
    이를 위해, state vector에서 위치 정보만 추출할 수 있도록 하는 Observation Matrix, HtH_t를 다음과 같이 정의함:
    Ht=[10000100]H_t = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \end{bmatrix}

3.2. Measurement Residual, yty_t

  • sensor measurement ztz_t와 우리의 predicted location Htx^tt1H_t\hat{x}_{t|t-1}의 차이를 계산
    yt=ztHtx^tt1y_t = z_t - H_t \hat{x}_{t|t-1}

3.3. Kalman Gain, KtK_t

  • sensor를 얼마나 믿을지, 우리의 prediction을 얼마나 믿을지 비율을 결정하기 위해 Kalman Gain을 정의
    3.4. State Update에서 Kalman Gain KtK_t이 어떤 역할을 하는지 더 자세히 나오겠지만 Kalman Gain이 Kalman Filter의 핵심이라 간략히 설명하자면,
    sensor noise(RtR_t)가 매우 크다면 KtK_t는 0에 가까워져 prediction 값을 더 신뢰하게 되고,
    그 반대의 경우에는 KtK_t가 커져 sensor measurment값을 더 신뢰하게 됨.

3.4. State Update, x^tt\hat{x}_{t|t}

  • predicted state에 measurement residual와 Kalman Gain을 곱해 최종 state를 correction(보정)함

3.5. Error Covariance Update, PttP_{t|t}

  • measurement를 통해 새로운 정보를 얻었으므로, current state에 대한 uncertainty(PP)을 줄여줌
  • (질문) process noise covariance QtQ_t와 measurment noise convariance RtR_t를 어떻게 결정하는가?
  • (Gemini) 이 과정은 Kalman Filter의 성능을 좌우하는 핵심 단계이며, 이를 'Filter Tuning'이라고 부른다
    • RtR_t 획득 방법:
      RtR_t는 sensor (나의 경우 DL-based object detector, ex: YOLO)가 object의 위치를 측정할 때 발생하는 error의 variance를 나타냄.
      • Empirical Measurement:
        가장 정성적인 방법은 정지된 object를 여러 frame에 걸쳐 detection하는 것.
        detection한 bbox의 중심 좌표 (x,y)(x, y) data를 수집한 후, 각 축에 대한 variance를 계산하여 RR의 diagnoal로 사용.
        이때, RtR_t을 고정시켜서 사용하는 듯함.
        R=[σx200σy2]R = \begin{bmatrix} \sigma_{x}^2 & 0 \\ 0 & \sigma_{y}^2 \end{bmatrix}
      • Bounding Box Size Heuristics:
        SOFT와 같은 Multiple-Object Tracking 에서는 camera 원근법으로 인해 object가 멀리 있을 수록 bbox가 작아지고 Noise의 absolute pixel 크기도 작아진다는 점을 반영.
        따라서 RtR_t를 고정하지 않고, 현재 detection된 bbox의 width와 height에 비례하도록 동적으로 설정하기도 함.
    • QtQ_t 획득 방법:
profile
Efficient Deep Learning

0개의 댓글