This project uses deep learning to create smooth time-lapse videos from a sequence of images by interpolating intermediate frames. It leverages the Film-Style frame interpolation model to generate natural transitions between input frames.
Refer: https://github.com/google-research/frame-interpolation/tree/main
- Frame interpolation between pairs of images using a pretrained neural network
- Support for multiple input image formats (PNG, JPEG, BMP)
- Automatic image resizing while maintaining aspect ratio
- Face timelapse with automatic face centering and background removal
- Configurable output FPS and interpolation settings
- GPU acceleration support
- Open
time_lapse_Google_Colab.ipynb
notebook directly in colab. - Select runtime as T4 GPU from Settings.
- Run the notebook: Change the input and output paths and other settings
- Notebook will automatically download the github repository, install requirements and download models.
-
Create a conda environment with TensorFlow and GPU support. If you are on Windows, use WSL.
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the notebooks: Select and input and output paths
Use the simple_interpolation.ipynb
notebook to interpolate frames between two images:
from eval import interpolator, util
# Initialize the interpolator
predictor = Predictor()
predictor.setup()
# Generate intermediate frames
output_frames = predictor.predict(
frame1="input_frames/image1.jpg",
frame2="input_frames/image2.jpg",
times_to_interpolate=5,
out_dir="output_frames",
img_size=(1080, 720)
)
Example
(middle image is interpolated)
Use the time_lapse.ipynb
notebook to create a time-lapse video from multiple images:
-
Place your input images in the
input_frames/<sequence_name>
directory. The image names should be of format yyyymmdd_hhmmss.jpg (android photos default names) -
Configure settings in the notebook:
input_dir = 'input_frames/sequence' output_dir = 'output_frames/sequence' fps = 24
-
Run the notebook to:
- Preprocess images to a consistent size
- Generate interpolated frames between each pair
- Create the final time-lapse video
The output video will be saved as output_frames/sequence.mp4
.
Set the preprocess_face variable to true in time_lapse.ipynb
and simple_interpolation
video and the images will be preprocessed to center the face and remove background to enhace the time lapse experience.
- Configure settings in the notebook:
input_dir = 'input_frames/sequence' output_dir = 'output_frames/sequence' preprocess_faces = True # for faces equal_intervals = True # equal no frames between images or date based fps = 24
- Automatically identify date format from filenames/file metadata for time lapse.
- Improve face time lapse to handle multiple faces, and have consistent lighting.