-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
tensorflow.python.framework.errors_impl.InvalidArgumentError: Reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero #281
Comments
I will review this. In the mean time
|
i use tensorflow-gpu-1.13.2 |
if i try this example everything ok model_trainer = ModelTraining() |
I will advice that you use Google Colab for this training as it offers 15GB GPU memory to train. Object detection is a very compute intensive training and a batch size of 1 is not viable. |
OK, now i using Google Colab, hololens dataset, tensorflow-gpu 1.13 and get this error
Generating anchor boxes for training images and annotation... /usr/local/lib/python3.6/dist-packages/keras/callbacks.py:1065: UserWarning: Epoch 1/200 ResourceExhaustedError Traceback (most recent call last) in () 8 frames /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/errors_impl.py in exit(self, type_arg, value_arg, traceback_arg) ResourceExhaustedError: OOM when allocating tensor with shape[1,416,416,32] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info. Whats wrong? |
Seems like you ran out of video memory to support a batch_size of 2 on this specific dataset. How much GPU memory do you have available? Unfortunately, a batch_size of 1 will never work. |
I don't understand how to resolve this error , even after changing the batch size to 2. Generating anchor boxes for training images and annotation... Training with transfer learning from pretrained Model WARNING:tensorflow:From D:\deeplearningvideos\anaconda\envs\tensorflow\lib\site-packages\keras\backend\tensorflow_backend.py:431: The name tf.is_variable_initialized is deprecated. Please use tf.compat.v1.is_variable_initialized instead. WARNING:tensorflow:From D:\deeplearningvideos\anaconda\envs\tensorflow\lib\site-packages\keras\backend\tensorflow_backend.py:438: The name tf.variables_initializer is deprecated. Please use tf.compat.v1.variables_initializer instead. WARNING:tensorflow:From D:\deeplearningvideos\anaconda\envs\tensorflow\lib\site-packages\keras\callbacks\tensorboard_v1.py:200: The name tf.summary.merge_all is deprecated. Please use tf.compat.v1.summary.merge_all instead. WARNING:tensorflow:From D:\deeplearningvideos\anaconda\envs\tensorflow\lib\site-packages\keras\callbacks\tensorboard_v1.py:203: The name tf.summary.FileWriter is deprecated. Please use tf.compat.v1.summary.FileWriter instead. Epoch 1/100
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info. (1) Resource exhausted: OOM when allocating tensor with shape[1024,512,3,3] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc 0 successful operations. |
Hello. I am trying to train the model from the example about hololens, but such an error comes out during training. I download dataset from hololens and use this code
pretrained-yolov3.h5 i download and put in example directory. What could be the problem?
Using TensorFlow backend.
Generating anchor boxes for training images and annotation...
Average IOU for 9 anchors: 0.88
Anchor Boxes generated.
Detection configuration saved in hololens/json/detection_config.json
Training on: ['hololens']
Training with Batch Size: 1
Number of Experiments: 20
WARNING:tensorflow:From /usr/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From /usr/lib/python3.7/site-packages/imageai-2.1.3-py3.7.egg/imageai/Detection/Custom/yolo.py:24: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
Training with transfer learning from pretrained Model
/usr/lib/python3.7/site-packages/keras/callbacks.py:1065: UserWarning:
epsilon
argument is deprecated and will be removed, usemin_delta
instead.warnings.warn('
epsilon
argument is deprecated and 'WARNING:tensorflow:From /usr/lib/python3.7/site-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
Epoch 1/20
Traceback (most recent call last):
File "custom_detection_train.py", line 7, in
trainer.trainModel()
File "/usr/lib/python3.7/site-packages/imageai-2.1.3-py3.7.egg/imageai/Detection/Custom/init.py", line 286, in trainModel
max_queue_size=4
File "/usr/lib/python3.7/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/usr/lib/python3.7/site-packages/keras/engine/training.py", line 1418, in fit_generator
initial_epoch=initial_epoch)
File "/usr/lib/python3.7/site-packages/keras/engine/training_generator.py", line 217, in fit_generator
class_weight=class_weight)
File "/usr/lib/python3.7/site-packages/keras/engine/training.py", line 1217, in train_on_batch
outputs = self.train_function(ins)
File "/usr/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 2715, in call
return self._call(inputs)
File "/usr/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 2675, in _call
fetched = self._callable_fn(*array_vals)
File "/usr/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1439, in call
run_metadata_ptr)
File "/usr/lib/python3.7/site-packages/tensorflow/python/framework/errors_impl.py", line 528, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero
[[{{node replica_0/model_1/yolo_layer_1/Reshape}}]]
[[{{node training/Adam/gradients/replica_0/model_1/bnorm_25/FusedBatchNorm_grad/FusedBatchNormGrad}}]]
The text was updated successfully, but these errors were encountered: