takiyu / portrait_matting

Implementation of "Automatic Portrait Segmentation" and "Deep Automatic Portrait Matting" with Chainer.
GNU General Public License v3.0
299 stars 70 forks source link

problem about code #6

Open Devin147 opened 6 years ago

Devin147 commented 6 years ago
    # Increase gradient of the probability
    prob = F.softmax(score, axis=1)
    prob = prob - 0.5
    prob = self.prob_scale(prob)
    prob = F.clip(prob, -0.5, 0.5)
    prob = prob + 0.5
    #in  __init__():
    self.prob_scale = L.Scale(W_shape=(1,))
    self.prob_scale.W.copydata(np.array([100.0]))

     why you scale prob 100?
Raj-08 commented 6 years ago

Why do you think its a problem @Devin147 ?

GuideWsp commented 6 years ago

it is wrong. when you scale the prob, so after clip, all the prob are zero. i have check it. so i am sure it was wrong

dsArtem commented 6 years ago

@GuideWsp could you share solution to this problem. If it was found.

GuideWsp commented 6 years ago

I change it as : prob = F.softmax(score, axis=1) prob = prob - 0.5 prob = F.clip(prob, -0.5, 0.5) prob = prob + 0.5

finaly, i have to abandon this algorithm because i really can't produce the result as the paper show. i email to the author, but got no answers.

dsArtem commented 6 years ago

Ok, thanks. I will try to fix it. Or.... Did you find other realizations of matting?

GuideWsp commented 6 years ago

you can try "Deep Image Matting". if you give a relative good trimap, it will give a good results. but it isn't an automatic algorithm. i nearly give up this topic for som reasons. recently, i focus on semantic segmentation and the related topics.

dsArtem commented 6 years ago

I found the problem. This is due to the initialization of weights. fcn8s.py: kwargs = { 'initialW': chainer.initializers.Zeros(), 'initial_bias': chainer.initializers.Zerosl(), } fixed: kwargs = { 'initialW': chainer.initializers.Normal(), 'initial_bias': chainer.initializers.Normal(), }

GuideWsp commented 6 years ago

maybe it's right. can you tell me when you get the results as the paper shown? thanks

dsArtem commented 6 years ago

Ok. I'll let you know when I get the results.

assertdebug commented 5 years ago

How to fixed this problem ? self.prob_scale.W.copydata(np.array([100.0])) @dsArtem

puphy commented 5 years ago

@dsArtem Hi, do you get a good result? I just cant't make the training convergence...

kkkmax commented 5 years ago

Brother, my three modes of training: $ python scripts/train.py --mode seg $ python scripts/train.py --mode seg+ $ python scripts/train.py --mode seg_tri

The training part looks normal, but the test was very bad and found: mode=seg mode=seg+ The test result is a gray picture

mode = seg_tri The test result is a white picture

My test command is: $ python scripts/train.py --mode {seg,seg+,seg_tri} --model_path './result/model_best' -i

Can you see where I am using the error? such as: 1) Is the model path I loaded correct? 2) Like you said W B needs to be changed to standardized initialization 3) Testing or training There is a particularly critical detail to note?

If you see a reply, I will be very grateful and happy!

@takiyu @dsArtem @Raj-08 @Devin147 @GuideWsp
@assertdebug

headhu commented 5 years ago

Hey @dsArtem is there a way to reach you by email? I think we could share some knowledge regarding this subject

Maru-chan511 commented 5 years ago

Does anybody get the results as the paper shown?

Maru-chan511 commented 5 years ago

@kkkmax why don't you try the last mode "mat"?