ChiWeiHsiao / DeepVO-pytorch

PyTorch Implementation of DeepVO
339 stars 105 forks source link

Sorting Issue of input images #37

Open alexriedel1 opened 3 years ago

alexriedel1 commented 3 years ago

Hello, thanks for your awesome work. However there is a major issue i guess, in your data_helper.py https://github.com/ChiWeiHsiao/DeepVO-pytorch/blob/bb43825e54b0d96d40bfe8b30013d5438f607908/data_helper.py#L22. When loading image paths and sorting them, considering your single frames are named:

li = ['00000.png', '00001.png', '00002.png','000010.png', '0000100.png'] li.sort() will give you: ['00000.png', '00001.png', '000010.png', '0000100.png', '00002.png'] which is not the natural order when someone sliced a video to single frames.

I'm using https://pypi.org/project/natsort/ for this issue, giving you

from natsort import natsorted
li_sorted = natsorted(li)
['00000.png', '00001.png', '00002.png', '000010.png', '0000100.png']
mrdavoodi commented 3 years ago

Try to examine a list with the full path. I tried it and got right result! it was like this: ['images/00/00001.png', 'images/00/00002.png', 'images/00/00010.png', 'images/00/00020.png', 'images/01/00001.png', 'images/01/00002.png', 'images/01/00010.png', 'images/01/00020.png', 'images/10/00001.png', 'images/10/00002.png', 'images/10/00010.png', 'images/10/00020.png']