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

python detect.py causng error #9

Open
SodaCoder opened this issue May 5, 2020 · 2 comments
Open

python detect.py causng error #9

SodaCoder opened this issue May 5, 2020 · 2 comments

Comments

@SodaCoder
Copy link

SodaCoder commented May 5, 2020

When I do:
python detect.py Dataset/Sampleinput/input.png,

I get the following error:

Traceback (most recent call last):
File "detect.py", line 123, in
shared_layers = nn.nn_base(img_input, trainable=True)
File "/data2/charades2/ZSD_Release/keras_frcnn/resnet.py", line 182, in nn_base
x = FixedBatchNormalization(axis=bn_axis, name='bn_conv1')(x)
File "/home/user/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 75, in symbolic_fn_wrapper
return func(*args, **kwargs)
File "/home/user/anaconda3/lib/python3.7/site-packages/keras/engine/base_layer.py", line 463, in call
self.build(unpack_singleton(input_shapes))
File "/data2/charades2/ZSD_Release/keras_frcnn/FixedBatchNormalization.py", line 31, in build
trainable=False)
File "/home/user/anaconda3/lib/python3.7/site-packages/keras/engine/base_layer.py", line 279, in add_weight
weight = K.variable(initializer(shape, dtype=dtype),
File "/home/user/anaconda3/lib/python3.7/site-packages/keras/initializers.py", line 46, in call
return K.constant(1, shape=shape, dtype=dtype)
File "/home/user/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 649, in constant
value, dtype=dtype, shape=shape, name=name)
File "/home/user/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/keras/backend.py", line 937, in constant
return constant_op.constant(value, dtype=dtype, shape=shape, name=name)
File "/home/user/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 258, in constant
allow_broadcast=True)
File "/home/user/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 287, in _constant_impl
return _eager_fill(shape.as_list(), t, ctx)
File "/home/user/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 52, in _eager_fill
dims = convert_to_eager_tensor(dims, ctx, dtypes.int32)
File "/home/user/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 96, in convert_to_eager_tensor
return ops.EagerTensor(value, ctx.device_name, dtype)
ValueError: Attempt to convert a value (None) with an unsupported type (<class 'NoneType'>) to a Tensor.

Could you resolve this issue? I checked the shape is (None ,). That might be causing the problem. My question is why shape is (None ,)?

@longyuz0426
Copy link

When I do:
python detect.py Dataset/Sampleinput/input.png,

I get the following error:

Traceback (most recent call last):
File "detect.py", line 123, in
shared_layers = nn.nn_base(img_input, trainable=True)
File "/data2/charades2/ZSD_Release/keras_frcnn/resnet.py", line 182, in nn_base
x = FixedBatchNormalization(axis=bn_axis, name='bn_conv1')(x)
File "/home/user/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 75, in symbolic_fn_wrapper
return func(*args, **kwargs)
File "/home/user/anaconda3/lib/python3.7/site-packages/keras/engine/base_layer.py", line 463, in call
self.build(unpack_singleton(input_shapes))
File "/data2/charades2/ZSD_Release/keras_frcnn/FixedBatchNormalization.py", line 31, in build
trainable=False)
File "/home/user/anaconda3/lib/python3.7/site-packages/keras/engine/base_layer.py", line 279, in add_weight
weight = K.variable(initializer(shape, dtype=dtype),
File "/home/user/anaconda3/lib/python3.7/site-packages/keras/initializers.py", line 46, in call
return K.constant(1, shape=shape, dtype=dtype)
File "/home/user/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 649, in constant
value, dtype=dtype, shape=shape, name=name)
File "/home/user/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/keras/backend.py", line 937, in constant
return constant_op.constant(value, dtype=dtype, shape=shape, name=name)
File "/home/user/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 258, in constant
allow_broadcast=True)
File "/home/user/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 287, in _constant_impl
return _eager_fill(shape.as_list(), t, ctx)
File "/home/user/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 52, in _eager_fill
dims = convert_to_eager_tensor(dims, ctx, dtypes.int32)
File "/home/user/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 96, in convert_to_eager_tensor
return ops.EagerTensor(value, ctx.device_name, dtype)
ValueError: Attempt to convert a value (None) with an unsupported type (<class 'NoneType'>) to a Tensor.

Could you resolve this issue? I checked the shape is (None ,). That might be causing the problem. My question is why shape is (None ,)?

Hi, I have the same problem. Did you find the solution?

@jjjj32481
Copy link

When the tensorflow and keras version are higher than the requirements provided by author.
Please make sure the code in resnet.py:
Change if K.image_dim_ordering() == 'tf' towards if K.image_data_format() == 'channels_last'
And if K.image_dim_ordering() == 'th' towards if K.image_data_format() == 'channels_first'

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