Tried to convert 'shape' to a tensor and failed. Error: None values not supported.
Closed this issue · 1 comments
When I run either of the Mask R-CNN codes, it raises problems like these:
Traceback (most recent call last):
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 498, in _apply_op_helper
values, name=input_arg.name, as_ref=input_arg.is_ref)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\profiler\trace.py", line 163, in wrapped
return func(*args, **kwargs)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\framework\ops.py", line 1540, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1525, in _autopacking_conversion_function
return _autopacking_helper(v, dtype, name or "packed")
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1460, in _autopacking_helper
constant_op.constant(elem, dtype=dtype, name=str(i)))
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\framework\constant_op.py", line 265, in constant
allow_broadcast=True)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\framework\constant_op.py", line 283, in _constant_impl
allow_broadcast=allow_broadcast))
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 445, in make_tensor_proto
raise ValueError("None values not supported.")
ValueError: None values not supported.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 536, in _apply_op_helper
values, as_ref=input_arg.is_ref).dtype.name
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\profiler\trace.py", line 163, in wrapped
return func(*args, **kwargs)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\framework\ops.py", line 1540, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1525, in _autopacking_conversion_function
return _autopacking_helper(v, dtype, name or "packed")
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1460, in _autopacking_helper
constant_op.constant(elem, dtype=dtype, name=str(i)))
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\framework\constant_op.py", line 265, in constant
allow_broadcast=True)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\framework\constant_op.py", line 283, in _constant_impl
allow_broadcast=allow_broadcast))
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 445, in make_tensor_proto
raise ValueError("None values not supported.")
ValueError: None values not supported.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "sample_training_maskRCNN_lstm.py", line 15, in
masked_image_extraction.save_masked_images()
File "D:\pythonProject\DeepTL-Lane-Change-Classification\test\mask_rcnn\detect_objects.py", line 42, in save_masked_images
model = modellib.MaskRCNN(mode="inference", model_dir=MODEL_DIR, config=config)
File "D:\pythonProject\DeepTL-Lane-Change-Classification\test\mask_rcnn\model.py", line 1735, in init
self.keras_model = self.build(mode=mode, config=config)
File "D:\pythonProject\DeepTL-Lane-Change-Classification\test\mask_rcnn\model.py", line 1918, in build
config.POOL_SIZE, config.NUM_CLASSES)
File "D:\pythonProject\DeepTL-Lane-Change-Classification\test\mask_rcnn\model.py", line 903, in fpn_classifier_graph
mrcnn_bbox = KL.Reshape((s[1], num_classes, 4), name="mrcnn_bbox")(x)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 952, in call
input_list)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 1091, in _functional_construction_call
inputs, input_masks, args, kwargs)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 822, in _keras_tensor_symbolic_call
return self._infer_output_signature(inputs, args, kwargs, input_masks)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 863, in _infer_output_signature
outputs = call_fn(inputs, *args, **kwargs)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\keras\layers\core.py", line 553, in call
inputs, (array_ops.shape(inputs)[0],) + self.target_shape)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\util\dispatch.py", line 201, in wrapper
return target(*args, **kwargs)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\ops\array_ops.py", line 195, in reshape
result = gen_array_ops.reshape(tensor, shape, name)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 8377, in reshape
"Reshape", tensor=tensor, shape=shape, name=name)
File "D:\anaconda3\envs\myenv\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 540, in _apply_op_helper
(input_name, err))
ValueError: Tried to convert 'shape' to a tensor and failed. Error: None values not supported.
They are so complicated that I do not know where I should check to solve the problems. I run them based on Python 3.6, tf-gpu 2.4 and Cuda 11.2. By the way, resnet_prediction can run while resnet_training cannot.
This is a TensorFlow version issue. This project is written and tested with tensorflow-gpu==1.10.1. Please consider following the requirments.txt for correct versions of Python packages.
The error you have is about shape mismatching. This happens because the dimensions of input tensors are slightly different in tf<2.0 and tf>=2.0. I don't plan to convert the project to tf>2.0. However, if you really need this with tf>2.0, you can start playing with the input tensors' dimensionality to fix the issue.