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

[GSoC2024] Added feature to show tags corresponding to GT job and manual job in a separate row #7774

Merged
merged 22 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
814deb1
tag annotation corresponding to GT job shown in seperate row with mar…
Viditagarwal7479 Apr 15, 2024
fc9db18
added this to the changelog.md
Viditagarwal7479 Apr 15, 2024
868bf35
updated tag order to fix position of manual tag annotations
Viditagarwal7479 Apr 16, 2024
f5dbce5
Merge branch 'develop' into ui-tag-annotations
Viditagarwal7479 Apr 16, 2024
489558d
added a new property of highlight in label attributes
Viditagarwal7479 Apr 17, 2024
922810b
tag will not be passed to highlight canvas instance and will be highl…
Viditagarwal7479 Apr 17, 2024
dc94e1f
Merge branch 'develop' into ui-tag-annotations
Viditagarwal7479 Apr 17, 2024
d437411
labels of tag type annotation aren't passed to canvas and highlighted…
Viditagarwal7479 Apr 24, 2024
de1a6ec
moved style properties of highlighted label annotation to style.scss
Viditagarwal7479 Apr 24, 2024
c5e44a9
fixed FrameTag to use the state variable highlightedConflict to highl…
Viditagarwal7479 Apr 24, 2024
5c93fad
Merge branch 'develop' into ui-tag-annotations
Viditagarwal7479 Apr 24, 2024
03d0296
removed added highlight attribute for Label
Viditagarwal7479 Apr 26, 2024
5db5ecc
Merge branch 'ui-tag-annotations' of https://github.com/Viditagarwal7…
Viditagarwal7479 Apr 26, 2024
706659e
cleaned the conflict highlighting logic to prevent breaks during un-h…
Viditagarwal7479 Apr 26, 2024
8c34874
removed trailing space in the changelog.md update
Viditagarwal7479 Apr 26, 2024
2873af3
reduced the changelog entry to less than 120 words
Viditagarwal7479 May 1, 2024
24bdb2e
removed updating the state of attribute highlightedConflict
Viditagarwal7479 May 2, 2024
9c13f84
Merge branch 'develop' into ui-tag-annotations
Viditagarwal7479 May 2, 2024
8f9dc72
small fix
klakhov May 3, 2024
cdd80a4
added optimization, fixed de-highlight bug
klakhov May 3, 2024
627402b
Merge branch 'develop' into ui-tag-annotations
zhiltsov-max May 6, 2024
08a1043
Merge branch 'develop' into ui-tag-annotations
Viditagarwal7479 May 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Added

- Added feature to show tags corresponding to GT job and manual job in a separate row. Along with the tags of the GT job have a mark of '(GT)' in them.
Viditagarwal7479 marked this conversation as resolved.
Show resolved Hide resolved
(<https://github.com/cvat-ai/cvat/pull/7774>)
1 change: 1 addition & 0 deletions cvat-core/src/labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export class Label {
public deleted: boolean;
public patched: boolean;
public readonly hasParent?: boolean;
public highlight = false;
Viditagarwal7479 marked this conversation as resolved.
Show resolved Hide resolved

constructor(initialData: Readonly<SerializedLabel>) {
const data = {
Expand Down
Viditagarwal7479 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,48 @@ class CanvasWrapperComponent extends React.PureComponent<Props> {
}

if (prevProps.highlightedConflict !== highlightedConflict) {
const { onUpdateAnnotations } = this.props;
const severity: HighlightSeverity | undefined = highlightedConflict
?.severity as unknown as HighlightSeverity;
const highlightedClientIDs = (highlightedConflict?.annotationConflicts || [])
.map((conflict: AnnotationConflict) => annotations
.find((state) => state.serverID === conflict.serverID && state.objectType === conflict.type),
.find((state) => conflict.type !== 'tag' && state.serverID === conflict.serverID && state.objectType === conflict.type),
).filter((state: ObjectState | undefined) => !!state)
.map((state) => state?.clientID) as number[];

// if last highlightedConflict was a tag then un-highlight it
const prevHighlightedClientIDs = (prevProps.highlightedConflict?.annotationConflicts || [])
.map((conflict: AnnotationConflict) => annotations
.find((state) => conflict.type === 'tag' && state.serverID === conflict.serverID && state.objectType === conflict.type),
).filter((state: ObjectState | undefined) => !!state)
.map((state) => state?.clientID) as number[];
if (prevHighlightedClientIDs.length !== 0) {
const states = annotations.filter((state) => prevHighlightedClientIDs.includes(state.clientID || 0));
if (states) {
for (const state of states) {
state.label.highlight = false;
onUpdateAnnotations([state]);
}
}
}

// if current conflict ids is empty then there might be a conflict in tag annotations
if (highlightedClientIDs.length === 0) {
const highlightedTagClientIDs = (highlightedConflict?.annotationConflicts || [])
.map((conflict: AnnotationConflict) => annotations
.find((state) => conflict.type === 'tag' && state.serverID === conflict.serverID && state.objectType === conflict.type),
).filter((state: ObjectState | undefined) => !!state)
.map((state) => state?.clientID) as number[];

const states = annotations.filter((state) => highlightedTagClientIDs.includes(state.clientID || 0));
if (states) {
for (const state of states) {
state.label.highlight = true;
onUpdateAnnotations([state]);
}
}
}

canvasInstance.highlight(highlightedClientIDs, severity || null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,50 @@ function FrameTags(props: StateToProps & DispatchToProps): JSX.Element {

return (
<>
{frameTags.map((tag: any) => (
<Tag
className='cvat-frame-tag'
color={tag.label.color}
onClose={() => {
onRemoveState(tag);
}}
key={tag.clientID}
closable
>
{tag.label.name}
</Tag>
))}
<div>
{frameTags
.filter((tag: any) => tag.source !== 'Ground truth')
.map((tag: any) => (
<Tag
className='cvat-frame-tag'
color={tag.label.color}
onClose={() => {
onRemoveState(tag);
}}
key={tag.clientID}
closable
style={{
transform: tag.label.highlight ? 'scale(1.1)' : 'scale(1)',
transformOrigin: 'left',
Viditagarwal7479 marked this conversation as resolved.
Show resolved Hide resolved
}}
>
{tag.label.name}
</Tag>
))}
</div>
<div>
{frameTags
.filter((tag: any) => tag.source === 'Ground truth')
.map((tag: any) => (
<Tag
className='cvat-frame-tag'
color={tag.label.color}
onClose={() => {
onRemoveState(tag);
}}
key={tag.clientID}
closable
style={{
transform: tag.label.highlight ? 'scale(1.1)' : 'scale(1)',
transformOrigin: 'left',
}}
>
{tag.label.name}
{' '}
(GT)
</Tag>
))}
</div>
</>
);
}
Expand Down