Update models for latest caffe master

waifu2x-caffe(CUI) works on ubuntu.

# Conflicts:
#	.gitignore
This commit is contained in:
nagadomi 2016-03-21 18:05:31 +09:00 committed by lltcggie
parent 5a7ac06f52
commit 2dbf72d191
5 changed files with 31 additions and 28 deletions

View File

@ -1,9 +1,10 @@
name: "srcnn" name: "srcnn"
input: "input" layer {
input_dim: 1 name: "input"
input_dim: 1 type: "Input"
input_dim: 142 top: "input"
input_dim: 142 input_param { shape: { dim: 1 dim: 1 dim: 142 dim: 142 } }
}
layer { layer {
name: "conv1_layer" name: "conv1_layer"
type: "Convolution" type: "Convolution"

View File

@ -1,9 +1,10 @@
name: "srcnn" name: "srcnn"
input: "input" layer {
input_dim: 1 name: "input"
input_dim: 3 type: "Input"
input_dim: 142 top: "input"
input_dim: 142 input_param { shape: { dim: 1 dim: 3 dim: 142 dim: 142 } }
}
layer { layer {
name: "conv1_layer" name: "conv1_layer"
type: "Convolution" type: "Convolution"

View File

@ -1,9 +1,10 @@
name: "srcnn" name: "srcnn"
input: "input" layer {
input_dim: 1 name: "input"
input_dim: 3 type: "Input"
input_dim: 142 top: "input"
input_dim: 142 input_param { shape: { dim: 1 dim: 3 dim: 142 dim: 142 } }
}
layer { layer {
name: "conv1_layer" name: "conv1_layer"
type: "Convolution" type: "Convolution"

View File

@ -1,9 +1,10 @@
name: "srcnn" name: "srcnn"
input: "input" layer {
input_dim: 1 name: "input"
input_dim: 3 type: "Input"
input_dim: 142 top: "input"
input_dim: 142 input_param { shape: { dim: 1 dim: 3 dim: 142 dim: 142 } }
}
layer { layer {
name: "conv1_layer" name: "conv1_layer"
type: "Convolution" type: "Convolution"

View File

@ -715,7 +715,7 @@ Waifu2x::eWaifu2xError Waifu2x::ConstractNet(boost::shared_ptr<caffe::Net<float>
net = boost::shared_ptr<caffe::Net<float>>(new caffe::Net<float>(param_model)); net = boost::shared_ptr<caffe::Net<float>>(new caffe::Net<float>(param_model));
net->CopyTrainedLayersFrom(param_caffemodel); net->CopyTrainedLayersFrom(param_caffemodel);
input_plane = param_model.input_dim(1); input_plane = param_model.layer(0).input_param().shape().Get(0).dim(1);
} }
else else
{ {
@ -732,14 +732,13 @@ Waifu2x::eWaifu2xError Waifu2x::SetParameter(caffe::NetParameter &param, const s
param.mutable_state()->set_phase(caffe::TEST); param.mutable_state()->set_phase(caffe::TEST);
{ {
auto mid = param.mutable_input_dim(); auto input_layer = param.mutable_layer(0);
auto mid = input_layer->mutable_input_param()->mutable_shape();
if (mid->size() != 4) if (mid->size() > 0 && mid->Mutable(0)->dim_size() != 4)
return eWaifu2xError_FailedParseModelFile; return eWaifu2xError_FailedParseModelFile;
mid->Mutable(0)->set_dim(0, batch_size);
*mid->Mutable(0) = batch_size; mid->Mutable(0)->set_dim(2, input_block_size);
*mid->Mutable(2) = input_block_size; mid->Mutable(0)->set_dim(3, input_block_size);
*mid->Mutable(3) = input_block_size;
} }
for (int i = 0; i < param.layer_size(); i++) for (int i = 0; i < param.layer_size(); i++)