揭示卡爾曼濾波器的威力

一、說明

????????作為一名數據科學家,我們偶爾會遇到需要對趨勢進行建模以預測未來值的情況。雖然人們傾向于關注基于統計或機器學習的算法,但我在這里提出一個不同的選擇:卡爾曼濾波器(KF)。

????????1960 年代初期,Rudolf E. Kalman 徹底改變了使用 KF 建模復雜系統的方式。從引導飛機或航天器到達目的地,到讓您的智能手機找到它在這個世界上的位置,該算法融合了數據和數學,以令人難以置信的準確性提供對未來狀態的估計。

????????在本博客中,我們將深入介紹卡爾曼濾波器的工作原理,并展示 Python 中的示例,以強調該技術的真正威力。從一個簡單的 2D 示例開始,我們將了解如何修改代碼以使其適應更高級的 4D 空間,最后覆蓋擴展卡爾曼濾波器(復雜的前身)。和我一起踏上這段旅程,我們將踏上預測算法和過濾器的世界。

二、卡爾曼濾波器的基礎知識

????????KF 通過構建并持續更新從觀察和其他及時測量中收集的一組協方差矩陣(表示噪聲和過去狀態的統計分布)來提供系統狀態的估計。與其他開箱即用的算法不同,可以通過定義系統和外部源之間的數學關系來直接擴展和細化解決方案。雖然這聽起來可能相當復雜和錯綜復雜,但該過程可以概括為兩個步驟:預測和更新。這些階段一起工作,迭代地糾正和完善系統的狀態估計。

????????預測步驟:

????????此階段主要是根據模型已知的后驗估計和時間步長 Δk 來預測系統的下一個未來狀態。在數學上,我們將狀態空間的估計表示為:

????????其中,F 是我們的狀態轉換矩陣,它模擬了狀態如何從一步演化到另一步,而與控制輸入和過程噪聲無關。我們的矩陣 B 模擬控制輸入 u? 對狀態的影響。

除了我們對下一個狀態的估計之外,該算法還計算由協方差矩陣 P 表示的估計的不確定性

????????預測狀態協方差矩陣代表我們預測的置信度和準確性,受系統本身的過程噪聲協方差矩陣Q的影響。我們將該矩陣應用于更新步驟中的后續方程,以糾正卡爾曼濾波器在系統上保存的信息,從而改進未來狀態估計。

????????更新步驟:

????????在更新步驟中,算法對卡爾曼增益、狀態估計和協方差矩陣進行更新。卡爾曼增益決定新測量對狀態估計的影響有多大。計算包括觀測模型矩陣H,它將狀態與我們期望接收的測量結果聯系起來,以及R測量誤差的測量噪聲協方差矩陣:

????????本質上,K試圖平衡預測中的不確定性與測量中存在的不確定性。如上所述,卡爾曼增益用于校正狀態估計和協方差,分別由以下方程表示:

????????其中狀態估計括號中的計算結果是殘差,即實際測量值與模型預測值之間的差異。

????????卡爾曼濾波器工作原理的真正美妙之處在于其遞歸本質,在收到新信息時不斷更新狀態和協方差。這使得模型能夠隨著時間的推移以統計上最佳的方式進行完善,這對于接收噪聲觀測流的系統建模來說是特別強大的方法。

三、卡爾曼濾波器的作用

????????支持卡爾曼濾波器的方程可能會讓您不知所措,并且僅從數學角度充分理解它的工作原理需要了解狀態空間(超出了本博客的范圍),但我將嘗試引入通過一些 Python 示例讓它變得生動起來。在最簡單的形式中,我們可以將卡爾曼濾波器對象定義為:

