update the latest weight

This commit is contained in:
TJU_Lu 2025-06-24 23:13:26 +08:00
parent 194e5788f8
commit cc13b0e293
4 changed files with 9 additions and 8 deletions

View File

@ -20,7 +20,7 @@ expand_y_times: 0 # y方向复制次数cuda版不使用
occupy_threshold: 0 # 大于多少个点才认为占据cpu版不使用
# 2.2 随机地图
seed: 2
seed: 3
x_length: 60 # 真正随机范围(XY更大范围处为其镜像)
y_length: 60
z_length: 15

View File

@ -1,6 +1,7 @@
# IMPORTANT PARAM: actual velocity in training / test
# IMPORTANT PARAM: actual velocity in training / testing
velocity: 6.0
# used to align the vel/acc, if vel*n then acc*n*n
# used to align the vel/acc, ensure consistency between testing and training.
# during testing, if vel*n then acc*n*n, please refer to ../policy/primitive.py
vel_align: 6.0
acc_align: 6.0

View File

@ -19,9 +19,9 @@ class GuidanceLoss(nn.Module):
Df: fixed parameters: (batch_size, 3, 3) [px, vx, ax; py, vy, ay; pz, vz, az]
goal: (batch_size, 3)
Returns:
similarity: (batch_size) guidance loss
guidance_loss: (batch_size) guidance loss
GuidanceLoss: Projection length of the trajectory onto the goal direction: higher cosine similarity and longer trajectory are preferred
GuidanceLoss: distance_loss (better near the goal) or similarity_loss (better during flight) or terminal_aware_similarity_loss (balanced)
"""
cur_pos = Df[:, :, 0]
end_pos = Dp[:, :, 0]
@ -79,7 +79,7 @@ class GuidanceLoss(nn.Module):
traj_dir_proj = similarity.unsqueeze(1) * goal_dir_norm # [B, 3]
perp_component = (traj_dir - traj_dir_proj).norm(dim=1) # [B]
perp_weight = 2 * (self.goal_length - goal_length) / self.goal_length # [B]
perp_weight[perp_weight.abs() < 1e-4] = 0.0 # eliminate tiny numerical errors for stability
similarity_loss = th.abs(goal_length - similarity) + perp_weight * perp_component
perp_weight = ((self.goal_length - goal_length) / self.goal_length).clamp(min=0.0, max=0.6) # [B]
perp_weight[perp_weight < 1e-4] = 0.0 # eliminate tiny numerical errors for stability
similarity_loss = (1 - perp_weight) * th.abs(goal_length - similarity) + perp_weight * perp_component
return similarity_loss

BIN
YOPO/saved/YOPO_1/epoch50.pth Normal file → Executable file

Binary file not shown.