-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Label color #2014
Label color #2014
Conversation
colors[label] = tuple(map(int, color.split(','))) | ||
return colors | ||
|
||
def normalize_label(label): |
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.
The function is not used anymore, but it should be to avoid problems with symbol case and special characters.
The logic is:
- sort labels to provide stable results (across different tasks with same labels)
- find matching labels using normalization
- if have conflicts, the first match uses the table
- generate random colors for the rest
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.
Now colors are set at the time of label creation. So i guess sorting by its name can not provide stable result now. I can not create labels with the same name, so are there any conflicts?
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.
Conflicts appear from labels like BACKGROUND
, _BA_CK_gro_und_
, back_GROUND
etc after their normalization. I feel that sorting might be unnecessary anymore, or should be done in label creation code, when it is done in batch mode.
Pull Request Test Coverage Report for Build 7036
💛 - Coveralls |
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.
When we change label color on the annotation view (Enter shortcut), is it expected to be changed on a server? |
What is the status of the PR? Several comments from my side:
|
@nmanovic, finishing work on annotation view. I'm totally agree about "reset to default". But changing color proceed immediately after picking. So I don't think button "Ok" is necessary. What do you think? |
I think that need to replace "Label color" by a color pictogram for sure. I think that colors for default labels should be reviewed one more time. Also press X isn't intuitive way to choose a color. |
@ActiveChooN , looks like colors of labels are not matched between the task view and annotation view. Is it something you are working right now? |
Create new task dialog:
Color picker dialog:
Job view:
|
|
||
for task in Task.objects.all(): | ||
labels = Label.objects.filter(task_id=task.id) | ||
normalized_names = [normalize_label(l.name) for l in labels] |
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.
I see the code in 3 places. Need to remove code cloning because the logic isn't trivial.
Will Road
and road
have the same color? Is it OK to have the same color for different classes?
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.
@nmanovic, sorry for a long wait. Realized that default python hash function has a random seed every run and colors weren't consistent.
I see the code in 3 places. Need to remove code cloning because the logic isn't trivial.
Done.
Will Road and road have the same color? Is it OK to have the same color for different classes?
If that labels will appear in the task only once they will have the same color. But if label will appear in the task more than one time, for the first label color will be taken from the color map and color will be calculated with hash for others.
In this patch I can change colors (when |
Motivation and context
This PR helps user to change predefined label color. When creating a label, it is assigned a color from a color map. Also ability to change this color from UI is available.
Resolve #1480, resolve #1572, closes #842
How has this been tested?
Manually
Checklist
develop
branch- [ ] I have updated the documentation accordingly- [ ] I have added tests to cover my changescvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.