question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InvalidArgumentError

See original GitHub issue

I got the following error while running "python train_frcnn.py -o simple -p train.txt "

Using TensorFlow backend.
Parsing annotation files
Training images per class:
{'bg': 0, 'table': 418}
Num classes (including bg) = 2
Config has been written to config.pickle, and can be loaded when testing to ensure correct results
Num train samples 287
Num val samples 51
Traceback (most recent call last):
  File "/Users/ketulshah/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1628, in _create_c_op
    c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape must be rank 1 but is rank 0 for 'bn_conv1/Reshape_4' (op: 'Reshape') with input shapes: [1,1,1,64], [].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train_frcnn.py", line 122, in <module>
    shared_layers = nn.nn_base(img_input, trainable=True)
  File "/Users/ketulshah/table-detection/keras-frcnn/keras_frcnn/resnet.py", line 180, in nn_base
    x = FixedBatchNormalization(axis=bn_axis, name='bn_conv1')(x)
  File "/Users/ketulshah/anaconda3/lib/python3.6/site-packages/keras/engine/base_layer.py", line 457, in __call__
    output = self.call(inputs, **kwargs)
  File "/Users/ketulshah/table-detection/keras-frcnn/keras_frcnn/FixedBatchNormalization.py", line 73, in call
    epsilon=self.epsilon)
  File "/Users/ketulshah/anaconda3/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 1908, in batch_normalization
    mean = tf.reshape(mean, (-1))
  File "/Users/ketulshah/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 6482, in reshape
    "Reshape", tensor=tensor, shape=shape, name=name)
  File "/Users/ketulshah/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/Users/ketulshah/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
    return func(*args, **kwargs)
  File "/Users/ketulshah/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op
    op_def=op_def)
  File "/Users/ketulshah/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1792, in __init__
    control_input_ops)
  File "/Users/ketulshah/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1631, in _create_c_op
    raise ValueError(str(e))
ValueError: Shape must be rank 1 but is rank 0 for 'bn_conv1/Reshape_4' (op: 'Reshape') with input shapes: [1,1,1,64], [].

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
ketul93commented, Apr 25, 2019

With keras 2.0.3 I am ubable to use GPU …

How to utilise GPU (NVIDIA TITAN Xp) with keras 2.0.3 ?

I read that GPU is only supported for Keras >= 2.1.1

1reaction
Ershocommented, Apr 24, 2019

As it says in requirements.txt, you need to install keras 2.0.3.

You can simply run command

pip install keras==2.0.3

Read more comments on GitHub >

github_iconTop Results From Across the Web

tf.errors.InvalidArgumentError | TensorFlow v2.11.0
Raised when an operation receives an invalid argument.
Read more >
Getting InvalidArgumentError in Tensorflow - Stack Overflow
You are getting a ValueError . According to the tensorflow documentation, you get this error "If fetches or feed_dict keys are invalid or...
Read more >
tf.errors.InvalidArgumentError | TensorFlow
Class InvalidArgumentError ... Defined in tensorflow/python/framework/errors_impl.py . Raised when an operation receives an invalid argument. This may occur, for ...
Read more >
InvalidArgumentError: assertion failed: [0] [Op:Assert] name ...
Now I assert a variable using this in jupyter notebook, it's wrong ! the error is : InvalidArgumentError: assertion failed: [0] [Op:Assert] name ......
Read more >
InvalidArgumentError: Cannot assig… - Apple Developer
InvalidArgumentError : Cannot assign a device for operation agent/VerifyFinite/CheckNumerics: Could not satisfy explicit device specification '' because the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found