import numpy as npclass KalmanFilter:"""An implementation of the classic Kalman Filter for linear dynamic systems.The Kalman Filter is an optimal recursive data processing algorithm whichaims to estimate the state of a system from noisy observations.Attributes:F (np.ndarray): The state transition matrix.B (np.ndarray): The control input marix.H (np.ndarray): The observation matrix.u (np.ndarray): the control input.Q (np.ndarray): The process noise covariance matrix.R (np.ndarray): The measurement noise covariance matrix.x (np.ndarray): The mean state estimate of the previous step (k-1).P (np.ndarray): The state covariance of previous step (k-1)."""def __init__(self, F, B, u, H, Q, R, x0, P0):"""Initializes the Kalman Filter with the necessary matrices and initial state.Parameters:F (np.ndarray): The state transition matrix.B (np.ndarray): The control input marix.H (np.ndarray): The observation matrix.u (np.ndarray): the control input.Q (np.ndarray): The process noise covariance matrix.R (np.ndarray): The measurement noise covariance matrix.x0 (np.ndarray): The initial state estimate.P0 (np.ndarray): The initial state covariance matrix."""self.F = F  # State transition matrixself.B = B  # Control input matrixself.u = u  # Control vectorself.H = H  # Observation matrixself.Q = Q  # Process noise covarianceself.R = R  # Measurement noise covarianceself.x = x0  # Initial state estimateself.P = P0  # Initial estimate covariancedef predict(self):"""Predicts the state and the state covariance for the next time step."""self.x = self.F @ self.x + self.B @ self.uself.P = self.F @ self.P @ self.F.T + self.Qreturn self.xdef update(self, z):"""Updates the state estimate with the latest measurement.Parameters:z (np.ndarray): The measurement at the current step."""y = z - self.H @ self.xS = self.H @ self.P @ self.H.T + self.RK = self.P @ self.H.T @ np.linalg.inv(S)self.x = self.x + K @ yI = np.eye(self.P.shape[0])self.P = (I - K @ self.H) @ self.Preturn self.xChallenges with Non-linear Systems

????????我們將使用predict()update()函數來迭代前面概述的步驟。上述過濾器設計適用于任何時間序列,為了展示我們的估計與實際情況的比較,讓我們構建一個簡單的示例:

import numpy as np
import matplotlib.pyplot as plt# Set the random seed for reproducibility
np.random.seed(42)# Simulate the ground truth position of the object
true_velocity = 0.5  # units per time step
num_steps = 50
time_steps = np.linspace(0, num_steps, num_steps)
true_positions = true_velocity * time_steps# Simulate the measurements with noise
measurement_noise = 10  # increase this value to make measurements noisier
noisy_measurements = true_positions + np.random.normal(0, measurement_noise, num_steps)# Plot the true positions and the noisy measurements
plt.figure(figsize=(10, 6))
plt.plot(time_steps, true_positions, label='True Position', color='green')
plt.scatter(time_steps, noisy_measurements, label='Noisy Measurements', color='red', marker='o')plt.xlabel('Time Step')
plt.ylabel('Position')
plt.title('True Position and Noisy Measurements Over Time')
plt.legend()
plt.show()

????????實際上,“真實位置”是未知的,但我們將在此處繪制它以供參考,“噪聲測量”是輸入卡爾曼濾波器的觀察點。我們將執行矩陣的非常基本的實例化,在某種程度上,這并不重要,因為卡爾曼模型將通過應用卡爾曼增益快速收斂,但在某些情況下對模型執行熱啟動可能是合理的。

# Kalman Filter Initialization
F = np.array([[1, 1], [0, 1]])   # State transition matrix
B = np.array([[0], [0]])          # No control input
u = np.array([[0]])               # No control input
H = np.array([[1, 0]])            # Measurement function
Q = np.array([[1, 0], [0, 3]])    # Process noise covariance
R = np.array([[measurement_noise**2]]) # Measurement noise covariance
x0 = np.array([[0], [0]])         # Initial state estimate
P0 = np.array([[1, 0], [0, 1]])   # Initial estimate covariancekf = KalmanFilter(F, B, u, H, Q, R, x0, P0)# Allocate space for estimated positions and velocities
estimated_positions = np.zeros(num_steps)
estimated_velocities = np.zeros(num_steps)# Kalman Filter Loop
for t in range(num_steps):# Predictkf.predict()# Updatemeasurement = np.array([[noisy_measurements[t]]])kf.update(measurement)# Store the filtered position and velocityestimated_positions[t] = kf.x[0]estimated_velocities[t] = kf.x[1]# Plot the true positions, noisy measurements, and the Kalman filter estimates
plt.figure(figsize=(10, 6))
plt.plot(time_steps, true_positions, label='True Position', color='green')
plt.scatter(time_steps, noisy_measurements, label='Noisy Measurements', color='red', marker='o')
plt.plot(time_steps, estimated_positions, label='Kalman Filter Estimate', color='blue')plt.xlabel('Time Step')
plt.ylabel('Position')
plt.title('Kalman Filter Estimation Over Time')
plt.legend()
plt.show()

