ModelZoo icon indicating copy to clipboard operation
ModelZoo copied to clipboard

Error while trying to get outputs of googlenet

Open iaroslav-ai opened this issue 9 years ago • 6 comments

I try to get output of googlenet with some randomly generated inputs using a modified version of googlenet_neon.py. I get warning and error messages below. Did I made some mistake or is there a bug? The code that I use is below error messages.

Messages:

2016-04-11 20:42:40,144 - neon.models.model - WARNING - Problems restoring existing RNG state: algorithm must be 'MT19937'
Traceback (most recent call last):
  File "/home/iaroslav/neon-examples/googlenet/demo.py", line 103, in <module>
    model.initialize(test, cost)
  File "/usr/local/lib/python2.7/dist-packages/neon/models/model.py", line 100, in initialize
    prev_input = self.layers.configure(prev_input)
  File "/usr/local/lib/python2.7/dist-packages/neon/layers/container.py", line 257, in configure
    self.layers[0].configure(in_obj)
  File "/usr/local/lib/python2.7/dist-packages/neon/layers/container.py", line 127, in configure
    in_obj = l.configure(in_obj)
  File "/usr/local/lib/python2.7/dist-packages/neon/layers/layer.py", line 615, in configure
    assert isinstance(self.in_shape, tuple)
AssertionError

The code:

https://gist.github.com/iaroslav-ai/949ee0200152236937c4d0b29f70f70e

Assume that googlenet model is located at /home/iaroslav/temp/googlenet.p.

iaroslav-ai avatar Apr 11 '16 18:04 iaroslav-ai

The ArrayIterator needs to have the data as a 2D matrix with the dim (N, CHW). So the CHW part needs to be squashed and it needs the shape parameter set to (C, H, W). Try changing line

test = ArrayIterator(np.random.rand(256,224,224,3))

to

test = ArrayIterator(np.random.rand(256, 3_224_224), lshape=(3, 224, 224))

nervetumer avatar Apr 11 '16 19:04 nervetumer

Ah I see I used now test = ArrayIterator(np.random.rand(256, 3*224*224), lshape=(3, 224, 224)) I also added in the end print model.get_outputs(test) It seems that now neon does something for some time, but then in the get outputs function it gives the error

Traceback (most recent call last):
  File "/home/iaroslav/neon-examples/googlenet/demo.py", line 104, in <module>
    print model.get_outputs(test)
  File "/usr/local/lib/python2.7/dist-packages/neon/models/model.py", line 257, in get_outputs
    (dim0, dim1) = x.shape
AttributeError: 'list' object has no attribute 'shape'

Did I do something wrong again? :) I have my updated code in here

Thanks for your response! :D

iaroslav-ai avatar Apr 12 '16 08:04 iaroslav-ai

Could you pull the most recent model zoo repo and try again, I think the model needed to be updated to use the SingleOutputTree

nervetumer avatar Apr 12 '16 17:04 nervetumer

Thanks for your response! I will try to pull the most recent model zoo.

iaroslav-ai avatar May 10 '16 07:05 iaroslav-ai

I guess this can be closed due to #3 ?

iaroslav-ai avatar May 10 '16 08:05 iaroslav-ai

Not sure if this relates to #3. Would be good to make sure that this is working for you.

nervetumer avatar May 10 '16 14:05 nervetumer