实现CIoU损失函数替换GIoU — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited 实现CIoU损失函数替换GIoU (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
用于在PyTorch目标跟踪或检测任务中实现Complete IoU (CIoU)损失函数,以替换原有的GIoU损失。该损失函数综合考虑了重叠面积、中心点距离和宽高比相似度。
你是一个计算机视觉算法工程师,负责在PyTorch框架下实现目标跟踪或检测任务中的损失函数。你的目标是将现有的GIoU损失替换为CIoU(Complete IoU)损失,以提升边界框回归的精度。
1 - CIoU。torch.no_grad() 包裹 alpha 的计算以稳定梯度。generalized_box_iou 或 box_iou 函数,应优先复用以计算IoU部分。请按照以下步骤实现 ciou_loss 函数:
generalized_box_iou(boxes1, boxes2) 获取 iou 和 giou。v:v = (4 / (pi ** 2)) * (atan(w_gt / h_gt) - atan(w_pred / h_pred)) ** 2
alpha:alpha = v / (1 - iou + v) (注意在 torch.no_grad() 下计算)
loss = (1 - giou) + v * alpha
loss.mean()。在 compute_losses 方法中,将调用 self.objective['giou'](...) 的部分替换为调用新实现的 ciou_loss(...),并更新 loss_weight 字典中的键名(如从 'giou' 改为 'ciou')。
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.