????????即使采用這種非常簡單的解決方案設計,該模型也能很好地穿透噪音找到真實位置。這對于簡單的應用程序來說可能沒問題,但趨勢通常更加微妙,并受到外部事件的影響。為了解決這個問題,我們通常需要修改狀態空間表示,還需要修改計算估計值的方式,并在新信息到達時糾正協方差矩陣,讓我們用另一個例子來進一步探討這一點

四、追蹤 4D 移動物體

????????假設我們想要跟蹤物體在空間和時間上的運動,為了使這個例子更加真實,我們將模擬一些作用在物體上的力,從而導致角旋轉。為了展示該算法對更高維狀態空間表示的適應性,我們將假設線性力,盡管實際上情況并非如此(在此之后我們將探索一個更現實的示例)。下面的代碼顯示了我們如何針對這種特定場景修改卡爾曼濾波器的示例。

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3Dclass KalmanFilter:"""An implementation of the classic Kalman Filter for linear dynamic systems.The Kalman Filter is an optimal recursive data processing algorithm whichaims to estimate the state of a system from noisy observations.Attributes:F (np.ndarray): The state transition matrix.B (np.ndarray): The control input marix.H (np.ndarray): The observation matrix.u (np.ndarray): the control input.Q (np.ndarray): The process noise covariance matrix.R (np.ndarray): The measurement noise covariance matrix.x (np.ndarray): The mean state estimate of the previous step (k-1).P (np.ndarray): The state covariance of previous step (k-1)."""def __init__(self, F=None, B=None, u=None, H=None, Q=None, R=None, x0=None, P0=None):"""Initializes the Kalman Filter with the necessary matrices and initial state.Parameters:F (np.ndarray): The state transition matrix.B (np.ndarray): The control input marix.H (np.ndarray): The observation matrix.u (np.ndarray): the control input.Q (np.ndarray): The process noise covariance matrix.R (np.ndarray): The measurement noise covariance matrix.x0 (np.ndarray): The initial state estimate.P0 (np.ndarray): The initial state covariance matrix."""self.F = F  # State transition matrixself.B = B  # Control input matrixself.u = u  # Control inputself.H = H  # Observation matrixself.Q = Q  # Process noise covarianceself.R = R  # Measurement noise covarianceself.x = x0  # Initial state estimateself.P = P0  # Initial estimate covariancedef predict(self):"""Predicts the state and the state covariance for the next time step."""self.x = np.dot(self.F, self.x) + np.dot(self.B, self.u)self.P = np.dot(np.dot(self.F, self.P), self.F.T) + self.Qdef update(self, z):"""Updates the state estimate with the latest measurement.Parameters:z (np.ndarray): The measurement at the current step."""y = z - np.dot(self.H, self.x)S = np.dot(self.H, np.dot(self.P, self.H.T)) + self.RK = np.dot(np.dot(self.P, self.H.T), np.linalg.inv(S))self.x = self.x + np.dot(K, y)self.P = self.P - np.dot(np.dot(K, self.H), self.P)# Parameters for simulation
true_angular_velocity = 0.1  # radians per time step
radius = 20
num_steps = 100
dt = 1  # time step# Create time steps
time_steps = np.arange(0, num_steps*dt, dt)# Ground truth state
true_x_positions = radius * np.cos(true_angular_velocity * time_steps)
true_y_positions = radius * np.sin(true_angular_velocity * time_steps)
true_z_positions = 0.5 * time_steps  # constant velocity in z# Create noisy measurements
measurement_noise = 1.0
noisy_x_measurements = true_x_positions + np.random.normal(0, measurement_noise, num_steps)
noisy_y_measurements = true_y_positions + np.random.normal(0, measurement_noise, num_steps)
noisy_z_measurements = true_z_positions + np.random.normal(0, measurement_noise, num_steps)# Kalman Filter initialization
F = np.array([[1, 0, 0, -radius*dt*np.sin(true_angular_velocity*dt)],[0, 1, 0, radius*dt*np.cos(true_angular_velocity*dt)],[0, 0, 1, 0],[0, 0, 0, 1]])
B = np.zeros((4, 1))
u = np.zeros((1, 1))
H = np.array([[1, 0, 0, 0],[0, 1, 0, 0],[0, 0, 1, 0]])
Q = np.eye(4) * 0.1  # Small process noise
R = measurement_noise**2 * np.eye(3)  # Measurement noise
x0 = np.array([[0], [radius], [0], [true_angular_velocity]])
P0 = np.eye(4) * 1.0kf = KalmanFilter(F, B, u, H, Q, R, x0, P0)# Allocate space for estimated states
estimated_states = np.zeros((num_steps, 4))# Kalman Filter Loop
for t in range(num_steps):# Predictkf.predict()# Updatez = np.array([[noisy_x_measurements[t]],[noisy_y_measurements[t]],[noisy_z_measurements[t]]])kf.update(z)# Store the stateestimated_states[t, :] = kf.x.ravel()# Extract estimated positions
estimated_x_positions = estimated_states[:, 0]
estimated_y_positions = estimated_states[:, 1]
estimated_z_positions = estimated_states[:, 2]# Plotting
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111, projection='3d')# Plot the true trajectory
ax.plot(true_x_positions, true_y_positions, true_z_positions, label='True Trajectory', color='g')
# Plot the start and end markers for the true trajectory
ax.scatter(true_x_positions[0], true_y_positions[0], true_z_positions[0], label='Start (Actual)', c='green', marker='x', s=100)
ax.scatter(true_x_positions[-1], true_y_positions[-1], true_z_positions[-1], label='End (Actual)', c='red', marker='x', s=100)# Plot the noisy measurements
ax.scatter(noisy_x_measurements, noisy_y_measurements, noisy_z_measurements, label='Noisy Measurements', color='r')# Plot the estimated trajectory
ax.plot(estimated_x_positions, estimated_y_positions, estimated_z_positions, label='Estimated Trajectory', color='b')# Plot settings
ax.set_xlabel('X position')
ax.set_ylabel('Y position')
ax.set_zlabel('Z position')
ax.set_title('3D Trajectory Estimation with Kalman Filter')
ax.legend()plt.show()

