generated from supervisely-ecosystem/ecosystem-app-template-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f771e1
commit 455c588
Showing
5 changed files
with
131 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import src.globals as g | ||
import supervisely as sly | ||
from supervisely.nn.inference import Session | ||
|
||
geometry_to_task_type = { | ||
"object detection": [sly.Rectangle], | ||
"instance segmentation": [sly.Bitmap, sly.Polygon, sly.AlphaMask], | ||
# "semantic segmentation": [sly.Bitmap, sly.Polygon, sly.AlphaMask], | ||
} | ||
|
||
|
||
def get_project_classes(): | ||
meta = sly.ProjectMeta.from_json(g.api.project.get_meta(g.project_id)) | ||
return meta.obj_classes | ||
|
||
|
||
def get_model_info(): | ||
session = Session(g.api, g.session_id) | ||
model_meta = session.get_model_meta() | ||
session_info = session.get_session_info() | ||
return model_meta.obj_classes, session_info["task type"] | ||
|
||
|
||
def get_classes(): | ||
project_classes = get_project_classes() | ||
model_classes, task_type = get_model_info() | ||
if task_type not in geometry_to_task_type: | ||
raise ValueError(f"Task type {task_type} is not supported yet") | ||
filtered_classes = [] | ||
for obj_class in project_classes: | ||
if model_classes.has_key(obj_class.name): | ||
if obj_class.geometry_type in geometry_to_task_type[task_type]: | ||
filtered_classes.append(obj_class) | ||
|
||
return filtered_classes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div id="embeddings-calculator"> | ||
<sly-field title="Select Served session" description="select "> | ||
<sly-select-app-session :group-id="context.teamId" | ||
:app-session-id.sync="state.sessionId" | ||
:options="state.sessionOptions"> | ||
</sly-select-app-session> | ||
</sly-field> | ||
</div> |