art-programmer/FloorNet

Error in RecordReader.py during training

Closed this issue · 1 comments

Hi,
I followed the readme and tried running train.py with those two files in the data folder. I am getting this bug.
raceback (most recent call last):
File "train.py", line 1522, in
train(args)
File "train.py", line 759, in train
dataset_train = getDatasetTrain(filenames_train, options.augmentation, '4' in options.branches, options.batchSize)
File "/home/FloorNet/RecordReader.py", line 202, in getDatasetTrain
return tf.data.TFRecordDataset(filenames[0]).repeat().map(functools.partial(parse_fn, augmentation=augmentation, readImageFeatures=readImageFeatures), num_parallel_calls=NUM_THREADS).batch(batchSize).prefetch(1)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 840, in map
return ParallelMapDataset(self, map_func, num_parallel_calls)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 1857, in init
super(ParallelMapDataset, self).init(input_dataset, map_func)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 1826, in init
self._map_func.add_to_graph(ops.get_default_graph())
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/function.py", line 488, in add_to_graph
self._create_definition_if_needed()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/function.py", line 321, in _create_definition_if_needed
self._create_definition_if_needed_impl()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/function.py", line 338, in _create_definition_if_needed_impl
outputs = self._func(*inputs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 1791, in tf_map_func
ret = map_func(nested_args)
File "/home/FloorNet/RecordReader.py", line 75, in parse_fn
point_indices, corners, heatmaps = tf.cond(tf.logical_or(tf.equal(flags[0], 0), tf.equal(flags[0], 4)), lambda: augmentWarping(point_indices, corners, heatmaps, gridStride=32, randomScale=2), lambda: (point_indices, corners, heatmaps))
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/deprecation.py", line 432, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 2047, in cond
orig_res_t, res_t = context_t.BuildCondBranch(true_fn)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 1897, in BuildCondBranch
original_result = fn()
File "/home/FloorNet/RecordReader.py", line 75, in
point_indices, corners, heatmaps = tf.cond(tf.logical_or(tf.equal(flags[0], 0), tf.equal(flags[0], 4)), lambda: augmentWarping(point_indices, corners, heatmaps, gridStride=32, randomScale=2), lambda: (point_indices, corners, heatmaps))
File "/home/FloorNet/augmentation_tf.py", line 93, in augmentWarping
xsTarget, ysTarget = warpIndices(pointcloudIndices % width, pointcloudIndices / width, gridStride, gridWidth, gridHeight, width, height, gridXsTarget, gridYsTarget)
File "/home/FloorNet/augmentation_tf.py", line 20, in warpIndices
topLeftXsTarget = tf.gather_nd(gridXsTarget, topLeft)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 2840, in gather_nd
"GatherNd", params=params, indices=indices, name=name)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py", line 609, in _apply_op_helper
param_name=input_name)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py", line 60, in _SatisfiesTypeConstraint
", ".join(dtypes.as_dtype(x).name for x in allowed_list)))
TypeError: Value passed to parameter 'indices' has DataType float64 not in list of allowed values: int32, int64

Can you please point me in the right direction

@venkat9yash Sorry for the late response. I don't know why but the data type for topLeft is tf.int32 on my side. Maybe it is due to different TensorFlow versions. Anyway, I added explicit type conversion. So it should be fine now. Thank you for reporting this.