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

Training with MultiScale loss #276

Open
zinuok opened this issue Dec 7, 2022 · 0 comments
Open

Training with MultiScale loss #276

zinuok opened this issue Dec 7, 2022 · 0 comments

Comments

@zinuok
Copy link

zinuok commented Dec 7, 2022

Hello,
I'm trying to fine-tune the whole FlowNet2 network from the provided pre-trained weights,
with the multi-scale loss by:

...
--loss=MultiScale \
--loss_norm=L1 \
...

However, the model returns only single flow output from the last fusion layer

        return flownetfusion_flow

and in the MultiScale class, the type of the flow output, which is passed as an argument, is checked

        if type(output) is tuple:
            target = self.div_flow * target
            for i, output_ in enumerate(output):
                target_ = self.multiScales[i](target)
                epevalue += self.loss_weights[i]*EPE(output_, target_)
                lossvalue += self.loss_weights[i]*self.loss(output_, target_)
            return [lossvalue, epevalue]
        else:
            epevalue += EPE(output, target)
            lossvalue += self.loss(output, target)
            return  [lossvalue, epevalue]

The problem is that the type of model output is not always a tuple, so it falls to the else branch, which is the same as a simple L1loss.

Looking at the related issue: issue 28,
I guess the multiscale loss was designed to train only a part of the model, i.e. FlowNetC/S, separately.
Is it right?

Thank you

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