Speed: 2.4ms preprocess, 175.2ms inference, 1.0ms postprocess per image at shape (1, 3, 640, 640)
Traceback (most recent call last):
File "/Users/surabhi/Documents/kalman/kalman_t.py", line 82, in
kf.predict(dt=dt, control_input=u)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/filterpy/kalman/UKF.py", line 388, in predict
self.compute_process_sigmas(dt, fx, **fx_args)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/filterpy/kalman/UKF.py", line 503, in compute_process_sigmas
self.sigmas_f[i] = fx(s, dt, **fx_args)
^^^^^^^^^^^^^^^^^^^^
TypeError: fx() got an unexpected keyword argument 'control_input'
Assistant
The error message indicates that the function "fx" was called with an unexpected keyword argument "control_input". The function "fx" is likely a user-defined function that is used in the Kalman filter implementation.
To fix this error, you should modify the definition of the "fx" function to accept the "control_input" argument, or remove the "control_input" argument from the function call where it is causing the error. Make sure that the function definition and function call are consistent in terms of the arguments they accept.
User
Assistant
In the code you provided, there are two definitions for the "fx" function with different arguments. The second definition contains an extra argument "u". However, in the line "kf.predict(dt=dt, control_input=u)" the "control_input" argument is passed to the "predict" method which calls the first definition of the "fx" function without the "u" argument.
To fix this error, you should remove the first definition of the "fx" function or modify it to accept the "u" argument. Then, make sure to pass the correct version of the "fx" function to the Kalman filter methods.
User
change in code
Assistant
import cv2
import numpy as np
import pandas as pd
from filterpy.kalman import UnscentedKalmanFilter, MerweScaledSigmaPoints
from ultralytics import YOLO
model = YOLO('/Users/surabhi/Documents/kalman/best.pt')
def fx(x, dt):
This function predicts the state of the system at time t+1
based on the state at time t and the time step dt.
The state vector x has 10 elements: [pos_x, pos_y, vel_x, vel_y, acc_x, acc_y, jerk_x, jerk_y, snap_x, snap_y]