Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
soldatjiang opened this issue Apr 27, 2018 · 13 comments

Comments

@soldatjiang
Copy link

No description provided.

@woshisj
Copy link

woshisj commented May 3, 2018

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

@soldatjiang
Copy link
Author

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.

@woshisj
Copy link

woshisj commented May 3, 2018

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

@soldatjiang
Copy link
Author

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

@dingshenglan
Copy link

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
Copy link

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.

@soldatjiang
Copy link
Author

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

@lx-onism
Copy link

lx-onism commented Oct 9, 2018

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

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

@jinhuan-hit
Copy link

jinhuan-hit commented Mar 23, 2019

@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?

@soldatjiang
Copy link
Author

@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.

@jinhuan-hit
Copy link

@soldatjiang Thanks,I'll check it.

@zhouxianming
Copy link

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

@zhoumo1121
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants