Skip to content

Conversation

@HYLcool
Copy link
Collaborator

@HYLcool HYLcool commented Nov 19, 2025

As the title says.

@HYLcool HYLcool self-assigned this Nov 19, 2025
@HYLcool HYLcool added enhancement New feature or request dj:op issues/PRs about some specific OPs labels Nov 19, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @HYLcool, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant enhancement to the video motion score filters by allowing users to persist the computed optical flow data. Previously, optical flow was an internal calculation used solely for determining motion scores. With this change, users can now opt to save this detailed motion information directly into the dataset's metadata, providing greater flexibility for downstream analysis or further processing. This feature is implemented across both the standard "VideoMotionScoreFilter" and the "VideoMotionScoreRaftFilter".

Highlights

  • Optical Flow Output: Introduced new parameters "if_output_optical_flow" and "optical_flow_key" to "VideoMotionScoreFilter" and "VideoMotionScoreRaftFilter" to enable saving computed optical flows.
  • Metadata Storage: When enabled, the computed optical flows for each video are stored in the dataset's metadata under the specified "optical_flow_key" (defaulting to "MetaKeys.video_optical_flow").
  • New Constant: Added "MetaKeys.video_optical_flow" to "data_juicer/utils/constant.py" for consistent key naming.
  • Test Coverage: New unit tests were added for both "VideoMotionScoreFilter" and "VideoMotionScoreRaftFilter" to ensure the correct functionality of the optical flow output feature.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a useful feature to optionally save computed optical flows in two video motion score filters. The implementation is mostly correct, but I've identified a critical issue that could lead to a crash when processing videos with few frames or corrupted data. Additionally, there's a minor typo in a docstring, and the new tests could be more robust. I've provided specific suggestions to address these points.

@HYLcool HYLcool changed the title Allow to save the computed optical flows in two video motion score filters [WIP] New Optical Flow OP & Allow to save the computed optical flows Nov 19, 2025
@HYLcool HYLcool changed the title [WIP] New Optical Flow OP & Allow to save the computed optical flows New Optical Flow OP & Allow to save the computed optical flows Nov 21, 2025
+ add remarks to distinguish two motion score filters
# Conflicts:
#	data_juicer/ops/filter/video_motion_score_filter.py
#	tests/ops/filter/test_video_motion_score_filter.py
@yxdyc yxdyc merged commit 66d2513 into main Jan 12, 2026
5 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in data-juicer Jan 12, 2026
@HYLcool HYLcool deleted the feat/opt_flow_saving branch January 12, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dj:op issues/PRs about some specific OPs enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants