robot-grasp-detection icon indicating copy to clipboard operation
robot-grasp-detection copied to clipboard

How can I transfer this project to python3, it seems this project is writen in python2, thank you.

Open soldatjiang opened this issue 6 years ago • 13 comments

soldatjiang avatar Apr 27 '18 09:04 soldatjiang

There are little difference between python2 and python3 in this project.

woshisj avatar May 03 '18 00:05 woshisj

There are some differences in some file reading, encoding and decoding APIs, and some issues in tensorflow version make it impossible to run with python3 even after some modification. For example, when I run "build_cgd_dataset.py", I came into this error.

Traceback (most recent call last):
  File "build_cgd_dataset.py", line 115, in <module>
    main()
  File "build_cgd_dataset.py", line 98, in main
    example = _convert_to_example(filename, bboxes, image_buffer, height, width)
  File "build_cgd_dataset.py", line 62, in _convert_to_example
    'image/filename': _bytes_feature(filename),
  File "build_cgd_dataset.py", line 57, in _bytes_feature
    return tf.train.Feature(bytes_list=tf.train.BytesList(value=[v]))
TypeError: 'D:\\JiangShan\\cornell_grasping_dataset\\02\\pcd0210r.png' has type str, but expected one of: bytes

It seems there are some errors in the encoding and decoding of PNG, and when I ran grasp_det.py, the loss is NaN. I want to run the training of this network on windows, and tensorflow is not supported in python2 on windows.

soldatjiang avatar May 03 '18 02:05 soldatjiang

1.https://blog.csdn.net/qq_29921623/article/details/80047339 before example = _convert_to_example(filename, bboxes, image_buffer, height, width) add filename = filename.encode() 2.deleted the Nan valude in pcd0132cpos.txt and pcd0165cpos.txt file

woshisj avatar May 03 '18 07:05 woshisj

Thanks, I rewrote some scripts and solved this problem. 谢谢,问题已解决,以后多多交流

soldatjiang avatar May 03 '18 08:05 soldatjiang

Hello, when I run "build_cgd_dataset.py", I met one error as follows: runfile('F:/robot-grasp-detection/build_cgd_dataset.py', wdir='F:/robot-grasp-detection') F:\RGB-D_grasp_datasets\ rain-cgd F:\RGB-D_grasp_datasets
alidation-cgd

Traceback (most recent call last):

File "C:\Users\DSL\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\IPython\core\interactiveshell.py", line 2879, in run_code self.showtraceback(running_compiled_code=True)

File "C:\Users\DSL\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\IPython\core\interactiveshell.py", line 1811, in showtraceback self._showtraceback(etype, value, stb)

File "C:\Users\DSL\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\ipykernel\zmqshell.py", line 554, in _showtraceback dh.parent_header, ident=topic)

File "C:\Users\DSL\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\jupyter_client\session.py", line 730, in send to_send = self.serialize(msg, ident)

File "C:\Users\DSL\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\jupyter_client\session.py", line 625, in serialize content = self.pack(content)

File "C:\Users\DSL\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\jupyter_client\session.py", line 103, in ensure_ascii=False, allow_nan=False,

File "C:\Users\DSL\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\zmq\utils\jsonapi.py", line 43, in dumps s = s.encode('utf8')

UnicodeEncodeError: 'utf-8' codec can't encode character '\udcce' in position 1994: surrogates not allowed

Could you give me some suggestions? Thanks very much

dingshenglan avatar Jul 12 '18 02:07 dingshenglan

I may know why I met this error, but I have another problem as follows"

runfile('F:/robot-grasp-detection/build_cgd_dataset.py', wdir='F:/robot-grasp-detection') F:\RGB-D_grasp_datasets\train-cgd F:\RGB-D_grasp_datasets\validation-cgd Done converting 0 images in TFRecords with 0 train images and 0 validation image

Could you give me some suggestions? Thanks very much.

dingshenglan avatar Jul 12 '18 02:07 dingshenglan

@dingshenglan Have you modified the line 15 in build_cgd_dataset.py? You should change it to the path on your computer.

soldatjiang avatar Jul 14 '18 03:07 soldatjiang

@dingshenglan Have you modified the line 15 in build_cgd_dataset.py? You should change it to the path on your computer.

大佬,你知道如何用生成的模型来测试自己的数据吗?

lx-onism avatar Oct 09 '18 12:10 lx-onism

@soldatjiang I have deleted the Nan valude in pcd0132cpos.txt and pcd0165cpos.txt file and run build_cgd_dataset.py.However,when I run grasp_det.py for train,the loss is nan. Step 0 | loss = nan | x = [ 97.125 125.65 100.625] | x_hat = [nan nan nan] | tan = [ 0.1700947 -5.7376623 -0.2632446] | tan_hat = [-1.0320765 -1.0320765 -1.0320765] | h = [10.650811 22.422993 21.715439] | h_hat = [nan nan nan] | w = [11.328764 8.444719 17.096458] | w_hat = [nan nan nan] | (2.996 sec/batch

When I run grasp_det.py for validation,I get some errors.

No handlers could be found for logger "shapely.geos" Traceback (most recent call last): File "grasp_det.py", line 162, in tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) File "/home/jinhuan/ENV/Georgia_Tech/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "grasp_det.py", line 115, in main run_training() File "grasp_det.py", line 99, in run_training iou = p1.intersection(p2).area / (p1.area +p2.area -p1.intersection(p2).area) File "/home/jinhuan/ENV/Georgia_Tech/local/lib/python2.7/site-packages/shapely/geometry/base.py", line 620, in intersection return geom_factory(self.impl['intersection'](self, other)) File "/home/jinhuan/ENV/Georgia_Tech/local/lib/python2.7/site-packages/shapely/topology.py", line 65, in call self._validate(other, stop_prepared=True) File "/home/jinhuan/ENV/Georgia_Tech/local/lib/python2.7/site-packages/shapely/topology.py", line 18, in _validate raise ValueError("Null geometry supports no operations") ValueError: Null geometry supports no operations I guess maybe the x_hat,w_hat,h_hat are nan.It could not calculate the value of iou and result in the error.Could you please tell me how to solve the problems?

jinhuan-hit avatar Mar 23 '19 08:03 jinhuan-hit

@jinhuan-hit In my memory, in cornell dataset, four lines correspod to one bbox, if you delete the NaN lines, you should delete other lines in the same bbox.

soldatjiang avatar Apr 05 '19 01:04 soldatjiang

@soldatjiang Thanks,I'll check it.

jinhuan-hit avatar Apr 05 '19 05:04 jinhuan-hit

@soldatjiang Thanks,I'll check it. Excuse me,I have the same problem. How did you solve it in the end?

zhouxianming avatar Sep 24 '19 03:09 zhouxianming

ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float64: 'Tensor("truediv:0", shape=(), dtype=float64, device=/device:CPU:0)' May I ask how to solve this problem? Thanks, I've been working on it for a long time!

zhoumo1121 avatar Jul 02 '21 04:07 zhoumo1121