tnikolla / robot-grasp-detection

Detecting robot grasping positions with deep neural networks. The model is trained on Cornell Grasping Dataset. This is an implementation mainly based on the paper 'Real-Time Grasp Detection Using Convolutional Neural Networks' from Redmon and Angelova.
Apache License 2.0
232 stars 84 forks source link

When I run grasp_det.py for the training on pycharm, some errors happened #7

Closed xiaoshuguo750 closed 6 years ago

xiaoshuguo750 commented 6 years ago

Hi! When I run grasp_det.py for the training on pycharm, there were some errors,

/home/xiaoshuguo/anaconda3/bin/python /home/xiaoshuguo/PycharmProjects/untitled2/robot-grasp-detection/grasp_det.py validation inputs False False Traceback (most recent call last): File "/home/xiaoshuguo/PycharmProjects/untitled2/robot-grasp-detection/grasp_det.py", line 162, in tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) File "/home/xiaoshuguo/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/home/xiaoshuguo/PycharmProjects/untitled2/robot-grasp-detection/grasp_det.py", line 115, in main run_training() File "/home/xiaoshuguo/PycharmProjects/untitled2/robot-grasp-detection/grasp_det.py", line 47, in run_training images, bboxes = grasp_img_proc.inputs([datafiles]) File "/home/xiaoshuguo/PycharmProjects/untitled2/robot-grasp-detection/grasp_img_proc.py", line 158, in inputs num_readers=1) File "/home/xiaoshuguo/PycharmProjects/untitled2/robot-grasp-detection/grasp_img_proc.py", line 122, in batch_inputs image_buffer, bbox = parse_example_proto(examples_serialized) File "/home/xiaoshuguo/PycharmProjects/untitled2/robot-grasp-detection/grasp_img_proc.py", line 26, in parse_example_proto r = 8*tf.random_uniform((1,), minval=0, maxval=tf.size(bboxes, out_type=tf.int32)/8, dtype=tf.int32) File "/home/xiaoshuguo/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/random_ops.py", line 229, in random_uniform maxval = ops.convert_to_tensor(maxval, dtype=dtype, name="max") File "/home/xiaoshuguo/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 639, in convert_to_tensor as_ref=False) File "/home/xiaoshuguo/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 704, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/home/xiaoshuguo/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 577, in _TensorTensorConversionFunction % (dtype.name, t.dtype.name, str(t))) ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float64: 'Tensor("truediv:0", shape=(), dtype=float64, device=/device:CPU:0)'

I don't know why it is? How can I resovle it? Thank you very much! #

xiaoshuguo750 commented 6 years ago

I have resolved the problem

bboxes = tf.sparse_tensor_to_dense(features['bboxes']) maxval0 = tf.size(bboxes, out_type=tf.int32)/8 maxval1 = tf.to_int32(maxval0) r = 8*tf.random_uniform((1,), minval=0, maxval=maxval1, dtype=tf.int32)

Thank you very much!