????????這里需要注意一些有趣的點,在上圖中,我們可以看到當我們開始迭代觀察結果時,模型如何快速校正到估計的真實狀態。該模型在識別系統的真實狀態方面也表現得相當好,估計與真實狀態(“真實軌跡”)相交。這種設計可能適合某些現實世界的應用,但不適用于作用在系統上的力是非線性的應用。相反,我們需要考慮卡爾曼濾波器的不同應用:擴展卡爾曼濾波器,它是我們迄今為止所探索的線性化輸入觀測值的非線性的前身。

五、擴展卡爾曼濾波器

????????當嘗試對系統的觀測或動態非線性的系統進行建模時,我們需要應用擴展卡爾曼濾波器(EKF)。該算法與上一個算法的不同之處在于,將雅可比矩陣納入解中并執行泰勒級數展開以找到狀態轉移和觀測模型的一階線性近似。為了以數學方式表達這一擴展,我們的關鍵算法計算現在變為:

????????對于狀態預測,其中 f 是應用于先前狀態估計的非線性狀態轉換函數,u是先前時間步的控制輸入。

????????用于誤差協方差預測,其中F是狀態轉換函數相對于P(先前誤差協方差)和Q(過程噪聲協方差矩陣)的雅可比行列式。

????????在時間步k處對測量z的觀測,其中h是應用于狀態預測的非線性觀測函數,具有一些加性觀測噪聲v

????????我們對卡爾曼增益計算的更新,其中H是相對于狀態的觀測函數的雅可比行列式,R是測量噪聲協方差矩陣。

????????狀態估計的修改計算結合了卡爾曼增益和非線性觀測函數,最后是我們更新誤差協方差的方程:

