feature: shows number of annotated frames#6076
Conversation
🐳 Docker image sizes
|
There was a problem hiding this comment.
Pull request overview
Adds UI support for displaying “annotated frames / total frames” for video media items, and ensures relevant dataset media queries are refreshed after annotation updates so counts stay in sync.
Changes:
- Update the video thumbnail indicator to show
annotated_frame_count / frame_count. - Invalidate the dataset media listing query after saving annotations to refresh annotated frame counts.
- Minor cleanup of
$apiparams object formatting.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| application/ui/src/shared/annotator/annotation-actions-provider.component.tsx | Adds invalidation for /dataset/media so media list data (incl. counts) refreshes after annotation saves. |
| application/ui/src/hooks/use-get-dataset-media-items.hook.ts | Refactors the query params object formatting for the infinite media query. |
| application/ui/src/components/media-thumbnail/media-thumbnail.component.tsx | Updates the video overlay label to display “annotated / total frames”. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📊 Test coverage report
|
| incrementCachedAnnotatedFrameCount(queryClient, video2); | ||
|
|
||
| const data = getMediaQueryData(queryClient); | ||
| expect(data?.pages[0].items[0]).toEqual(expect.objectContaining({ annotated_frame_count: 2 })); |
There was a problem hiding this comment.
video1.annotated_frame_count
There was a problem hiding this comment.
I don't see this being updated
There was a problem hiding this comment.
that commit didn't go through but it is on now
5f8fe1b to
56a10d5
Compare
|
|
||
| import { InfiniteData, QueryClient } from '@tanstack/react-query'; | ||
|
|
||
| import { SchemaMediaWithPagination } from '../../api/openapi-spec'; |
There was a problem hiding this comment.
add a new type to shared-types and import that here instead of importing from openapi directly
| @@ -75,9 +78,7 @@ export const AnnotationActionsProvider = ({ | |||
| [ | |||
| 'get', | |||
| '/api/projects/{project_id}/dataset/media/{media_id}/frames', | |||
There was a problem hiding this comment.
why dont we invalidate '/api/projects/{project_id}/dataset/media' and avoid doing the optimistic update with the new util?
There was a problem hiding this comment.
It was my initial approach, but Copilot pointed out that for large datasets it would require refetching multiple pages, which could lead to performance degradation. #6076 (comment)
| aria-label='annotated frames' | ||
| > | ||
| <Content> | ||
| <Text>Total frames: {frameCount}</Text> |
There was a problem hiding this comment.
IMO the order should be reverted to stay consisted with the flow number of annotated / number of total
| params: { path: { media_id: mediaItem.id, project_id: projectId }, query }, | ||
| body: { annotations: annotationsDTO, subset: subset ?? undefined }, | ||
| }); | ||
| await saveMutation |
There was a problem hiding this comment.
For later: use try catch and move incrementCachedAnnotatedFrameCount and undoRedoActions.reset to the try block.
abde538 to
18b45d3
Compare
| alignItems={'center'} | ||
| UNSAFE_className={classes.videoIndicator} | ||
| > | ||
| {formatDurationText(duration)} |
There was a problem hiding this comment.
IIRC Mariusz wants display the following:
45s = 0:45, not 00:00:45,
1h 45 min 30 s= 1:45:30, not 01:45:30
Could you please make sure that we can reuse formatDurationText?
There was a problem hiding this comment.
I'll have a dedicated Pr for it
Summary
#5903
Dataset - for videos, the review status icon on the thumbnail should display the number of annotated frames out of the total (e.g. "44 / 350").How to test
Checklist