def update(self, mean, covariance, measurement):
        """
        Run Kalman filter correction step.

        Args:
            mean (ndarray): The predicted state's mean vector (8 dimensional).
            covariance (ndarray): The state's covariance matrix (8x8 dimensional).
            measurement (ndarray): The 4 dimensional measurement vector
                (x, y, a, h), where (x, y) is the center position, a the aspect
                ratio, and h the height of the bounding box.

        Returns:
            The measurement-corrected state distribution.
        """
        projected_mean, projected_cov = self.project(mean, covariance)

        if use_numba:

            return nb_update(mean, covariance, projected_mean, projected_cov,
                             measurement, self._update_mat)

        kalman_gain = np.linalg.solve(projected_cov,
                                      (covariance @self._update_mat.T).T).T
        innovation = measurement - projected_mean
        mean = mean + innovation @kalman_gain.T
        covariance = covariance - kalman_gain @projected_cov @kalman_gain.T
        return mean, covariance

        Run Kalman filter correction step.

        Args:
            mean (ndarray): The predicted state's mean vector (8 dimensional).
            covariance (ndarray): The state's covariance matrix (8x8 dimensional).
            measurement (ndarray): The 4 dimensional measurement vector
                (x, y, a, h), where (x, y) is the center position, a the aspect
                ratio, and h the height of the bounding box.

        Returns:
            The measurement-corrected state distribution.
        
ppdet/modeling/mot/motion/kalman_filter.py