MaybeShewill-CV / bisenetv2-tensorflow

Unofficial tensorflow implementation of real-time scene image segmentation model "BiSeNet V2: Bilateral Network with Guided Aggregation for Real-time Semantic Segmentation"
https://maybeshewill-cv.github.io/bisenetv2-tensorflow/
MIT License
224 stars 59 forks source link

When the tfrecord file contains images of different shapes, an error is reported, how should I modify the code #12

Closed lee-zq closed 4 years ago

lee-zq commented 4 years ago

Traceback (most recent call last): File "/projects/bisenetv2-tensorflow/train_bisenetv2_cityscapes.py", line 42, in train_model() File "/projects/bisenetv2-tensorflow/train_bisenetv2_cityscapes.py", line 33, in train_model worker.train() File "/projects/bisenetv2-tensorflow/trainner/cityscapes_bisenetv2_single_gpu_trainner.py", line 258, in train self._loss, self._global_step File "/opt/conda/envs/tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/opt/conda/envs/tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1152, in _run feed_dict_tensor, options, run_metadata) File "/opt/conda/envs/tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run run_metadata) File "/opt/conda/envs/tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 1676700 values, but the requested shape has 1920000 [[{{node Reshape}} = Reshape[T=DT_UINT8, Tshape=DT_INT32, _device="/device:CPU:0"](DecodePng, Reshape/shape)]] [[node graph_input_node/train_IteratorGetNext (defined at /projects/bisenetv2-tensorflow/data_provider/cityscapes_tf_io.py:268) = IteratorGetNextoutput_shapes=[[1,400,400,3], [1,400,400,1]], output_types=[DT_FLOAT, DT_UINT8], _device="/job:localhost/replica:0/task:0/device:CPU:0"]] [[{{node miou/mean_iou/confusion_matrix/assert_less_1/Assert/AssertGuard/Assert/_218}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge4628...ard/Assert", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]

MaybeShewill-CV commented 4 years ago

@lee-zq All image should be rescaled into the same size. If you want to save images with different size you may google the usage of sparse tensor:)