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

Invalid output and model #18

Open kkkmax opened 5 years ago

YealT commented 5 years ago

嗨,我们通过培训获得了模型文件,然后使用模型文件来测试任何照片,但最后我们得到了一个灰色图像,我不知道是什么导致了以下图片: 4

我们使用它的方式如下:

训练模型命令: $ Python scripts / train.py --mode seg --out result-seg

训练38纪元后的结果图(max_iteration = 30000) 五

6 7

在此输出目录中,您可以看到: 模型文件“model_best”和训练过程生成文件“snapshot_epoch_x”

打开这两个文件,可以看到里面的结构,如下图所示

8

测试模型命令: $ python scripts / test.py --mode seg --model_path ./result-seg/model_best --model_mode seg -i my.jpg 结果是看到第一个灰色图

尝试再次运行该命令会产生以下错误: $ python scripts / test.py --mode seg --model_path ./result-seg/snapshot_epoch_35 --model_mode seg -i M_81_0183.jpg

6

我们检查了输入参数并逐一进行比较。

并且读取的模型文件在加载过程中输出每层的W和B值的平方和。可以看出,他们中的大多数都是0。 6

看到这个结果让我很难过。我再次做了以下尝试:

我后来训练了。 Mode = seg + Mode = seg_tri 训练是正常的,但测试结果和mode = seg 相同的问题:

  1. 给定任何输入的肖像,{seg,seg +}测试结果图像的颜色是灰色的。 {seg_tri}测试结果图像颜色为白色 2){seg,seg +,seg_tri}我从模型中读取的路径为:“。/ result / model_best”
  2. {seg,seg +,seg_tri}仅保存模型大小约500k
  3. 我打印了由模型保存的网络的每一层的持久性参数: W(weigths)在所有层中几乎都是0 (偏差)在解码器的最后几层中具有值。 这看起来非常不合理

我不熟悉这个Chainer,我很难完成整个过程。看到一些指导,我将非常感激和高兴。

@kkkmax Hello, I have encountered the same problem. Can you solve it? Is it convenient to leave a contact?

YealT commented 5 years ago

I'm not sure if I can't solve another method I'm going to try, you leave your other contact so I can reach you, for example wechat ID??

My Wechat is yoni_mmm ,thank you

billzw commented 5 years ago

No description provided.

same question:

Given a portrait of any input, the color of the {seg, seg+} test result image is gray. {seg_tri}Test result image color is white

Have you solved this problem?

@kkkmax

vlordier commented 5 years ago

You need to train the model properly first, using a pre-trained FCN model. See https://github.com/takiyu/portrait_matting/issues/22

This is the sort of masks (trimap) you can generate after a just few epochs and 2h of training on a p3.8xlarge AWS GPU instance.

vis_epoch=20_idx=73