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 the training implementation #5

Open
chenypic opened this issue May 16, 2018 · 17 comments
Open

about the training implementation #5

chenypic opened this issue May 16, 2018 · 17 comments

Comments

@chenypic
Copy link

Great work. Thanks for your code. Do you have a plan to publish the training implementation? I really want to follow your job.

@MarvinTeichmann
Copy link
Owner

MarvinTeichmann commented May 16, 2018

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.

@chenypic
Copy link
Author

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.

@SHMCU
Copy link

SHMCU commented Aug 27, 2018

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

@prio1988
Copy link

Hi Hai,

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

Thanks

@hsu-z2
Copy link

hsu-z2 commented Aug 28, 2018

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?

@prio1988
Copy link

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.

@SHMCU
Copy link

SHMCU commented Aug 28, 2018 via email

@prio1988
Copy link

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

@SHMCU
Copy link

SHMCU commented Aug 28, 2018 via email

@HqWei
Copy link

HqWei commented Jan 16, 2019

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

@HqWei
Copy link

HqWei commented Jan 16, 2019

Is there any one having tried training?

@qiqihaer
Copy link

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?

@pvthuy
Copy link

pvthuy commented Jun 2, 2020

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

@SHMCU
Copy link

SHMCU commented Jun 2, 2020 via email

@pvthuy
Copy link

pvthuy commented Jun 3, 2020

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

@GITSHOHOKU
Copy link

@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.

@GITSHOHOKU
Copy link

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?

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

9 participants