Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: LEAP-1367: Add TimelineLabels to mark parts of the video #6191

Merged
merged 44 commits into from
Sep 9, 2024

Conversation

hlomzik
Copy link
Collaborator

@hlomzik hlomzik commented Aug 13, 2024

  • new control tag TimelineLabels with corresponding result type
  • new TimelineRegion to store values in ranges field
  • new data format, shorter than sequence to represent time spans
  • adjustments to Video tag to support new kind of results
  • UX to draw timeline regions on a special new line and on empty spaces in timeline
  • fix deserialization to properly read new results
  • improvements to Video UX:
    • region indices are now in sync with indices in regions list
    • hover and selected states are distinguisable now
    • timeline is not weirdly jumping when you selected a region
    • new Video timelineHeight param to adjust the timeline area

PR fulfills these requirements

  • Tests for the changes have been added/updated (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • Best efforts were made to ensure docs/code are concise and coherent (checked for spelling/grammatical errors, commented out code, debug logs etc.)
  • Self-reviewed and ran all changes on a local instance (for bug fixes/features)

Describe the reason for change

This is a helpful feature, requested for a long time. This first iteration is focused on instant and short time spans with not so many expected regions for annotation.

What alternative approaches were there?

per-frame choices, which are less flexible and have a worse fit into our architecture.

What feature flags were used to cover this change?

none, this feature considered an add-on, not changing much any core and existing functionality.

Does this PR introduce a breaking change?

  • Yes, and covered entirely by feature flag(s)
  • Yes, and covered partially by feature flag(s)
  • No
  • Not sure (briefly explain the situation below)

What level of testing was included in the change?

tests will follow

  • e2e
  • integration
  • unit

🚀 This description was created by Ellipsis for commit f1272b6

Summary:

Introduced TimelineLabels for video annotation, enabling frame classification and timeline region marking, with updates across models, components, and documentation.

Key points:

  • Added TimelineLabels tag for video frame classification in docs/source/tags/timelinelabels.md.
  • Introduced TimelineRegion model in web/libs/editor/src/regions/TimelineRegion.js to store time ranges.
  • Updated Video tag in web/libs/editor/src/tags/object/Video/Video.js to support timelineHeight parameter.
  • Enhanced Timeline component in web/libs/editor/src/components/Timeline/Timeline.tsx to handle new drawing events.
  • Modified Frames view in web/libs/editor/src/components/Timeline/Views/Frames/Frames.tsx to support timeline region drawing.
  • Updated Result model in web/libs/editor/src/regions/Result.js to include timelinelabels.
  • Adjusted Label component in web/libs/editor/src/tags/control/Label.jsx to support TimelineLabels.
  • Added tests for video timeline seek indicator in web/libs/editor/tests/e2e/tests/regression-tests/video-timeline-seek-indicator.test.js.

Generated with ❤️ by ellipsis.dev

- new control tag TimelineLabels with corresponding result type
- new TimelineRegion to store values in `ranges` field
- new data format, shorter than `sequence` to represent timespans
- adjustments to Video tag to support new kind of results
- UX draft to draw timeline regions at any point, will definitely be improved
- fix deserialization to properly read new results
Now they are timespans with distinct borders
Video tag has `mergeLabelsAndResults: true` so it created extra `labels` property, messing with results.
Now there are 3 cases:
- usual tags and regions: all results
- video with rectangles: labels added to rectangles
- video with timeline labels: usual labels result with extra values
- fix types
- remove excess hooks
- react on video region changes
Copy link

netlify bot commented Aug 13, 2024

Deploy Preview for heartex-docs ready!

Name Link
🔨 Latest commit f1272b6
🔍 Latest deploy log https://app.netlify.com/sites/heartex-docs/deploys/66def21602625e0008243a01
😎 Deploy Preview https://deploy-preview-6191--heartex-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Aug 13, 2024

Deploy Preview for label-studio-docs-new-theme ready!

Name Link
🔨 Latest commit f1272b6
🔍 Latest deploy log https://app.netlify.com/sites/label-studio-docs-new-theme/deploys/66def216675023000861a81a
😎 Deploy Preview https://deploy-preview-6191--label-studio-docs-new-theme.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the feat label Aug 13, 2024
@hlomzik
Copy link
Collaborator Author

hlomzik commented Aug 16, 2024

/git merge develop

Workflow run
Successfully merged: create mode 100644 web/libs/frontend-test/src/helpers/LSF/RichText.ts

@hlomzik
Copy link
Collaborator Author

hlomzik commented Aug 20, 2024

/git merge

Workflow run
Successfully merged: delete mode 100644 web/libs/datamanager/src/components/Common/TableOld/utils.js

hlomzik and others added 8 commits August 20, 2024 19:08
Much better check for not being on labels area.
Plus no excess check for classname, it's already checked by `!regionRow`
Create regions only when labels are selected.
Apply labels in a regular way via `resultValue` in `createResult()`.
Respect “select region after” and “keep label selected” settings.
Add comments about multi-labels.
Toggle Keypoint and Toggle Interpolation are disabled for them.
To not break the usual flow with video rectangles.
@hlomzik
Copy link
Collaborator Author

hlomzik commented Aug 29, 2024

/git merge

Workflow run
Successfully merged: Already up to date.

- fix usage of wrong units:
  - positions are 1-based
  - offsets are 0-based, so in calculations positions should be deducted by 1
  - positions are offsets * steps, they were mixed up together
- calculate start and end of currently visible window correctly
  to hop back and forth without skipping frames
- fix conditions for hopping, hop back was unreachable
- fix scrubbing on random page when it's not aligned with `framesInView`;
  jump to next page only if we are moving outside of current view
- fix value stored as previous scroll to be the correct unit
- don't reset current position when video is not fully loaded
- add more meaningful comments
@hlomzik
Copy link
Collaborator Author

hlomzik commented Sep 3, 2024

/git merge

Workflow run
Successfully merged: create mode 100644 .github/workflows/validator-poetry-version.yml

@makseq makseq marked this pull request as draft September 4, 2024 00:26
@makseq makseq marked this pull request as ready for review September 4, 2024 00:26
We don't focus on half-visible frames now, so that had to be fixed.
Plus now test logic is more flexible and bulletproof.
@hlomzik hlomzik changed the title feat: LEAP-1367: Add TimelineLabels to mark parts of the video [DRAFT] feat: LEAP-1367: Add TimelineLabels to mark parts of the video Sep 4, 2024
@MihajloHoma
Copy link
Contributor

MihajloHoma commented Sep 6, 2024

/git merge

Workflow run
Successfully merged: Already up to date.

@MihajloHoma
Copy link
Contributor

MihajloHoma commented Sep 6, 2024

/docker build

Workflow run
Docker image was pushed with the tag 20240906.101645-fb-leap-1362-timeline-reg-ab969e8cc

@hlomzik hlomzik merged commit 05d4a8c into develop Sep 9, 2024
35 checks passed
@hlomzik
Copy link
Collaborator Author

hlomzik commented Sep 9, 2024

@ellipsis-dev review this

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to f1272b6 in 51 seconds

More details
  • Looked at 1159 lines of code in 22 files
  • Skipped 1 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. web/libs/editor/src/components/Timeline/Timeline.tsx:6
  • Draft comment:
    The fixMobxObserve function is imported but not used. Consider removing it to clean up the code.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    In Timeline.tsx, the fixMobxObserve function is imported but not used. This is unnecessary and should be removed to clean up the code.

Workflow ID: wflow_IQNeJsSffboi4oVH


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

6 days left in your free trial, upgrade for $20/seat/month or contact us.


if (!isDefined(start)) {
if (!isDefined(end)) return [];
return { frame: end, enabled: false };
Copy link

Choose a reason for hiding this comment

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

The rangeToSequence function returns an object when only end is defined, but it should return an array to maintain consistency with other return types. Consider returning an array with a single object instead.

@@ -172,6 +174,8 @@ const TimelineComponent: FC<TimelineProps> = ({
</Elem>
);

regions.map((reg) => fixMobxObserve(reg.sequence));
Copy link

Choose a reason for hiding this comment

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

The regions.map call on this line is not used and can be removed to improve performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants