tpark94 / speedplusbaseline

PyTorch implementations of CNNs and domain-bridging algorithms used in baseline studies of SPEED+ dataset
MIT License
40 stars 9 forks source link

How to create a tangoPoints.mat file? #5

Closed mohana-pamidi closed 1 year ago

mohana-pamidi commented 1 year ago

I am a beginner so I am not quite understanding how to make this 3 x 11 array. Do we need to use matlab? Please let me know the proper and exact format to make this .mat file. I already have the keypoints collected, so do I write it as an array in notepad and save it as a .mat file? I tried doing this and this is the error I am getting:

Traceback (most recent call last): File "C:\Users...\GitHub\speedplusbaseline\preprocess.py", line 169, in json2csv(cfg) File "C:\Users...\GitHub\speedplusbaseline\preprocess.py", line 82, in json2csv keypts3d = load_tango_3d_keypoints(tango3dmodelfile) # (11, 3) [m] File "C:\Users...\GitHub\speedplusbaseline\src\utils\utils.py", line 274, in load_tango_3d_keypoints vertices = loadmat(matdir)['tango3Dpoints'] # [3 x 11] File "C:\Users...\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\io\matlab\mio.py", line 225, in loadmat MR, = mat_reader_factory(f, **kwargs) File "C:\Users...\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\io\matlab\mio.py", line 74, in mat_reader_factory mjv, mnv = get_matfile_version(byte_stream) File "C:\Users...\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\io\matlab\miobase.py", line 231, in get_matfile_version raise ValueError('Unknown mat file type, version %s, %s' % ret) ValueError: Unknown mat file type, version 46, 52

tpark94 commented 1 year ago

Please take a look at savemat & loadmat functions from the scipy packages.

https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.savemat.html

Note that we use the loadmat function to load the tangoPoints.mat file in the load_tango_3d_keypoints function of src/utils/utils.py.

mohana-pamidi commented 1 year ago

Thank you! It worked now. I tried installing the dependencies, however, I am getting an error message about not being able to build wheels for numpy. I made sure that the Python and numpy versions were compatible, however I have been getting the same error.

tpark94 commented 1 year ago

You'll have to provide more information for me to help you run the code. Which OS are you using? Are you making a new environment using venv or conda with appropriate python version (3.7)?

Also please note that our repository was tested working on Ubuntu 20.04 only - it is up to primarily end users to set it up for different operating systems.

mohana-pamidi commented 1 year ago

Yes, I am using Ubuntu 20.04 for Linux.

I have run preprocess.py and tried to test, however, I am getting the error that

"assert points_3D.shape[0] == points_2D.shape[0], 'points 3D and points 2D must have same number of vertices'"

I do not understand why this error was coming up. Was it because the tangoPoints mat was not formatted correctly?

tpark94 commented 1 year ago

Please include the entire error trace in the future.

The error comes from the pnp function in utils/utils.py (line 250). What are the shapes of points_3D and points_2D? Note that for KRN, both should have 11 keypoints.

tpark94 commented 1 year ago

Closing due to no activity