Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About ciou and diou loss. #7608

Open
SpongeBab opened this issue Apr 15, 2021 · 7 comments
Open

About ciou and diou loss. #7608

SpongeBab opened this issue Apr 15, 2021 · 7 comments

Comments

@SpongeBab
Copy link

Hi,@cenit, Maybe I found a code bug.
It's not a error.But it haven't do the thing correctly.
In yolo_layer.c:

                 args->tot_iou += all_ious.iou;
                args->tot_iou_loss += 1 - all_ious.iou;
                // range is -1 <= giou <= 1
                tot_giou += all_ious.giou;
                args->tot_giou_loss += 1 - all_ious.giou;

                tot_diou += all_ious.diou;
                tot_diou_loss += 1 - all_ious.diou;

                tot_ciou += all_ious.ciou;
                tot_ciou_loss += 1 - all_ious.ciou;

the tot_iou_loss and tot_giou_loss use the args pointer to return to yolo_args,so we can see

        yolo_args[b].tot_iou_loss = 0;
        yolo_args[b].tot_giou_loss = 0;

but the I want to use the ciou_loss and diou_loss,maybe it doesn't work.
Such as in the cfg file :
iou_loss=ciou
but in there,it don't have ciou option:

            if (l.iou_loss == GIOU) {
                avg_iou_loss = count > 0 ? l.iou_normalizer * (tot_giou_loss / count) : 0;  //count = batch
            }
            else {
                avg_iou_loss = count > 0 ? l.iou_normalizer * (tot_iou_loss / count) : 0;  //
            }

Am i right?

@WilburZjh
Copy link

@AlexeyAB
Same concerns, how to use CIOU and DIOU loss? just modify the config file?

@SpongeBab
Copy link
Author

SpongeBab commented May 19, 2021

@WilburZjh It is seemed that there is no more people that concern the question.
I think it doesn't implement the CIoU and DIoU loss.Altough it is defined in the box.c,but it is imperfect.The Scale-yolo used the CIoU and DIoU,but it is implemented in python.Although it is supported in the darknet,but there is no trained result submitted.

@WilburZjh
Copy link

@SpongeBab I found some useful information in the wiki, https://github.com/AlexeyAB/darknet/wiki/CFG-Parameters-in-the-different-layers, it defines the CIoU and DIoU as iou_loss, I think we can just change the name in the cfg file.

@zzk2021
Copy link

zzk2021 commented Mar 24, 2024

same question . no use for variable

float tot_diou_loss = 0;
float tot_ciou_loss = 0;  

in function forward_yolo_layer
and there is no diou ciou loss added in l.cost
some one say that l.cost is only show ,not use for network.
but no diou ciou add in args

// range is 0 <= 1
                        args->tot_iou += all_ious.iou;
                        args->tot_iou_loss += 1 - all_ious.iou;
                        // range is -1 <= giou <= 1
                        tot_giou += all_ious.giou;
                        args->tot_giou_loss += 1 - all_ious.giou;

                        tot_diou += all_ious.diou;
                        tot_diou_loss += 1 - all_ious.diou;

                        tot_ciou += all_ious.ciou;
                        tot_ciou_loss += 1 - all_ious.ciou;

@zzk2021
Copy link

zzk2021 commented Mar 24, 2024

@WilburZjh It is seemed that there is no more people that concern the question. I think it doesn't implement the CIoU and DIoU loss.Altough it is defined in the box.c,but it is imperfect.The Scale-yolo used the CIoU and DIoU,but it is implemented in python.Although it is supported in the darknet,but there is no trained result submitted.

Is there a corresponding py file?I confuse about it but I cant find any file claim CIoU and DIoU

@zzk2021
Copy link

zzk2021 commented Mar 24, 2024

It is important for me cause I use own iou loss, I want to know the reason do that

@zzk2021
Copy link

zzk2021 commented Mar 24, 2024

l.delta is used for cost,not l.cost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants