Here’s a clear, structured text-based loss function description based on your requirements:
Loss Function Overview
The loss function evaluates how well the predicted values match the target values for two key components:
- Direction (represented as
(sin_dir, cos_dir)).
- Half-Field-of-View (half-FOV) (represented as
(sin_fov, cos_fov)).
The target expects the same structure: (sin_dir_target, cos_dir_target, sin_fov_target, cos_fov_target).
Key Rules and Priorities
-
Direction Alignment
- The predicted direction
(sin_dir_pred, cos_dir_pred) should closely match the target direction (sin_dir_target, cos_dir_target).
- Penalty: If the predicted direction differs significantly from the target, apply a penalty. However, this penalty is lower priority if the FoV already contains the target direction.
-
Half-FOV Size Consistency
- The predicted half-FOV
(sin_fov_pred, cos_fov_pred) should be close to the target half-FOV (sin_fov_target, cos_fov_target).
- Penalty: If the predicted half-FOV is much larger or much smaller than the target, apply a penalty. This ensures the FOV is neither overly broad nor overly narrow.
-
FoV Containment of Target Direction
- The predicted FOV (centered at the predicted direction with the predicted half-FOV) must contain the target direction.
- Penalty: If the target direction lies outside the predicted FOV, apply a severe penalty. This is the highest priority rule.
Penalty Hierarchy
- FoV Containment: Highest priority.
- If the predicted FOV does not contain the target direction, the penalty is maximized, regardless of direction or FOV size.
- Half-FOV Size: Medium priority.
- If the predicted half-FOV is significantly different (too large or too small) from the target, apply a penalty.
- Direction Alignment: Lowest priority.
- If the predicted direction differs from the target but the FOV contains the target, the penalty is minimized.
Summary
The loss function ensures:
- The predicted FOV contains the target direction (strict requirement).
- The predicted half-FOV size is close to the target.
- The predicted direction aligns with the target (but only if the FOV already contains the target).
This prioritizes FoV containment first, followed by FOV size accuracy, and finally direction alignment.
Let me know if you need this formalized into a mathematical formula or code!