box):dw=1./size[0]dh=1./size[1]x=(box[0]+box[1])/2.0y=(box[2]+box[3])/2.0w=box[1]-box[0]h=box[3]-box[2]x=x*dww=w*dwy=y*dhh=h*dhreturn(x,y,w,h)defconvert_annotation
downsampled_bboxes[:, 2] *= mw / iw downsampled_bboxes[:, 3] *= mh / ih downsampled_bboxes[:, 1] *= mh / ih #因爲模型是先預測box,再在box裡面預測分割結果,故只關注box裡面的mask(最終預測的mask遠比輸入圖片小) masks = crop_mask(masks, downsampled_bboxes) # CHW if upsample:...
1、训练的时候出现box_loss、cls_loss、dfl_loss都为nan的情况,需要将训练的时候的参数进行修改,设置amp=False 2、修改之后训练的时候出现P、R、map值为NAN或者非常小,一般来说基于预训练模型来进行训练P、R、map的值都不会很低,如果出现0.0x这种一般是有点问题,这种情况可以尝试以下操作,需要到ultralytics/cfg...
定位损失box_loss:预测框与标定框之间的误差(GIoU),越小定位得越准; 分类损失cls_loss:计算锚框与对应的标定分类是否正确,越小分类得越准; 动态特征损失(dfl_loss):DFLLoss是一种用于回归预测框与目标框之间距离的损失函数。在计算损失时,目标框需要缩放到特征图尺度,即除以相应的stride,并与预测的边界框计算Cio...
Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size 1/10 2.61G 1.153 1.398 1.192 81 640: 1 Class Images Instances Box(P R mAP50 m all 128 929 0.688 0.506 0.61 0.446 Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size ...
这个问题就消失了。在ultralytics 8.0.26的环境中一切正常,然后我在8.0.30左右的环境中发现了NaN...
bbox_iou(pred_bboxes[fg_mask], target_bboxes[fg_mask], xywh=False, CIoU=True)# 计算 IoU 损失loss_iou = ((1.0- iou) * weight).sum() / target_scores_sum# 计算 DFL lossifself.dfl_loss:# 将锚点和目标边界框转换成距离形式target_ltrb = bbox2dist(anchor_points, target_bboxes, ...
Lower box_loss means the model is better at predicting where objects are and their scale. cls_loss (classification loss) measures the accuracy of predicting the correct category of the objects within the bounding boxes. Lower cls_loss points towards a more accurate classification of objects. dfl...
Search before asking I have searched the YOLOv8 issues and found no similar bug report. YOLOv8 Component Training Bug While Training the model in v8 with GPU all the losses becomes nan and all the evaluation metrics becomes zero. Under A...
box=7.5, cls=0.5, dfl=1.5, pose=12.0, kobj=1.0, label_smoothing=0.0, nbs=64, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0, auto_augment=randaugment, erasing=...