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

Batch-aware loss function? #43

Open
yassineAlouini opened this issue Mar 25, 2021 · 3 comments
Open

Batch-aware loss function? #43

yassineAlouini opened this issue Mar 25, 2021 · 3 comments

Comments

@yassineAlouini
Copy link

yassineAlouini commented Mar 25, 2021

As far as I my understanding goes, the lcfcn loss works with one sample per batch. Is that really the case?

If so, how hard would it be to adapt it to more than one sample per batch?

I have tried this code:

loss = torch.mean(
    torch.Tensor(
        [
            lcfcn_loss.compute_loss(points=points[i], probs=logits[i].sigmoid())
            for i in range(points.shape[0])
        ]
    )
)

Could that work? 🤔

Thanks for any help!

@IssamLaradji
Copy link
Collaborator

IssamLaradji commented Mar 29, 2021

Hiya @yassineAlouini , what you suggested should work! It might be a bit slow, and the learning rate might need to be adjusted.

LCFCN does not work natively with batch sizes larger than one, mainly because the watershed algorithm does not support more than one image. If there is a Pytorch-based watershed method, then we could incorporate it and make LCFCN support larger batches.

Thanks for the nice, concise code in making the code support batches larger than 1.

@yassineAlouini
Copy link
Author

Indeed, watershed is probably the limiting part for now. I will have a look at a pytorch implementation and update with more details. Thanks for the quick feedback.

@yassineAlouini
Copy link
Author

yassineAlouini commented Apr 2, 2021

I have found this: https://paperswithcode.com/paper/deep-watershed-transform-for-instance. Not sure how useful it could be, I probably need some exploration to see if we can extract the watershed part of it.

Here is a Pytorch implementation: https://github.com/timothyn617/watershed-transform

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

2 participants