Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

The saved reference frames are not the original frames #64

Open
Yumin-Sun-00 opened this issue Nov 14, 2019 · 6 comments
Open

The saved reference frames are not the original frames #64

Yumin-Sun-00 opened this issue Nov 14, 2019 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@Yumin-Sun-00
Copy link

Yumin-Sun-00 commented Nov 14, 2019

** The generated video's reference frames are not the same to the original one's.

As I noticed, the original reference frames have, in my case, size 1280, 720. The saved reference frames are first resized to 1280,704, and than later resize back to 1280, 720. This makes the saved reference frames not identical to the original frames anymore.

And this will have artifacts on the interpolated frames.

The easiest solution, I considered, is to first patch the video width and height to some multiple of 32, to avoid the resize, and cut the patch after interpolation.

** The reverse normalization does not give the same result.
Another issue is that, the reverse normalization TP, do not give the same image.

@avinashpaliwal
Copy link
Owner

avinashpaliwal commented Dec 3, 2019

Thanks for pointing this out. I will add the padding logic shortly.

The reverse normalization does not give the same result.

Can you elaborate more on this issue? And also specify your setup.

@avinashpaliwal avinashpaliwal self-assigned this Dec 3, 2019
@avinashpaliwal avinashpaliwal added the enhancement New feature or request label Dec 3, 2019
@Yumin-Sun-00
Copy link
Author

Thanks for pointing this out. I will add the padding logic shortly.

The reverse normalization does not give the same result.

Can you elaborate more on this issue? And also specify your setup.

So, if you remove the resize and pre-process the frames to proper size no matter you crop them or pad them, the normalization and reverse normalization will leave some artifacts on the reference frames. I suggest that when it is the reference frame you just “copy“ them into the temp output folder with the same size as interpolated frames

@avinashpaliwal
Copy link
Owner

I don't understand why the normalization would cause artifacts. In the implementation, it's just subtraction and addition of a constant from the image. Well anyway I can change the implementation to copy the original image, but if you have artifacts on the interpolated frame due to normalization then it would still be very noticeable.

@Yumin-Sun-00
Copy link
Author

I don't understand why the normalization would cause artifacts. In the implementation, it's just subtraction and addition of a constant from the image. Well anyway I can change the implementation to copy the original image, but if you have artifacts on the interpolated frame due to normalization then it would still be very noticeable.

you know the color is stored as 0-255 integers, and when you do normalization and reverse, it may cause some small difference. Maybe you can test more about this.

@avinashpaliwal
Copy link
Owner

you know the color is stored as 0-255 integers, and when you do normalization and reverse, it may cause some small difference. Maybe you can test more about this.

The dataloader in this code stores pixel intensities as float in range 0-1. I'll try to make some modifications. Personally, I have not seen any artifacts on my system (CPU and GPU).

@Thomasedv
Copy link

Thomasedv commented Aug 5, 2020

I'm not entirely sure if it's the case in this given situation, but i've had some experience with ffmpeg, when i extract frames to png for example, they also have some other metadata which sets something gamma i think, which changes the look of the image. PIL however doesn't care and while it loads that metadata, it doesn't resave it. Which causes those images opened and resaved to be slightly different due to lack of gamma, despite the RGB values being the exact same for each image. I initially noticed this myself making something similar as superslomo, where instead of loading reference images, i just copied them to the output folder with the correct name/index. Opening the images in a image viewer and stepping through the folder the change between interpolated images and original ones really shows.

I do however note, ffmpeg doesn't care about it when creating an output video, so no flickering happens, it either keep or just strips the gamma values from the images, so it's not a big deal in practice, assuming it's the same bug.

I also think padding images is smarter than cropping, and can be done with PIL quite easily, and added to the Transforms for normalization.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants