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

YOLO v1 loss #164

Open
curry0505 opened this issue Sep 19, 2023 · 0 comments
Open

YOLO v1 loss #164

curry0505 opened this issue Sep 19, 2023 · 0 comments

Comments

@curry0505
Copy link

curry0505 commented Sep 19, 2023

    `object_loss = self.mse(
        torch.flatten(exists_box * pred_box),
        torch.flatten(exists_box * target[..., 20:21]),
    )

    # ======================= #
    #   FOR NO OBJECT LOSS    #
    # ======================= #

    #max_no_obj = torch.max(predictions[..., 20:21], predictions[..., 25:26])
    #no_object_loss = self.mse(
    #    torch.flatten((1 - exists_box) * max_no_obj, start_dim=1),
    #    torch.flatten((1 - exists_box) * target[..., 20:21], start_dim=1),
    #)

    no_object_loss = self.mse(
        torch.flatten((1 - exists_box) * predictions[..., 20:21], start_dim=1),
        torch.flatten((1 - exists_box) * target[..., 20:21], start_dim=1),
    )

    no_object_loss += self.mse(
        torch.flatten((1 - exists_box) * predictions[..., 25:26], start_dim=1),
        torch.flatten((1 - exists_box) * target[..., 20:21], start_dim=1)
    )`

https://github.com/aladdinpersson/Machine-Learning-Collection/blob/558557c7989f0b10fee6e8d8f953d7269ae43d4f/ML/Pytorch/object_detection/YOLO/loss.py#L83C1-L106C10

Why does object_loss not use start_dim, while no_object_loss does? Whether or not no_object_loss uses start_dim, the result is the same.

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

1 participant