Skip to content

Commit

Permalink
Replace only labels mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatkot committed Aug 13, 2024
1 parent 6fa0260 commit a64a3d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions annotation-tool/src/gui.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
<el-select v-model="state.addMode" size="mini">
<el-option key="merge" label="merge" value="merge"></el-option>
<el-option key="replace" label="replace" value="replace"></el-option>
<el-option key="replace only labels" label="replace only labels" value="replace only labels"></el-option>
</el-select>
</div>

Expand Down
9 changes: 6 additions & 3 deletions annotation-tool/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
import pathlib
import sys
from collections import defaultdict
from requests.exceptions import HTTPError


import supervisely as sly
import yaml
from requests.exceptions import HTTPError
from supervisely.imaging.color import generate_rgb, random_rgb

root_source_path = str(pathlib.Path(sys.argv[0]).parents[2])
Expand Down Expand Up @@ -446,8 +445,12 @@ def inference(api: sly.Api, task_id, context, state, app_logger):

if state["addMode"] == "merge":
res_ann = ann.merge(res_ann)
else:
elif state["addMode"] == "replace":
pass # replace (data prepared, nothing to do)
elif state["addMode"] == "replace only labels":
# We need to retrieve image tags from the original annotation
# and merge it with the new annotation from the model.
res_ann = res_ann.add_tags(ann.img_tags)

if "task type" in session_info.keys() and (
not (
Expand Down

0 comments on commit a64a3d1

Please sign in to comment.