Git Product home page Git Product logo

Comments (17)

HqWei avatar HqWei commented on September 26, 2024 3

I have trained it however I get the following error:
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
image

from convcrf.

MarvinTeichmann avatar MarvinTeichmann commented on September 26, 2024

ConvCRFs can be trained using PyTorch. Training is straight forward and can be done like any other neural network. Iterate over the training data, apply softmax cross-entropy loss and use the pytorch autograd package to backprop.

I strongly recommend that you implement your own pipeline. Having a good understanding of your training process is quite crucial in deep learning.

I am considering to make my pipeline public, however the code is currently quite messy, undocumented and will not work out of the box. I think implementing your own pipeline by following some of the pytorch tutorials is much more rewarding and easiert then trying to make mine work.

Edit: I deleted part of my earlier response to increase my overall niceness. You can find the full response in the changelog.

from convcrf.

chenypic avatar chenypic commented on September 26, 2024

Thanks for your detailed response. I appreciate it, and I agree with you. I will implement my own pipeline according to your paper and my task.

from convcrf.

SHMCU avatar SHMCU commented on September 26, 2024

Hi Marvin,
I wrote a script to train the convCRF using nll loss. I treat the air plane image as a two class segmentation problem. At the beginning the training went well, the segmentation was improving, but if I keep train it, it would not converge. It reaches the min loss value then the loss stated to increase and the segmentation become worse. Finally, the result become look like the noisy unary. Could you give me some suggestions on what problem this could be? Thank you very much!

Hai

from convcrf.

prio1988 avatar prio1988 commented on September 26, 2024

Hi Hai,

may I ask you why have you used the nll loss and not the cross entropy loss in the training?

Thanks

from convcrf.

hsu-z2 avatar hsu-z2 commented on September 26, 2024

Hi prio1988,

I think nll loss is actually multiclass cross entropy, right? It should also work when I set the model to work on only two classes, that is background and foreground. Right?

from convcrf.

prio1988 avatar prio1988 commented on September 26, 2024

Nll loss assume that you have already applied a logSoftMax layer on the top of your network. The multi class cross entropy loss is the torch.nn.CrossEntropyLoss. I think that probably you should use the last one. Instead I am still wondering why to apply a logsoftmax on the unary instead that just a softmax.

from convcrf.

SHMCU avatar SHMCU commented on September 26, 2024

from convcrf.

prio1988 avatar prio1988 commented on September 26, 2024

If you use the crossEntropyLoss you can avoid also the softmax. It is done internally by the loss.

from convcrf.

SHMCU avatar SHMCU commented on September 26, 2024

from convcrf.

HqWei avatar HqWei commented on September 26, 2024

Is there any one having tried training?

from convcrf.

qiqihaer avatar qiqihaer commented on September 26, 2024

I have trained it however I get the following error:
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
image

I have the same problem. Have you solved it?

from convcrf.

pvthuy avatar pvthuy commented on September 26, 2024

@HqWei @qiqihaer Could you share a portion of your code for training convCRF?

from convcrf.

SHMCU avatar SHMCU commented on September 26, 2024

from convcrf.

pvthuy avatar pvthuy commented on September 26, 2024

@SHMCU It's very helpful. Thank you very much!

from convcrf.

GITSHOHOKU avatar GITSHOHOKU commented on September 26, 2024

@SHMCU It's very helpful. Thank you very much!

Hi, did you solve the in-place operation problem?
Should we set CRF iteration step to 1 to avoid this error? I tried it on PACCRF and the same problem occured.

from convcrf.

GITSHOHOKU avatar GITSHOHOKU commented on September 26, 2024

ConvCRFs can be trained using PyTorch. Training is straight forward and can be done like any other neural network. Iterate over the training data, apply softmax cross-entropy loss and use the pytorch autograd package to backprop.

I strongly recommend that you implement your own pipeline. Having a good understanding of your training process is quite crucial in deep learning.

I am considering to make my pipeline public, however the code is currently quite messy, undocumented and will not work out of the box. I think implementing your own pipeline by following some of the pytorch tutorials is much more rewarding and easiert then trying to make mine work.

Edit: I deleted part of my earlier response to increase my overall niceness. You can find the full response in the changelog.

Hi, I have a question about the training step with this wonderful CRF impletement.
Should we set CRF iteration step=1 in training step ? And in inference step to set it bigger than 1?

from convcrf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.