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
563 stars 84 forks source link

Read the output of openpose on wild videos #40

Closed italosalgado14 closed 3 years ago

italosalgado14 commented 3 years ago

Hi there. Thanks for the code. I am trying to test it on videos that I have recorded, but I run into the following problem reading the output of openpose. I use:

./build/examples/openpose/openpose.bin --video /home/laila/Nexar/openpose/examples/media/nombre_final.mp4 --write_json /home/laila/Nexar/openpose/out_openpose --display 0 --render_pose 0 And: python evaluate.py -r ./checkpoints/wild_gt_tcc.pth -i /home/laila/Nexar/openpose/out_openpose/ -o /home/laila/Nexar/MotioNet/output/testvid

But my output is: (env) laila@laila:~/Nexar/MotioNet$ python evaluate.py -r ./checkpoints/wild_gt_tcc.pth -i /home/laila/Nexar/openpose/out_openpose/ -o /home/laila/Nexar/MotioNet/output/testvid Building the network Traceback (most recent call last): File "/home/laila/Nexar/MotioNet/evaluate.py", line 148, in main(config, args, output_folder) File "/home/laila/Nexar/MotioNet/evaluate.py", line 124, in main export(args.input) File "/home/laila/Nexar/MotioNet/evaluate.py", line 78, in export files = util.make_dataset([pose_folder], phase='json', data_split=1, sort=True, sort_index=1) File "/home/laila/Nexar/MotioNet/utils/util.py", line 28, in make_dataset images.sort(key=lambda x: int(x.split('/')[-1].split('.')[0].split('')[sort_index])) File "/home/laila/Nexar/MotioNet/utils/util.py", line 28, in images.sort(key=lambda x: int(x.split('/')[-1].split('.')[0].split('')[sort_index])) ValueError: invalid literal for int() with base 10: 'final' In advance thanks for the help! =)

Shimingyi commented 3 years ago

Hi @italosalgado14 , the problem happens when sorting the images by the filename. In line 18:

_images.sort(key=lambda x: int(x.split('/')[-1].split('.')[0].split('_')[sort_index]))

Firstly, the image file path will be split two times by '/' and '.' to get the filename, like _final000, and then take the index part by splitting '_'. In my function, I use the variable sort_index to control where we take the number part, if the filename is _final000, then it should be 1, or if the filename is _final_video000, this variable should be 2.

This variable can be modified in this line. You can check it.

italosalgado14 commented 3 years ago

Thank you very much for the reply. That was exactly the problem and now everything works great!