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

Question about roi_pooling #9

Open
AndyLuoJJ opened this issue Apr 10, 2019 · 1 comment
Open

Question about roi_pooling #9

AndyLuoJJ opened this issue Apr 10, 2019 · 1 comment

Comments

@AndyLuoJJ
Copy link

Hello! I found an error when running your code. I ran python train.py and get this error:

Traceback (most recent call last):
  File "train.py", line 184, in <module>
    net = Net.Alexnet(is_training = True)
  File "/home/au_andyluo/transport/Fast-RCNN-master/Net.py", line 21, in __init__
    self.logits, self.bbox = self.build_network(self.images, self.class_num, self.is_training)
  File "/home/au_andyluo/transport/Fast-RCNN-master/Net.py", line 46, in build_network
    flatten = tf.contrib.layers.flatten(self.roi_pool6, scope='flat_32')
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 183, in func_with_args
    return func(*args, **current_args)
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1623, in flatten
    outputs = core_layers.flatten(inputs)
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/python/layers/core.py", line 316, in flatten
    return layer.apply(inputs)
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 805, in apply
    return self.__call__(inputs, *args, **kwargs)
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 362, in __call__
    outputs = super(Layer, self).__call__(inputs, *args, **kwargs)
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 720, in __call__
    self._assert_input_compatibility(inputs)
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1412, in _assert_input_compatibility
    self.name + ' is incompatible with the layer: '
ValueError: Input 0 of layer flatten_1 is incompatible with the layer: its rank is undefined, but the layer requires a defined rank.

And I discovered that the shape of roi_pool6 is unknown, so it cannot be flatten. How can I solve this problem?

@zhanghaobucunzai
Copy link

你好!运行您的代码时发现错误。我跑了python train.py,得到这个错误:

Traceback (most recent call last):
  File "train.py", line 184, in <module>
    net = Net.Alexnet(is_training = True)
  File "/home/au_andyluo/transport/Fast-RCNN-master/Net.py", line 21, in __init__
    self.logits, self.bbox = self.build_network(self.images, self.class_num, self.is_training)
  File "/home/au_andyluo/transport/Fast-RCNN-master/Net.py", line 46, in build_network
    flatten = tf.contrib.layers.flatten(self.roi_pool6, scope='flat_32')
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 183, in func_with_args
    return func(*args, **current_args)
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1623, in flatten
    outputs = core_layers.flatten(inputs)
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/python/layers/core.py", line 316, in flatten
    return layer.apply(inputs)
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 805, in apply
    return self.__call__(inputs, *args, **kwargs)
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 362, in __call__
    outputs = super(Layer, self).__call__(inputs, *args, **kwargs)
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 720, in __call__
    self._assert_input_compatibility(inputs)
  File "/home/au_andyluo/miniconda3/envs/testTensorflow/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1412, in _assert_input_compatibility
    self.name + ' is incompatible with the layer: '
ValueError: Input 0 of layer flatten_1 is incompatible with the layer: its rank is undefined, but the layer requires a defined rank.

我发现roi_pool6的形状未知,因此无法展平。我怎么解决这个问题?

请问,这个问题解决了吗

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

2 participants