????????在最后一個示例中,這將使用 Jocabian 來線性化角旋轉對我們對象的非線性影響,并適當修改代碼。設計 EKF 比 KF 更具挑戰性,因為我們對一階線性近似的假設可能會無意中將誤差引入到我們的狀態估計中。此外,雅可比行列式計算可能會變得復雜、計算成本高昂且難以在某些情況下定義,這也可能導致錯誤。然而,如果設計正確,EKF 通常會優于 KF 實現。

????????在我們上一個 Python 示例的基礎上,我介紹了 EKF 的實現:

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3Dclass ExtendedKalmanFilter:"""An implementation of the Extended Kalman Filter (EKF).This filter is suitable for systems with non-linear dynamics by linearisingthe system model at each time step using the Jacobian.Attributes:state_transition (callable): The state transition function for the system.jacobian_F (callable): Function to compute the Jacobian of the state transition.H (np.ndarray): The observation matrix.jacobian_H (callable): Function to compute the Jacobian of the observation model.Q (np.ndarray): The process noise covariance matrix.R (np.ndarray): The measurement noise covariance matrix.x (np.ndarray): The initial state estimate.P (np.ndarray): The initial estimate covariance."""def __init__(self, state_transition, jacobian_F, observation_matrix, jacobian_H, Q, R, x, P):"""Constructs the Extended Kalman Filter.Parameters:state_transition (callable): The state transition function.jacobian_F (callable): Function to compute the Jacobian of F.observation_matrix (np.ndarray): Observation matrix.jacobian_H (callable): Function to compute the Jacobian of H.Q (np.ndarray): Process noise covariance.R (np.ndarray): Measurement noise covariance.x (np.ndarray): Initial state estimate.P (np.ndarray): Initial estimate covariance."""self.state_transition = state_transition  # Non-linear state transition functionself.jacobian_F = jacobian_F  # Function to compute Jacobian of Fself.H = observation_matrix  # Observation matrixself.jacobian_H = jacobian_H  # Function to compute Jacobian of Hself.Q = Q  # Process noise covarianceself.R = R  # Measurement noise covarianceself.x = x  # Initial state estimateself.P = P  # Initial estimate covariancedef predict(self, u):"""Predicts the state at the next time step.Parameters:u (np.ndarray): The control input vector."""self.x = self.state_transition(self.x, u)F = self.jacobian_F(self.x, u)self.P = F @ self.P @ F.T + self.Qdef update(self, z):"""Updates the state estimate with a new measurement.Parameters:z (np.ndarray): The measurement vector."""H = self.jacobian_H()y = z - self.H @ self.xS = H @ self.P @ H.T + self.RK = self.P @ H.T @ np.linalg.inv(S)self.x = self.x + K @ yself.P = (np.eye(len(self.x)) - K @ H) @ self.P# Define the non-linear transition and Jacobian functions
def state_transition(x, u):"""Defines the state transition function for the system with non-linear dynamics.Parameters:x (np.ndarray): The current state vector.u (np.ndarray): The control input vector containing time step and rate of change of angular velocity.Returns:np.ndarray: The next state vector as predicted by the state transition function."""dt = u[0]alpha = u[1]x_next = np.array([x[0] - x[3] * x[1] * dt,x[1] + x[3] * x[0] * dt,x[2] + x[3] * dt,x[3],x[4] + alpha * dt])return x_nextdef jacobian_F(x, u):"""Computes the Jacobian matrix of the state transition function.Parameters:x (np.ndarray): The current state vector.u (np.ndarray): The control input vector containing time step and rate of change of angular velocity.Returns:np.ndarray: The Jacobian matrix of the state transition function at the current state."""dt = u[0]# Compute the Jacobian matrix of the state transition functionF = np.array([[1, -x[3]*dt, 0, -x[1]*dt, 0],[x[3]*dt, 1, 0, x[0]*dt, 0],[0, 0, 1, dt, 0],[0, 0, 0, 1, 0],[0, 0, 0, 0, 1]])return Fdef jacobian_H():# Jacobian matrix for the observation function is simply the observation matrixreturn H# Simulation parameters
num_steps = 100
dt = 1.0
alpha = 0.01  # Rate of change of angular velocity# Observation matrix, assuming we can directly observe the x, y, and z position
H = np.eye(3, 5)# Process noise covariance matrix
Q = np.diag([0.1, 0.1, 0.1, 0.1, 0.01])# Measurement noise covariance matrix
R = np.diag([0.5, 0.5, 0.5])# Initial state estimate and covariance
x0 = np.array([0, 20, 0, 0.5, 0.1])  # [x, y, z, v, omega]
P0 = np.eye(5)# Instantiate the EKF
ekf = ExtendedKalmanFilter(state_transition, jacobian_F, H, jacobian_H, Q, R, x0, P0)# Generate true trajectory and measurements
true_states = []
measurements = []
for t in range(num_steps):u = np.array([dt, alpha])true_state = state_transition(x0, u)  # This would be your true system modeltrue_states.append(true_state)measurement = true_state[:3] + np.random.multivariate_normal(np.zeros(3), R)  # Simulate measurement noisemeasurements.append(measurement)x0 = true_state  # Update the true state# Now we run the EKF over the measurements
estimated_states = []
for z in measurements:ekf.predict(u=np.array([dt, alpha]))ekf.update(z=np.array(z))estimated_states.append(ekf.x)# Convert lists to arrays for plotting
true_states = np.array(true_states)
measurements = np.array(measurements)
estimated_states = np.array(estimated_states)# Plotting the results
fig = plt.figure(figsize=(12, 9))
ax = fig.add_subplot(111, projection='3d')# Plot the true trajectory
ax.plot(true_states[:, 0], true_states[:, 1], true_states[:, 2], label='True Trajectory')
# Increase the size of the start and end markers for the true trajectory
ax.scatter(true_states[0, 0], true_states[0, 1], true_states[0, 2], label='Start (Actual)', c='green', marker='x', s=100)
ax.scatter(true_states[-1, 0], true_states[-1, 1], true_states[-1, 2], label='End (Actual)', c='red', marker='x', s=100)# Plot the measurements
ax.scatter(measurements[:, 0], measurements[:, 1], measurements[:, 2], label='Measurements', alpha=0.6)
# Plot the start and end markers for the measurements
ax.scatter(measurements[0, 0], measurements[0, 1], measurements[0, 2], c='green', marker='o', s=100)
ax.scatter(measurements[-1, 0], measurements[-1, 1], measurements[-1, 2], c='red', marker='x', s=100)# Plot the EKF estimate
ax.plot(estimated_states[:, 0], estimated_states[:, 1], estimated_states[:, 2], label='EKF Estimate')ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.legend()plt.show()

