【问题标题】:Upsampling in Semantic Segmentation using dilated Convolution使用扩张卷积在语义分割中上采样
【发布时间】:2018-09-23 14:27:20
【问题描述】:

我正在开发一个使用扩张(atrous)卷积网络进行语义分割的项目。我正在使用 caffe 框架。我的输入数据和标签大小是:

data (1 3 1158 1544 )
label (1 1 1158 1544)

我正在使用带有损失的 softmax 进行评估。

在 Softmax 层要求两个输入 blob 提供相同尺寸之前,网络工作正常。通常在这个网络中,数据的大小会变小,我需要在将其馈送到 Softmax 层之前调整它的大小。

我需要一些想法,如何在将数据输入到 softmax 层之前调整数据大小。我知道我可以将反卷积与双线性插值一起使用并进行一些裁剪,但我错过了如何进行的想法。

任何帮助将不胜感激。

日志的最后部分如下:

I0413 11:44:45.734990 18455 net.cpp:84] Creating Layer ct_final
I0413 11:44:45.734992 18455 net.cpp:406] ct_final <- ct_fc1
I0413 11:44:45.734997 18455 net.cpp:380] ct_final -> score_fc1
I0413 11:44:45.736572 18455 net.cpp:122] Setting up ct_final
I0413 11:44:45.736582 18455 net.cpp:129] Top shape: 1 32 33 81 (85536)
I0413 11:44:45.736583 18455 net.cpp:137] Memory required for data: 5731224640
I0413 11:44:45.736588 18455 layer_factory.hpp:77] Creating layer deconv1_bilinear
I0413 11:44:45.736598 18455 net.cpp:84] Creating Layer deconv1_bilinear
I0413 11:44:45.736599 18455 net.cpp:406] deconv1_bilinear <- score_fc1
I0413 11:44:45.736604 18455 net.cpp:380] deconv1_bilinear -> score_deconv1
I0413 11:44:45.740128 18455 net.cpp:122] Setting up deconv1_bilinear
I0413 11:44:45.740137 18455 net.cpp:129] Top shape: 1 32 136 328 (1427456)
I0413 11:44:45.740139 18455 net.cpp:137] Memory required for data: 5736934464
I0413 11:44:45.740144 18455 layer_factory.hpp:77] Creating layer deconv2_bilinear
I0413 11:44:45.740151 18455 net.cpp:84] Creating Layer deconv2_bilinear
I0413 11:44:45.740154 18455 net.cpp:406] deconv2_bilinear <- score_deconv1
I0413 11:44:45.740160 18455 net.cpp:380] deconv2_bilinear -> score
I0413 11:44:45.743669 18455 net.cpp:122] Setting up deconv2_bilinear
I0413 11:44:45.743695 18455 net.cpp:129] Top shape: 1 32 548 1316 (23077376)
I0413 11:44:45.743697 18455 net.cpp:137] Memory required for data: 5829243968
I0413 11:44:45.743700 18455 layer_factory.hpp:77] Creating layer loss
I0413 11:44:45.743721 18455 net.cpp:84] Creating Layer loss
I0413 11:44:45.743723 18455 net.cpp:406] loss <- score
I0413 11:44:45.743727 18455 net.cpp:406] loss <- label
I0413 11:44:45.743731 18455 net.cpp:380] loss -> loss
I0413 11:44:45.743762 18455 layer_factory.hpp:77] Creating layer loss
F0413 11:44:45.778823 18455 softmax_loss_layer.cpp:47] Check failed:outer_num_ * inner_num_ == bottom[1]->count() (721168 vs. 1787952) Number of labels must match number of predictions; e.g., if softmax axis == 1 and prediction shape is (N, C, H, W), label count (number of labels) must be N*H*W, with integer values in {0, 1, ..., C-1}.
*** Check failure stack trace: ***
    @     0x7f4ecd1215cd  google::LogMessage::Fail()
    @     0x7f4ecd123433  google::LogMessage::SendToLog()
    @     0x7f4ecd12115b  google::LogMessage::Flush()
    @     0x7f4ecd123e1e  google::LogMessageFatal::~LogMessageFatal()
    @     0x7f4ecd7bceb8  caffe::SoftmaxWithLossLayer<>::Reshape()
    @     0x7f4ecd7b10d7  caffe::Net<>::Init()
    @     0x7f4ecd7b380e  caffe::Net<>::Net()
    @     0x7f4ecd7414da  caffe::Solver<>::InitTrainNet()
    @     0x7f4ecd7429a5  caffe::Solver<>::Init()
    @     0x7f4ecd742cbf  caffe::Solver<>::Solver()
    @     0x7f4ecd786f11  caffe::Creator_AdamSolver<>()
    @           0x40a7d8  train()
    @           0x407568  main
    @     0x7f4ecb8b7830  __libc_start_main
    @           0x407e39  _start
    @              (nil)  (unknown)

如果你们需要 train.prototxt,请告诉我。

谢谢!!

【问题讨论】:

    标签: c++ caffe semantic-segmentation


    【解决方案1】:

    反卷积确实是在卷积步骤之后返回原始输入大小的常用方法:这就是语义分割神经网络的基本架构:全卷积网络 (FCN)。

    如果您需要有关如何使用它的示例,请查看repository:它包含许多 Caffe 中的 FCN 示例,它们使用 Deconvolution Caffe 层。另外,你可以阅读相关的paper对反卷积进行更深入的解释。

    请注意,Deconvolution 并不总是双线性插值。它通常由插值初始化,然后在训练期间学习(反向传播)。

    【讨论】:

      猜你喜欢
      • 2018-04-17
      • 1970-01-01
      • 2022-08-02
      • 2018-07-05
      • 1970-01-01
      • 1970-01-01
      • 2020-07-27
      • 2018-06-27
      • 2019-11-26
      相关资源
      最近更新 更多