8000 GitHub - abhaskumarsinha/KMT: A Keras-based motion transfer model leveraging first-order Jacobian-based motion estimation to animate a static image using keypoints, inspired by Aliaksandr Siarohin's first-order motion model.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A Keras-based motion transfer model leveraging first-order Jacobian-based motion estimation to animate a static image using keypoints, inspired by Aliaksandr Siarohin's first-order motion model.

License

Notifications You must be signed in to change notification settings

abhaskumarsinha/KMT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

49 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Contributors Forks Stargazers Unlicense License

KMT: Keras Motion Transfer

Keras Motion Transfer

[Keras] . [First Order Animation] . [Notebook] . [Logo] . [Vox Dataset]

A Keras-based motion transfer model leveraging first-order Jacobian-based motion estimation to animate a static image using keypoints, inspired by Aliaksandr Siarohin's first-order motion model.

๐Ÿ“Œ About The Project

KMT: Keras Motion Transfer is a deep learning pipeline for animating a static image using the motion from a driving video. Inspired by recent advances in self-supervised keypoint-based motion transfer, this project implements a generative model in Keras that can transfer motion dynamics from video frames to a target image, generating a coherent, animated sequence.

KMT consists of two core components:

Keypoint Detector

  • Detects keypoint positions and estimates local motion (via 2ร—2 Jacobians) in both the source (static image) and driving (video frame) domains.

Generator

  • Takes a grayscale source image of shape (256, 256, 1) and the keypoint information from both the source and driving frames. It computes the transformation using first-order motion approximations and synthesizes the animated output frame-by-frame.

๐Ÿ” How It Works

  • The keypoint detector extracts (x, y) coordinates and local Jacobians for each keypoint from both the source image and each frame of the driving video.

  • Motion transfer is modeled based on a first-order approximation, as described in Eq. (4) of the original motion transfer paper.

  • The relative motion between keypoints is estimated using the Jacobians and keypoint offsets.

  • A dense motion field is constructed, which is then fed into the generator along with the static source image.

  • The generator synthesizes the animated frame corresponding to each video frame's motion.

  • A GAN training setup refines both the keypoint detector and the generator for realistic motion and appearance.

โš™๏ธ Technical Highlights

  • Built entirely using the Keras deep learning framework.

  • Backend agnostic โ€” designed to work (in theory) with TensorFlow, JAX, and PyTorch backends.

  • Grayscale only (B/W) generation to avoid misuse in real-world facial applications.

  • Currently single-device only โ€” no support for distributed training yet.

Getting Started

Installation

pip install -r requirements. txt

Getting Started

Check example.ipynb notebook to get started.

๐Ÿš€ Features

  • Supports video dataloading for training and inference

  • Includes a dataset creator to build custom datasets

  • Automatically switches between GPU and CPU based on availability

  • Backend-agnostic design (theoretically compatible with JAX, PyTorch, and TensorFlow)

  • Modular and clean codebase for easy debugging and rapid experimentation

Example Results

Grid Preview

Grid Preview

Example first frame

first_frame

Example Motion Transfer

Vox Animated

Example Notebook output

7fd85b61-905a-4b9c-8ffc-484385e85886

References

  • Siarohin, Aliaksandr, et al. "First order motion model for image animation." Advances in neural information processing systems 32 (2019).
  • Chollet, Franรงois and others. Keras, 2015. Available at: https://keras.io

Cite

@misc{KMT2025,
  author       = {Abhas Kumar Sinha},
  title        = {KMT: Keras Motion Transfer},
  year         = {2025},
  publisher    = {GitHub},
  journal      = {GitHub repository},
  howpublished = {\url{https://www.github.com/abhaskumarsinha/KMT}},
  note         = {MIT License. Copyright (c) 2025 Abhas Kumar Sinha}
}

About

A Keras-based motion transfer model leveraging first-order Jacobian-based motion estimation to animate a static image using keypoints, inspired by Aliaksandr Siarohin's first-order motion model.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0