六、簡單總結

????????在本博客中,我們深入探討了如何構建和應用卡爾曼濾波器 (KF),以及如何實現擴展卡爾曼濾波器 (EKF)。最后,我們總結一下這些模型的用例、優點和缺點。

????????KF:該模型適用于線性系統,我們可以假設狀態轉移和觀察矩陣是狀態的線性函數(帶有一些高斯噪聲)。您可以考慮將此算法應用于:

  • 跟蹤以恒定速度移動的物體的位置和速度
  • 如果噪聲是隨機的或可以用線性模型表示的信號處理應用
  • 如果底層關系可以線性建模,則可以進行經濟預測

KF 的主要優點是(一旦遵循矩陣計算)該算法非常簡單,計算強度比其他方法少,并且可以及時提供系統真實狀態的非常準確的預測和估計。缺點是線性假設在復雜的現實場景中通常不成立。

????????EKF:我們本質上可以將 EKF 視為 KF 的非線性等價物,并得到雅可比行列式的使用支持。如果您正在處理以下問題,您會考慮 EKF:

  • 測量和系統動力學通常是非線性的機器人系統
  • 通常涉及非恒定速度或角速率變化的跟蹤和導航系統,例如跟蹤飛機或航天器的跟蹤和導航系統。
  • 汽車系統在實施最現代“智能”汽車中的巡航控制或車道保持時。

