Comments (11)
A naive solution is to zero pad the filename. For example, 0.png --> 000.png. You can do str(idx).zfill(3) + '.png'
.
from fgvc.
@GrahamboJangles wherever you have sorted function in the code just replace it with natsorted. It does make an ordered list and the rest of the code will just use a list that is sorted in that way, you don't have to do anything else with it.
For example, here (lines 395,396):
for filename in sorted(filename_list):
video.append(torch.from_numpy(np.array(Image.open(filename)).astype(np.uint8)).permute(2, 0, 1).float())
This loads your files from a list and appends them to a video. If the sorted function doesn't sort images as it should, it will append it to a video in a irregular way so your video final video will skip (because the rest of the code will use images that were not sorted correctly). Try to print filename_list when you use sorted and also when you use natsorted, if you have the same issue that I had the problem will be obvious. Also, if the masks are loaded irregularly you will have a similar problem.
from fgvc.
Can you first check if the output images are in the right order?
from fgvc.
Can you check in what order sorted function is returning your images?
from fgvc.
Can you check in what order sorted function is returning your images?
Yup you guys might be right, I will invest investigate that and report back.
from fgvc.
@gaochen315 @jelenaaaaa - So the frames are in the right order when I open each jpeg in numerical order. But in Colab, it looks like this:
I don't know if this is the problem though, because no matter how the files are arranged on screen they are still in order.
from fgvc.
@gaochen315 @jelenaaaaa - So the frames are in the right order when I open each jpeg in numerical order. But in Colab, it looks like this:
I don't know if this is the problem though, because no matter how the files are arranged on screen they are still in order.
Try to use natsorted instead of sorted function (you can install natsort from pip and then from natsort import natsorted)
from fgvc.
I sorted used natsort, sorry for the noob question but then am I supposed to shutil.move() according to the sorted list of items?
I zipped up the files in Colab and downloaded them onto my Windows PC, and they were ordered correctly. Then I put them into Colab again, unzipped it, and they are in the wrong order again. I think it's just the way that Colab shows the order of files, but as long as the files are numerically in order it shouldn't be a problem.
Is this a Colab problem?
from fgvc.
I sorted used natsort, sorry for the noob question but then am I supposed to shutil.move() according to the sorted list of items?
I zipped up the files in Colab and downloaded them onto my Windows PC, and they were ordered correctly. Then I put them into Colab again, unzipped it, and they are in the wrong order again. I think it's just the way that Colab shows the order of files, but as long as the files are numerically in order it shouldn't be a problem.
Is this a Colab problem?
I had a similar problem myself and I just used natsorted instead of sorted (I changed it everywhere) and It worked just fine. I did not use shutil.move(). The problem was with reading images and masks, if images are not appended in video in the right order (and also the corresponding masks) the final video will look like it's skipping frames. I did not use Colab so I really don't know if the problem is with that or something else.
from fgvc.
@jelenaaaaa Where did you natsort, exactly? It just seems to make an ordered list, I'm not sure what to do with the list.
from fgvc.
@jelenaaaaa I replaced the instances in the code of sorted(filename_list) with natsorted(filename_list) and it seemed to help a little bit but I still had some skipping for some reason. Maybe I missed a line. But then I implemented what @gaochen315 said with my frame extracting code and the padding of the filenames fixed the issue. Thank you guys for your help!
from fgvc.
Related Issues (20)
- ' --Nonlocal ' in video_completion.py results in error HOT 2
- Object removal task evaluation code HOT 3
- RuntimeError: Error keeps saying "to have 3 channels, but got 4 channels instead" HOT 1
- The implementation of the homography warp before optical flow calculation HOT 4
- Inpainting doesn't seem to clean up intermediary files HOT 2
- server for weights.zip and data.zip seems unreachable HOT 5
- 对于较少背景移动时,去除文字水印,会出现填充拖影问题 HOT 1
- How can I train a new model on a different dataset? HOT 4
- Same problem result of '--Nonlocal' (as issue #52) HOT 2
- Where can I read about all those parameters such as edge guide, mixed precisions and so on? HOT 1
- Code Error in non-local optical flow concatenation HOT 1
- RAFT Model HOT 1
- edge_guide flag HOT 1
- test question HOT 2
- Inference is not as accurate as the provided video samples HOT 4
- Evaluation Metrics HOT 2
- code question
- How to train the network? HOT 1
- Please Large FOV colab
- Dependencies can't be installed in colab
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fgvc.