mimesis-inria / DeepPhysX

Interfacing AI with numerical simulation.
https://mimesis-inria.github.io/DeepPhysX/
GNU Affero General Public License v3.0
38 stars 7 forks source link

running core/examples/demos/liver/interactive.py error in windows10 python3.9 #5

Closed 123jjx321 closed 1 year ago

123jjx321 commented 2 years ago

Traceback (most recent call last): File "H:\SOFA\anaconda\Lib\site-packages\vedo\plotter.py", line 2308, in _func_wrap func(event_dict) File "H:\DeepPhysX\Core\examples\demos\Liver\FC\Environment\LiverInteractive.py", line 174, in mouse_move U = self.get_prediction(F).reshape(self.output_size) File "H:\SOFA\anaconda\Lib\site-packages\DeepPhysX\Core\Environment\BaseEnvironment.py", line 207, in get_prediction return TcpIpClient.request_get_prediction(self, input_array=input_array) File "H:\SOFA\anaconda\Lib\site-packages\DeepPhysX\Core\AsyncSocket\TcpIpClient.py", line 225, in request_get_prediction return self.send_prediction_data(network_input=input_array) File "H:\SOFA\anaconda\Lib\site-packages\DeepPhysX\Core\AsyncSocket\TcpIpClient.py", line 190, in send_prediction_data self.sync_send_command_prediction() File "H:\SOFA\anaconda\Lib\site-packages\DeepPhysX\Core\AsyncSocket\TcpIpObject.py", line 612, in sync_send_command_prediction self.sync_send_command(receiver=receiver, command='prediction') File "H:\SOFA\anaconda\Lib\site-packages\DeepPhysX\Core\AsyncSocket\TcpIpObject.py", line 511, in sync_send_command self.sync_send_data(data_to_send=cmd, receiver=receiver) File "H:\SOFA\anaconda\Lib\site-packages\DeepPhysX\Core\AsyncSocket\TcpIpObject.py", line 96, in sync_send_data receiver.sendall(data_as_bytes) ConnectionAbortedError: [WinError 10053] The software in your console aborted an established connection

RobinEnjalbert commented 2 years ago

Hi @123jjx321, thanks for the report and sorry for the late reply. I guess you are on the stable v22.06 version ? Your line indexing is suggesting that version of the code (please be more precise next time you create an issue, not only on this Github repository).

It seems that your 'LiverInteractive' simulation is requesting a prediction via the TCP-IP protocol, but it should normally not be allowed to do so. You can first check in the examples/demos/liver/FC/interacive.py that the flag as_tcp_ip is set to False (line 28).

At some point, you may need to use the TCP-IP protocol of the project. I don't know the exact reason why you have this issue on Windows, it can probably be a firewall issue, you can try to disable them. We use the standard socket library, it can be more convenient for you to perform some tests out of DeepPhysX context.

Please let me know if you still have any problems !

123jjx321 commented 2 years ago

Thank you for your advice, I will notice next time! And I do have other questions, I solved some of them, but still some problems remain.

I used the git clone DeepPhysX.core to download the Core/Sofa/Torch projects.

For the Core/examples/demos/Liver/FC/interactive.py demo i have met the problems below:

1: TCP-IP Connection Problem / Solved the connection problem have been down by change to ubuntu system,thank you for the suggestion

2: Data download problem / Solved For the Core/examples/demos/Liver/FC/download.py , "self.categories" in code line 19: "dataset_info","dataset_valid","dataset_train" seems to have the wrong corresponding DOI numbers. So I have changed it by looking at the 'https://data-qualif.loria.fr'.

3: "cannot import name "fitSphere" from vedo" / Solved simply delete it

4: AttributeError: 'Plotter' object has no attribute 'computeWorldPosition' / Solver _by changing the computeWorldPosition into compute_worldposition

After I solved the problem before, the interactive.py could finally run.(but the result seems not very well. As long as i pick a sphere on the liver and move the mouse, the liver will become very large(ill-shape) and not like a liver anymore)

For the Core/examples/demos/Liver/FC/prediction.py

when I run the prediction.py, it shows below:

File "/home/j/.local/lib/python3.8/site-packages/DeepPhysX/Core/Manager/DatasetManager.py", line 371, in load_directory partitions_dict = self.json_dict['partitions'][mode] if self.json_found else self.search_partitions(mode) KeyError: 'Training'

and I jump into the DatasetManager.py see the line 371 shows:

partitions_dict = self.json_dict['partitions'][mode] if self.json_found else self.search_partitions(mode)

_by debug, i changed the "training" into "Training" and "validation" into "Validation" in "sessions/liverdpx/dataset/dataset.json"

and i rerun the prediction.py the error become:

File "/home/j/.local/lib/python3.8/site-packages/DeepPhysX/Core/Manager/DatasetManager.py", line 377, in load_directory self.list_partitions[field][self.modes[mode]] = partitions_dict[field] TypeError: list indices must be integers or slices, not str

after i did some of those changes by debugging, the prediction.py still can not run successfully.

For the Sofa/examples/demos/Liver/FC/runSofa.py

i run the runSofa.py with runSofa.exe which i build successfully in ubuntu with sofapython3(in-tree) it shows in the terminal of sofa [sofapyython3] : can not find Createsence and other errors

still not run the DeepPhysX with sofa

123jjx321 commented 2 years ago

I forgot to mention some other problems I have met: 1.the Arrows(startpoints, endpoints) should be Arrows(start_pts,end_pts). 2.the isSequence() should be is_sequence() there are many problems like that, It may caused by the wrong version of "vedo" or wrong version of some other pkgs.

when i finally solve them all, and run the prediction.py. the vedo sence finally came out. However, if i press "q" to start a session. the errors shown up and shut the sence down.

sometimes it will be like: "Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)"

othertimes it will be like: [xcb] Extra reply data still left in queue [xcb] This is most likely caused by a broken X extension library [xcb] Aborting, sorry about that. python3.8: ../../src/xcb_io.c:580: _XReply: Assertion `!xcb_xlib_extra_reply_data_left' failed.

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

RobinEnjalbert commented 2 years ago

Thanks a lot for your very detailed fixes, you are absolutely right, this is due to a new version of the Vedo library that brought a wide change in the naming convention. I should have included the versions in the requirements, sorry for that.

I tackled this issue (and the others you mentioned) in the new version of DeepPhysX (v22.12), that is almost ready to be released (mostly a change in the data flow and storage). I hope you will no longer have these problems with this new version.

123jjx321 commented 2 years ago

thank you! i will be waiting for your new version. Hope you everything well.