????????EKF 通常會產生比 KF 更好的估計,特別是對于非線性系統,但由于雅可比矩陣的計算,它的計算量可能會更大。該方法還依賴于泰勒級數展開式的一階線性近似,這對于高度非線性系統可能不是合適的假設。添加雅可比行列式還可能使模型的設計更具挑戰性,因此盡管有其優點,但為了簡單性和互操作性而實現 KF 可能更合適。吉米·韋弗

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/162357.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/162357.shtml
英文地址,請注明出處:http://en.pswp.cn/news/162357.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

天池 機器學習算法(一): 基于邏輯回歸的分類預測

pytorch實戰 課時7 神經網絡 MSE的缺點:偏導值在輸出概率值接近0或者接近1的時候非常小,這可能會造成模型剛開始訓練時,偏導值幾乎消失,模型速度非常慢。 交叉熵損失函數:平方損失則過于嚴格,需要使用更合…

開始通過 Amazon SageMaker JumpStart 在亞馬遜云科技上使用生成式 AI

目前,生成式 AI 正受到公眾的廣泛關注,人們圍繞著許多人工智能技術展開討論。很多客戶一直在詢問有關亞馬遜云科技生成式 AI 解決方案的更多信息,本文將為您進行解答。 這篇文章通過一個真實的客戶使用案例概述了生成式 AI,提供了…

感恩節99句祝福語,感恩父母老師朋友親人朋友們,永久快樂幸福

1、流星讓夜空感動,生死讓人生感動,愛情讓生活感動,你讓我感動,在感恩節真心祝福你比所有的人都開心快樂。 2、感恩節到了,想問候你一下,有太多的話語想要說,但是不知從何說起,還是用…

定位鼠標懸浮才出現的元素

第一步:按F12進入開發者模式 第二步:點擊Sources. 第三步:鼠標進入,觸發懸浮框彈出,然后鼠標停止不要移動。 第四步:按F8 或者(Ctrl\),正常情況下,此時頁…

讓SOLIDWORKS Composer動畫在PPT中隨意轉換

SOLIDWORKS Composer作為一款易學易用的技術圖解軟件,非常適合用來給客戶展示自己的產品。這里我們教大家如何將Composer文件插入大PPT中,并任意切換文件,用以給客戶展示不用的方案和產品。 1.首先大家要安裝SOLIDWORKS Composer Player 這個…

【2021集創賽】基于ARM-M3的雙目立體視覺避障系統 SOC設計

