You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2017/11/06 21:15:07 UTC
[GitHub] chsin opened a new issue #8563: feature extraction results in different output for same input
chsin opened a new issue #8563: feature extraction results in different output for same input
URL: https://github.com/apache/incubator-mxnet/issues/8563
## Description
I get different outputs from the caffenet fc7 layer for the same input. I don't remember where I downloaded the model, but it was either through http://data.dmlc.ml/mxnet/models/ or the older mxnet model repo.
## Environment info (Required)
maxOS Sierra, v10.12.6
Python 2.7.10
## Minimum reproducible example
put this into test_fe_sym.py where [model_dir] is where caffenet-0000.params and caffenet-symbol.json is.
``` python
import mxnet as mx
import numpy as np
print 'mxnet version', mx.__version__
print 'numpy version', np.__version__
mod_name = "[mod_dir]/caffenet"
sym, arg_params, aux_params = mx.model.load_checkpoint(mod_name, 0)
all_layers = sym.get_internals()
fe_sym = all_layers['fc7_output']
print fe_sym.get_internals()
concat_args = {key:arg_params[key] for key in arg_params.keys()}
mod = mx.mod.Module(symbol=fe_sym, data_names=['data'], label_names=[])
mod.bind(data_shapes=[('data',(1, 3, 224, 224))])
mod.init_params(arg_params = concat_args)
mx_img = mx.nd.array(np.zeros((1,3,224,224)))
batch = mx.io.DataBatch([mx_img], [])
for _ in range(10):
mod.forward(batch)
print mod.get_outputs()[0]
```
This is what I get when I run it in terminal:
```
>> python test_fe_sym.py
mxnet version 0.11.0
numpy version 1.13.3
[16:14:24] src/nnvm/legacy_json_util.cc:190: Loading symbol saved by previous version v0.8.0. Attempting to upgrade...
[16:14:24] src/nnvm/legacy_json_util.cc:198: Symbol successfully upgraded!
<Symbol group [data, conv1_weight, conv1_bias, conv1, relu1, pool1, norm1, conv2_weight, conv2_bias, conv2, relu2, pool2, norm2, conv3_weight, conv3_bias, conv3, relu3, conv4_weight, conv4_bias, conv4, relu4, conv5_weight, conv5_bias, conv5, relu5, pool5, flatten_0, fc6_weight, fc6_bias, fc6, relu6, drop6, fc7_weight, fc7_bias, fc7]>
[[-1.93128979 -2.29720759 -2.70292187 ..., -2.25644875 -3.05303383
-1.76401949]]
<NDArray 1x4096 @cpu(0)>
[[-1.80183637 -2.68599343 -2.66020608 ..., -1.50269926 -2.29078102
-2.43784142]]
<NDArray 1x4096 @cpu(0)>
[[-1.28073776 -2.04497075 -3.16189289 ..., -1.27064598 -3.24989033
-2.34601569]]
<NDArray 1x4096 @cpu(0)>
[[-1.86191022 -2.48778987 -2.61905193 ..., -2.04039574 -2.48587728
-2.52999163]]
<NDArray 1x4096 @cpu(0)>
[[-2.63889694 -2.77093887 -3.30290985 ..., -2.15549564 -2.78999281
-2.12462115]]
<NDArray 1x4096 @cpu(0)>
[[-1.32172596 -2.2919054 -2.7314136 ..., -1.93443453 -2.81845975
-2.4142251 ]]
<NDArray 1x4096 @cpu(0)>
[[-1.30976808 -2.26464558 -3.43015289 ..., -1.98673713 -2.11255097
-2.5531776 ]]
<NDArray 1x4096 @cpu(0)>
[[-2.22697783 -2.39356375 -2.24538589 ..., -2.7480278 -2.95472836
-2.87552905]]
<NDArray 1x4096 @cpu(0)>
[[-2.72385931 -2.22037935 -3.52920914 ..., -2.34241581 -2.66669798
-2.02456665]]
<NDArray 1x4096 @cpu(0)>
[[-2.73990583 -1.87716341 -3.2182374 ..., -2.65652514 -2.66080451
-2.56173849]]
<NDArray 1x4096 @cpu(0)>
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services