Shimingyi / MotioNet

A deep neural network that directly reconstructs the motion of a 3D human skeleton from monocular video [ToG 2020]
https://rubbly.cn/publications/motioNet/
BSD 2-Clause "Simplified" License
554 stars 82 forks source link

AttributeError: 'NpzFile' object has no attribute 'zip' #30

Closed andreixxi closed 3 years ago

andreixxi commented 3 years ago

hello! i've cloned the repo, downloaded the pretrained model and placed it in a new folder- 'checkpoints', the training data and placed it in the already existing folder 'data', but when running the following command python evaluate.py -r ./checkpoints/wild_gt_tcc.pth -i demo i get this error:
Building the network Traceback (most recent call last): File "evaluate.py", line 137, in main(config, args, output_folder) File "evaluate.py", line 73, in main parameters = [torch.from_numpy(np.array(item)).float().to(device) for item in h36m_loader(config, is_training=True).dataset.get_parameters()] File "/content/MotioNet/data/data_loaders.py", line 11, in init self.dataset = h36m_dataset.h36m_dataset(config, is_train=is_training) File "/content/MotioNet/data/h36m_dataset.py", line 22, in init positions_set = np.load('./data/data_h36m.npz', allow_pickle=True)['positions_3d'].item() File "/usr/local/lib/python3.6/dist-packages/numpy/lib/npyio.py", line 432, in load pickle_kwargs=pickle_kwargs) File "/usr/local/lib/python3.6/dist-packages/numpy/lib/npyio.py", line 186, in init _zip = zipfile_factory(fid) File "/usr/local/lib/python3.6/dist-packages/numpy/lib/npyio.py", line 112, in zipfile_factory return zipfile.ZipFile(file, *args, **kwargs) File "/usr/lib/python3.6/zipfile.py", line 1131, in init self._RealGetContents() File "/usr/lib/python3.6/zipfile.py", line 1198, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file Exception ignored in: <bound method NpzFile.del of <numpy.lib.npyio.NpzFile object at 0x7f5b14ae70f0>> Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/numpy/lib/npyio.py", line 223, in del self.close() File "/usr/local/lib/python3.6/dist-packages/numpy/lib/npyio.py", line 214, in close if self.zip is not None: AttributeError: 'NpzFile' object has no attribute 'zip'
here is my project structure:
image

Shimingyi commented 3 years ago

@andreixxi Hello! I have no idea what is the problem. Can you download this file _datah36m.npz again and put it into data folder? I am worrying if the file is incomplete...

andreixxi commented 3 years ago

@Shimingyi I've tried redownloading it but the error persists. I was working in google colab so it must be something off there. However, when running it locally in jupyter notebook it worked, so I think I can close the issue.

Off topic, I have a few questions if you could answer them.

  1. in order to get the .bvh files for my own video is it enough to store the 2d keypts in openpose_results_folder (a folder with 2d key-points from openpose, similar with what's in data/example/folder_name) ? 2.1 do I have to prepare the data myself for maybe better results or it's enough to use the models you provided? (the data preparation part is a bit confusing for me) 2.2 testing on different .pth files will give different .bvh outputs ?
  2. it is said that you haven't applied any smoothing process on the 2d input and output (for the input I think there are some sort of steps/algorithms that I should apply on the video frames before sending them to openpose, and then on the 2d output(a list of floats) apply a certain algorithm ? if you can to give me a tip so I can look further on web
  3. is it possible to get the hand bones/fingers for the .bvh files ? If so, after the openpose should I have something in hand_left_keypoints_2d/ hand_right_keypoints_2d ?

Thank you!

Shimingyi commented 3 years ago

Yes, if you want to run the code with your own video, you need to prepare an openpose_results_folder and then modify this line so you can get the bvh output. You don't need to prepare any step for smoothing because I will update a version with it in 2 days, hope it can help.

Now we train the model in h36m dataset which is limited on camera view and pose diversity. If you really need an realiable results, it will be better to use a bigger dataset to fine-tune this network. The model with more data can give robuster results.

Our method doesn't predict the hand bone/fingers, it's very hard in this kind of skeleton setting...

andreixxi commented 3 years ago

looking forward to it!

Shimingyi commented 3 years ago

@andreixxi Sorry for my late response, I am so busy in this time. I suppose it would be realeased in tomorrow!