portrait_matting icon indicating copy to clipboard operation
portrait_matting copied to clipboard

problem about code

Open Devin147 opened this issue 6 years ago • 15 comments

    # 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?

Devin147 avatar Jul 14 '18 03:07 Devin147

Why do you think its a problem @Devin147 ?

Raj-08 avatar Jul 17 '18 06:07 Raj-08

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

GuideWsp avatar Jul 25 '18 12:07 GuideWsp

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

dsArtem avatar Aug 09 '18 04:08 dsArtem

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.

GuideWsp avatar Aug 09 '18 04:08 GuideWsp

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

dsArtem avatar Aug 09 '18 05:08 dsArtem

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.

GuideWsp avatar Aug 09 '18 05:08 GuideWsp

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(), }

dsArtem avatar Aug 09 '18 06:08 dsArtem

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

GuideWsp avatar Aug 09 '18 07:08 GuideWsp

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

dsArtem avatar Aug 09 '18 08:08 dsArtem

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

assertdebug avatar Dec 05 '18 06:12 assertdebug

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

puphy avatar Dec 12 '18 01:12 puphy

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

kkkmax avatar Jan 07 '19 06:01 kkkmax

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

headhu avatar May 13 '19 16:05 headhu

Does anybody get the results as the paper shown?

Maru-chan511 avatar Jul 10 '19 03:07 Maru-chan511

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

Maru-chan511 avatar Jul 10 '19 03:07 Maru-chan511