met problem setting parameters of Scale layer

26 views
Skip to first unread message

解易

unread,
Jun 10, 2017, 11:58:24 AM6/10/17
to Caffe Users
I use network to estimate the standard deviates of three channels of facial images and want to normalize batch of facial images with Scale layer.

layer {
    name
: "normalized"
    type
: "Scale"
    bottom
: "centralized"
    bottom
: "decode_reciprocal_d"
    top
: "normalized"
}

centralized is the batch of facial images whose dimension is 200(batch size)x3(channel)x40(height)x32(width)
decode_reciprocal_d is the reciprocal of standard deviates whose dimension is 1x3x1x1
when training, I receive the following error

F0610 18:02:29.366436  1937 scale_layer.cpp:92] Check failed: bottom[0]->shape(axis_ + i) == scale->shape(i) (3 vs. 200) dimension mismatch between bottom[0]->shape(1) and scale->shape(0)

Is the problem caused by wrong parameters for Scale or the incompetence of Scale to my task?

Przemek D

unread,
Jun 12, 2017, 3:16:22 AM6/12/17
to Caffe Users
You need to set axis param to specify which dimension you want to do broadcasting, but additionally your second bottom blob needs to have a specific shape. Check help on the Scale layer, especially the first paragraph about the axis parameter, to see how those two relate.
In your case it should help to reshape the "decode_reciprocal_d" blob to have a shape of (3), that is only one dimension. I attach an example prototext, how I solved it.
scale.pt

解易

unread,
Jun 12, 2017, 6:36:24 AM6/12/17
to Caffe Users
It works! Really thanks to your kindly in-depth guidance.

在 2017年6月12日星期一 UTC+8下午3:16:22,Przemek D写道:
Reply all
Reply to author
Forward
0 new messages