Skip to content

Commit

Permalink
add feature: instance label auto increment
Browse files Browse the repository at this point in the history
  • Loading branch information
aboudev authored and wkentaro committed Apr 9, 2019
1 parent dcfeb3e commit 0ec892a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions labelme/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,15 @@ def newShape(self):
if items:
text = items[0].text()
if self._config['display_label_popup'] or not text:
# instance label auto increment
if self._config['instance_label_auto_increment']:
previous_label = self.labelDialog.edit.text()
split = previous_label.split('-')
if len(split) > 1 and split[-1].isdigit():
split[-1] = str(int(split[-1]) + 1)
text = '-'.join(split)
text = self.labelDialog.popUp(text)

if text is not None and not self.validateLabel(text):
self.errorMessage('Invalid label',
"Invalid label '{}' with validation type '{}'"
Expand Down
1 change: 1 addition & 0 deletions labelme/config/default_config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
auto_save: false
display_label_popup: true
instance_label_auto_increment: true
store_data: true
keep_prev: false
logger_level: info
Expand Down

0 comments on commit 0ec892a

Please sign in to comment.