-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Added smart attribute keeping when changing label #3309
Added smart attribute keeping when changing label #3309
Conversation
As I work with images, I did not know whether attribute mutability should be considered in the attribute keeping decision. Someone better informed could tell me, what would be the correct way to handle that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, sorry for delay in my response.
Generally works fine with shapes and tags, one minor comment about attribute types compatibility. Should we try to keep compatble attributes?
For tracks need to write similar code in Track::_saveLabel at the same file. Do you have an ability to do it? If not, it is okay, we can merge the PR as is.
Also, please add a line to CONTRIBUTING.md and do npm version patch
in cvat-core
to update its version.
cvat-core/src/annotations-objects.js
Outdated
for (const oldAttribute of undoLabel.attributes) { | ||
if ( | ||
attribute.name === oldAttribute.name | ||
&& attribute.inputType === oldAttribute.inputType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
input types "select" and "radio" are fully compatible
we can also check compatibility additionally between "text" and "radio' or "select"
I could make the code to work similarly with tracks, though I won't have the possibility to test it.
Could you explain that a bit? Or was it about what you've commented on the code? |
Sure, I will try to rephrase. As you probably know CVAT supports different types of attributes: CHECKBOX, SELECT, RADIO, TEXT and NUMBER. Speaking about TEXT attributes, we definitely can convert SELECT and RADIO to TEXT with no any issues. And we can do a reverse thing if TEXT attribute value is a possible value for RADIO or SELECT attributes. |
Now I get it. I will try to do these this week. |
Now I only check if the attribute names are the same, and if the old value is still valid in the new attribute. This works even for checkboxes, though I am not sure if that is a desired behaviour. |
Probably we already have a test to change a label, can we update it to cover this case? |
Sure. I'll check and prepare a corresponding task. |
Motivation and context
Implements #2755 and #3294. Basically, when changing label class, attributes are retained IF and only there is an attribute with the same name and type, and the old value is still valid in the new configuration.
How has this been tested?
Tested manually on rectangle labels with various attributes.
Checklist
develop
branchcvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.