Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pycaffe output layers is zero #4756

Closed
mbasij1 opened this issue Sep 22, 2016 · 3 comments
Closed

pycaffe output layers is zero #4756

mbasij1 opened this issue Sep 22, 2016 · 3 comments

Comments

@mbasij1
Copy link

mbasij1 commented Sep 22, 2016

i create a prototype like this
input: "data" input_shape { dim: 1 # batchsize dim: 3 # number of colour channels - rgb dim: 55 # width dim: 110 # height } layer { name: "conv1" type: "Convolution" bottom: "data" top: "conv1" param { lr_mult: 1 } param { lr_mult: 2 } convolution_param { num_output: 20 kernel_size: 4 stride: 1 } } layer { name: "conv2" type: "Convolution" bottom: "conv1" top: "conv2" param { lr_mult: 1 } param { lr_mult: 2 } convolution_param { num_output: 20 kernel_size: 4 stride: 1 } } layer { name: "pool1" type: "Pooling" bottom: "conv2" top: "pool1" pooling_param { pool: MAX kernel_size: 2 stride: 2 } } layer { name: "conv3" type: "Convolution" bottom: "pool1" top: "conv3" param { lr_mult: 1 } param { lr_mult: 2 } convolution_param { num_output: 40 kernel_size: 3 stride: 1 } } layer { name: "conv4" type: "Convolution" bottom: "conv3" top: "conv4" param { lr_mult: 1 } param { lr_mult: 2 } convolution_param { num_output: 40 kernel_size: 3 stride: 1 } } layer { name: "pool2" type: "Pooling" bottom: "conv4" top: "pool2" pooling_param { pool: MAX kernel_size: 2 stride: 2 } } layer { name: "conv5" type: "Convolution" bottom: "pool2" top: "conv5" param { lr_mult: 1 } param { lr_mult: 2 } convolution_param { num_output: 60 kernel_size: 3 stride: 1 } } layer { name: "conv6" type: "Convolution" bottom: "conv5" top: "conv6" param { lr_mult: 1 } param { lr_mult: 2 } convolution_param { num_output: 60 kernel_size: 3 stride: 1 } } layer { name: "pool3" type: "Pooling" bottom: "conv6" top: "pool3" pooling_param { pool: MAX kernel_size: 2 stride: 2 } } layer { name: "ip1" type: "InnerProduct" bottom: "pool3" top: "ip1" inner_product_param { num_output: 160 } }
and write pycaffe code like this
`caffe.set_mode_cpu()

net1

net = caffe.Net('/root/deepid3/deploy.prototxt', caffe.TRAIN)
transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape})
transformer.set_transpose('data', (2,0,1))

transformer.set_channel_swap('data', (2,1,0))

transformer.set_raw_scale('data', 255.0)

im = caffe.io.load_image(y)
net.blobs['data'].data[...] = transformer.preprocess('data', im)
out = net.forward()
print outallways out is {'ip1': array([[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0.]], dtype=float32)}`
i think is my problem but i found that conv1 produce just zero when i remove other layers, i start update that bust still all of output is zero, i check data layer and print data and is have true value,
how can sole that?

@mbasij1
Copy link
Author

mbasij1 commented Sep 24, 2016

no one can't help me?

@shelhamer
Copy link
Member

Please ask usage and modeling questions on the mailing list. Your model has no weight initialization, and the weights default to zero, and so all of the outputs are zero.

From https://github.com/BVLC/caffe/blob/master/CONTRIBUTING.md:

Please do not post usage, installation, or modeling questions, or other requests for help to Issues.
Use the caffe-users list instead. This helps developers maintain a clear, uncluttered, and efficient view of the state of Caffe.

@aanwark
Copy link

aanwark commented Oct 15, 2018

@mbasij1 were you able to solve this issue? I have a similar problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants