manuelruder / artistic-videos

Torch implementation for the paper "Artistic style transfer for videos"
Other
1.75k stars 252 forks source link

Seamless looping? #60

Open ProGamerGov opened 6 years ago

ProGamerGov commented 6 years ago

Is there a way that I can make sure Artistic-Videos will make sure the final frame and starting frame of a looping video or GIF, will seamlessly blend together?

JCBrouwer commented 6 years ago

I've been copying the first frame to the end and calculating the flow for that as well. I've also noticed that starting each pass at a different frame index helps to smooth over loop points as the first calculated frame in a run uses frames from the previous run as initialization while all other frames in the run use the previously calculated frame.

I can post a gist with the code I'm currently using in a couple hours.

The results are still far from perfect, but I think playing around with the parameters should still yield a lot of improvement.

Example 1

Example 2

JCBrouwer commented 6 years ago

https://gist.github.com/JCBrouwer/709a4782a8d177557ad86a60926c890b

It's quite messy and a bit hacky in places but it works on my end. I think I've taken out all the hardcoded bits but there might still be a couple lurking around, no promises that I haven't broken any of the functionality.

The docker image I'm using to compute the optic flow can be found here (I'm on a mac, copy paste the command from the original script to run it without docker if you can).

One more example