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

Trying to implement validation on grasp_det.py #5

Closed harsh306 closed 6 years ago

harsh306 commented 6 years ago

Traceback (most recent call last): File "build_cgd_dataset.py", line 115, in main() File "build_cgd_dataset.py", line 97, in main image_buffer, height, width = _process_image(filename, coder) File "build_cgd_dataset.py", line 29, in _process_image image_data = f.read() File "/home/harsh/anaconda3/envs/py36/lib/python3.6/codecs.py", line 321, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

harsh306 commented 6 years ago

I resolved it using 2 changes line 28: with open(filename,'rb') as f: line 62: 'image/filename': _bytes_feature(filename.encode()), it worked !!

harsh306 commented 6 years ago

Can you list the env python libraries with version... I am getting some conflicts I guess like below is tf error: File "grasp_det.py", line 162, in tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) File "/home/harsh/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "grasp_det.py", line 115, in main run_training() File "grasp_det.py", line 47, in run_training images, bboxes = grasp_img_proc.inputs([datafiles]) File "/home/harsh/grasp/robot-grasp-detection-master/grasp_img_proc.py", line 158, in inputs num_readers=1) File "/home/harsh/grasp/robot-grasp-detection-master/grasp_img_proc.py", line 122, in batch_inputs image_buffer, bbox = parse_example_proto(examples_serialized) File "/home/harsh/grasp/robot-grasp-detection-master/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/harsh/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/random_ops.py", line 233, in random_uniform maxval = ops.convert_to_tensor(maxval, dtype=dtype, name="max") File "/home/harsh/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 611, in convert_to_tensor as_ref=False) File "/home/harsh/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 676, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/home/harsh/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 549, 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)'

harsh306 commented 6 years ago

Resolved by making following changes at line 26 in grasp_img_proc.py

r = 8*tf.random_uniform((1,), minval=0, maxval=tf.size(bboxes, out_type=tf.int32)//8, dtype=tf.int32)

tnikolla commented 6 years ago

Hi,

now I don't have access to the machine that I used run the code, so I can't tell all the full specs but these:

I'm glad that you solved the issue. I'm closing the issue!