Does the dropout layer need to be defined in deploy.prototxt in caffe?

[亡魂溺海] 提交于 2019-12-07 10:01:37

问题


In the AlexNet implementation in caffe, I saw the following layer in the deploy.prototxt file:

layer {
  name: "drop7"
  type: "Dropout"
  bottom: "fc7"
  top: "fc7"
  dropout_param {
    dropout_ratio: 0.5
  }
}

Now the key idea of dropout is to randomly drop units (along with their connections) from the neural network during training.

Does this mean that I can simply delete this layer from deploy.prototxt, as this file is meant to be used during testing only?


回答1:


Yes. Dropout is not required during Testing.

Even if you include a dropout layer, nothing special happens during Testing. See the source code of dropout forward pass:

  if (this->phase_ == TRAIN) {
    // Code to do something
  } else {
    caffe_copy(bottom[0]->count(), bottom_data, top_data);  //Code to copy bottom blob to top blob
  }

As seen in the source code, the bottom blob data is copied to top blob data memory if its not on Training phase.



来源:https://stackoverflow.com/questions/36714363/does-the-dropout-layer-need-to-be-defined-in-deploy-prototxt-in-caffe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!