本作品參與極術社區組織的有獎征集|秀出你的集創賽作品風采,免費電子產品等你拿~活動。 團隊介紹 參賽單位:上海電力大學 隊伍名稱:駭行隊 總決賽獎項:二等獎 1.摘要 隨著信息技術的發展,AGV(Automated Guided Vehic…

21款奔馳GLC260L升級HUD抬頭顯示 平視儀表信息

隨著科技飛速地發展,從汽車領域就可以看出,尤其是汽車的抬頭顯示器,一經推出就吸引了很多的車主。 升級HUD抬頭顯示,HUD與汽車系統進行完整的數據信息連接,整合成大數據,然后將一些重要信息映射到車窗玻璃…

中低壓MOSFET 2N7002W 60V 300mA 雙N通道 SOT-323封裝

2N7002W小電流雙N通道MOSFET,電壓60V電流300mA,采用SOT-323封裝形式。超高密度電池設計,適用于極低的ros (on),具有導通電阻和最大直流電流能力,ESD保護。可應用于筆記本中的電源管理,電池供電系統等產品應…

VUE3+Springboot實現SM2完整步驟

一.VUE3代碼實現 1.安裝依賴 npm install --save sm-crypto 2.導入sm2 const sm2 require(sm-crypto).sm2 3.定義公鑰私鑰 var privateKey "私鑰";//解密使用 var publicKey "公鑰";//加密使用 4.設置加密模式 //cipherMode [加密模式 C1C3C2:1,…

2023亞太杯數學建模競賽C題思路分析+代碼+論文

C題:The Development Trend of New Energy Electric Vehicles in China中國談新能源電動汽車的發展趨勢 新能源汽車是指采用先進的技術原理、新技術和新結構,以非常規車用燃料為動力來源(非常規車用燃料是指除汽油和柴油以外的燃料),并集成了…

通過Everything 建立HTTP服務器時指定文件夾共享

在局域網傳輸文件,高效傳輸,不限文件大小 1、安裝Everything 2、在Everything開啟HTTP服務 【工具】—>>【選項】—>>【HTTP服務】啟用HTTP服務器,設置HTTP服務器用戶名和密碼 3、查看網絡信息 打開服務端電腦的【命令提示…

SpringCache使用詳解

SpringCache 1.新建測試項目SpringCache2.SpringCache整合redis2.1.Cacheable2.2.CacheEvict2.3.Cacheput2.4.Caching2.5.CacheConfig 3.SpringCache問題4.SpringCache實現多級緩存 1.新建測試項目SpringCache 引入依賴 <dependencies><dependency><groupId&g…

el-table如何動態增加列

el-table如何動態添加列&#xff1a; 1. 將數據從列表中拋出來直接放到對象中&#xff1a; data.forEach(el > {el.shipList.forEach(item > {el[item.FieldTag] item.DateTimeValue;});}); 2. 網頁&#xff1a; planFormList是列表內容&#xff0c;循環出來當做表頭。…

內褲洗衣機有用嗎?口碑最好的小型洗衣機

想必各位小伙伴都知道我們的貼身衣物&#xff0c;不可以與其他衣服一起在洗衣機中清洗&#xff0c;每次都需要把內衣褲挑選出來手洗&#xff0c;但是我們每天都要上廁所&#xff0c;難免會沾上污漬和細菌&#xff0c;我們在用手搓洗的過程中很難把細菌給清除掉&#xff0c;所以…

ios打包,證書獲取

HBuilderX 打包ios界面&#xff1a; Bundle ID(AppID)&#xff1a; 又稱應用ID&#xff0c;是每一個ios應用的唯一標識&#xff0c;就像一個人的身份證號碼&#xff1b; 每開發一個新應用&#xff0c;首先都需要先去創建一個Bundle ID Bundle ID 格式&#xff1a; 一般為&…

用Python寫了一個貪吃蛇大冒險小游戲

一、游戲簡介 1.1 游戲操作及游戲規則 &#xff08;1&#xff09;游戲開始后&#xff0c;通過鍵盤上下左右鍵控制貪吃蛇移動尋找食物&#xff1b; &#xff08;2&#xff09;貪吃蛇每吃一個食物&#xff0c;身長會增加一個單位&#xff1b; &#xff08;3&#xff09;在正常模…

CSDN文章保存為MD文檔(二)

免責聲明 文章僅做經驗分享用途&#xff0c;利用本文章所提供的信息而造成的任何直接或者間接的后果及損失&#xff0c;均由使用者本人負責&#xff0c;作者不為此承擔任何責任&#xff0c;一旦造成后果請自行承擔&#xff01;&#xff01;&#xff01; import sys sys.path.a…

【HarmonyOS】 低代碼平臺組件拖拽使用技巧之登錄組件

【關鍵字】 HarmonyOS、低代碼平臺、組件拖拽、登錄組件、代碼編輯器 1、寫在前面 前面我們介紹了低代碼中堆疊容器、滾動容器、網格布局、頁簽容器以及一些常用容器和組件的拖拽使用方法&#xff0c;本篇我們來介紹一個新的組件&#xff0c;這個組件是屬于業務組件——登錄組…

Modbus轉Profinet網關:PLC與天信流量計通訊的經典案例

無論您是PLC或工業設備的制造商&#xff0c;還是工業自動化系統的維護人員&#xff0c;可能會遇到需要將不同協議的設備連接組合并通訊的情況&#xff0c;Modbus和Profinet是現代工業自動化中常見的兩種通信協議&#xff0c;在工業控制領域中被廣泛應用。 在這種情況絕大多數會…

快速上手Banana Pi BPI-M4 Zero 全志科技H618開源硬件開發開發板

Linux[編輯] 準備[編輯] 1. Linux鏡像支持SD卡或EMMC啟動&#xff0c;并且會優先從SD卡啟動。 2. 建議使用A1級卡&#xff0c;至少8GB。 3. 如果您想從 SD 卡啟動&#xff0c;請確保可啟動 EMMC 已格式化。 4. 如果您想從 EMMC 啟動并使用 Sdcard 作為存儲&#xff0c;請確…