Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

fix: LEAP-31: Fix functioning of auto annotations #1605

Merged
merged 14 commits into from
Nov 21, 2023

Conversation

Gondragos
Copy link
Contributor

@Gondragos Gondragos commented Oct 25, 2023

PR fulfills these requirements

  • Commit message(s) and PR title follows the format [fix|feat|ci|chore|doc]: TICKET-ID: Short description of change made ex. fix: DEV-XXXX: Removed inconsistent code usage causing intermittent errors
  • 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)

Change has impacts in these area(s)

(check all that apply)

  • Product design
  • Frontend

Describe the reason for change

Working with data annotations was too complicated and inconsistent in a lot of cases so this PR is trying to change that by fixing bugs and implementing a different approach for the tags that do not support suggestion by design.

What does this fix?

  • remove FF that could break auto annotating for Image Segmentstion etc.
  • fix problem with auto annotation toggle which did not affect previously created regions so we had unexpected requests for sugestions
  • fix potential problem with groupping regions by type (getConnectedDynamicRegions)
    • it didn't work with classifications except textarea
    • it didn't work with Audio and Video
    • it had unexpected regions in this list before
  • allow classifications, audio and video regions to trigger regionFinishedDrawing event (they don't have to be dynamic). And it will always accept suggestions automaticaly.
  • fix side effects where some regions not from the region list could generate events for requesting suggestions (it also could generate accidental empty request)
    • it was genereted from accepted suggestions wen they were deleted (accepted)
    • it was generated from TextArea, because to display data correctly it creates quasi-region, using real region model.
  • clean/rework related hacks in code

What libraries were added/updated?

@heartexlabs/ls-test

Does this change affect performance?

Nope

Does this change affect security?

Nope

What alternative approaches were there?

Was not detected

What feature flags were used to cover this change?

N/A

Does this PR introduce a breaking change?

(check only one)

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

It fixes a lot and it didn't work properly before, but it should be reviewed and tested with full attention.

What level of testing was included in the change?

(check all that apply)

  • e2e
  • integration
  • unit

Which logical domain(s) does this change affect?

Auto Annotations, Smart tools, Dynamic regions, LLM, Image, Textarea

@github-actions github-actions bot added the fix label Oct 25, 2023
@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8c6e3e5) 67.93% compared to head (f05362c) 68.17%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1605      +/-   ##
==========================================
+ Coverage   67.93%   68.17%   +0.24%     
==========================================
  Files         443      443              
  Lines       28653    28662       +9     
  Branches     7615     7615              
==========================================
+ Hits        19464    19539      +75     
+ Misses       7921     7866      -55     
+ Partials     1268     1257      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@yyassi-heartex yyassi-heartex left a comment

Choose a reason for hiding this comment

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

looks good to me, i just added 1 little suggestion for readability since its a one liner but thats optional since its fine as it is

Gondragos and others added 4 commits November 14, 2023 15:02
…otation-fixes

# Conflicts:
#	tests/functional/package.json
#	tests/functional/yarn.lock
Co-authored-by: yyassi-heartex <[email protected]>
return canBePartOfNotification
&& region.type === type
&& region.labelName === labelName
&& region.results?.[0]?.to_name === self.results?.[0]?.to_name;
Copy link
Member

Choose a reason for hiding this comment

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

It potentially compare undefined === undefined here. Could it lead to any unexpected issues?

Copy link
Contributor Author

@Gondragos Gondragos Nov 16, 2023

Choose a reason for hiding this comment

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

I've just checked that. It seems that the only way to get undefined === undefined is collecting connected regions in the case with config that contains two classification tags with the same to_name. I'm not sure if we need to group them but it's anyhow is better than it was.

// Indicates that it is not temporary region created just to display data like Textarea's one
// and is not a suggestion
get isRealRegion() {
return self.annotation?.areas?.has(self.id);
Copy link
Member

Choose a reason for hiding this comment

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

That's actually smart. Love it.

@@ -252,6 +252,7 @@ export const Annotation = types
draftSelected: false,
autosaveDelay: 5000,
isDraftSaving: false,
isSuggestionsAccepting: false,
Copy link
Member

Choose a reason for hiding this comment

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

could you please add a comment describing this flag? from the name alone it's not very clear what it supposed to do

@Gondragos Gondragos merged commit f209200 into master Nov 21, 2023
@Gondragos Gondragos deleted the fb-leap-31/auto-annotation-fixes branch November 21, 2023 23:29
MasherJames pushed a commit to HelloPareto/label-studio-frontend that referenced this pull request Feb 29, 2024
* fix: LEAP-31: Fix functioning of auto annotations

* Add tests

* Fix eslint warnings

* Update ls-test

* Remove Region#revokeSuggestion

* Update ls-test

* Refactor

Co-authored-by: yyassi-heartex <[email protected]>

* Update ls-test

* Add comment

* Update ls-test

* fix deps

---------

Co-authored-by: yyassi-heartex <[email protected]>
Co-authored-by: hlomzik <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants