supervisely 6.73.456__py3-none-any.whl → 6.73.458__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. supervisely/__init__.py +24 -1
  2. supervisely/api/image_api.py +4 -0
  3. supervisely/api/video/video_annotation_api.py +4 -2
  4. supervisely/api/video/video_api.py +41 -1
  5. supervisely/app/v1/app_service.py +18 -2
  6. supervisely/app/v1/constants.py +7 -1
  7. supervisely/app/widgets/card/card.py +20 -0
  8. supervisely/app/widgets/deploy_model/deploy_model.py +56 -35
  9. supervisely/app/widgets/experiment_selector/experiment_selector.py +8 -0
  10. supervisely/app/widgets/fast_table/fast_table.py +45 -11
  11. supervisely/app/widgets/fast_table/template.html +1 -1
  12. supervisely/app/widgets/radio_tabs/radio_tabs.py +18 -2
  13. supervisely/app/widgets/radio_tabs/template.html +1 -0
  14. supervisely/app/widgets/select_dataset_tree/select_dataset_tree.py +63 -7
  15. supervisely/app/widgets/tree_select/tree_select.py +2 -0
  16. supervisely/nn/inference/cache.py +2 -2
  17. supervisely/nn/inference/inference.py +364 -73
  18. supervisely/nn/inference/inference_request.py +3 -2
  19. supervisely/nn/inference/predict_app/gui/classes_selector.py +81 -12
  20. supervisely/nn/inference/predict_app/gui/gui.py +676 -488
  21. supervisely/nn/inference/predict_app/gui/input_selector.py +178 -25
  22. supervisely/nn/inference/predict_app/gui/model_selector.py +2 -4
  23. supervisely/nn/inference/predict_app/gui/output_selector.py +46 -6
  24. supervisely/nn/inference/predict_app/gui/settings_selector.py +756 -59
  25. supervisely/nn/inference/predict_app/gui/tags_selector.py +1 -1
  26. supervisely/nn/inference/predict_app/gui/utils.py +236 -119
  27. supervisely/nn/inference/predict_app/predict_app.py +2 -2
  28. supervisely/nn/model/model_api.py +9 -0
  29. supervisely/nn/tracker/base_tracker.py +11 -1
  30. supervisely/nn/tracker/botsort/botsort_config.yaml +0 -1
  31. supervisely/nn/tracker/botsort_tracker.py +14 -7
  32. supervisely/nn/tracker/visualize.py +70 -72
  33. supervisely/video/video.py +15 -1
  34. supervisely/worker_api/agent_rpc.py +24 -1
  35. supervisely/worker_api/rpc_servicer.py +31 -7
  36. {supervisely-6.73.456.dist-info → supervisely-6.73.458.dist-info}/METADATA +3 -2
  37. {supervisely-6.73.456.dist-info → supervisely-6.73.458.dist-info}/RECORD +41 -41
  38. {supervisely-6.73.456.dist-info → supervisely-6.73.458.dist-info}/LICENSE +0 -0
  39. {supervisely-6.73.456.dist-info → supervisely-6.73.458.dist-info}/WHEEL +0 -0
  40. {supervisely-6.73.456.dist-info → supervisely-6.73.458.dist-info}/entry_points.txt +0 -0
  41. {supervisely-6.73.456.dist-info → supervisely-6.73.458.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,48 @@
1
- from typing import Dict, Any
2
- from supervisely.app.widgets import Button, Card, ClassesTable, Container, Text
3
-
4
-
1
+ from typing import Any, Dict
2
+
3
+ import pandas as pd
4
+
5
+ from supervisely.app.widgets import (
6
+ Button,
7
+ Card,
8
+ ClassesTable,
9
+ Container,
10
+ FastTable,
11
+ Text,
12
+ )
13
+ from supervisely.geometry.any_geometry import AnyGeometry
14
+ from supervisely.geometry.bitmap import Bitmap
15
+ from supervisely.geometry.cuboid import Cuboid
16
+ from supervisely.geometry.cuboid_3d import Cuboid3d
17
+ from supervisely.geometry.geometry import Geometry
18
+ from supervisely.geometry.graph import GraphNodes
19
+ from supervisely.geometry.multichannel_bitmap import MultichannelBitmap
20
+ from supervisely.geometry.point import Point
21
+ from supervisely.geometry.point_3d import Point3d
22
+ from supervisely.geometry.pointcloud import Pointcloud
23
+ from supervisely.geometry.polygon import Polygon
24
+ from supervisely.geometry.polyline import Polyline
25
+ from supervisely.geometry.rectangle import Rectangle
26
+ from supervisely.project.project_meta import ProjectMeta
27
+
28
+ type_to_zmdi_icon = {
29
+ AnyGeometry: "zmdi zmdi-shape",
30
+ Rectangle: "zmdi zmdi-crop-din", # "zmdi zmdi-square-o"
31
+ # sly.Polygon: "icons8-polygon", # "zmdi zmdi-edit"
32
+ Polygon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAB6klEQVRYhe2Wuy8EURTGf+u5VESNXq2yhYZCoeBv8RcI1i6NVUpsoVCKkHjUGlFTiYb1mFmh2MiKjVXMudmb3cPOzB0VXzKZm5k53/nmvO6Ff4RHD5AD7gFP1l3Kd11AHvCBEpAVW2esAvWmK6t8l1O+W0lCQEnIJoAZxUnzNQNkZF36jrQjgoA+uaciCgc9VaExBOyh/6WWAi1VhbjOJ4FbIXkBtgkK0BNHnYqNKUIPeBPbKyDdzpld5T6wD9SE4AwYjfEDaXFeFzE/doUWuhqwiFsOCwqv2hV2lU/L+sHBscGTxdvSFVoXpAjCZdauMHVic6ndl6U1VBsJCFhTeNUU9IiIEo3qvQYGHAV0AyfC5wNLhKipXuBCjA5wT8WxcM1FMRoBymK44CjAE57hqIazwCfwQdARcXa3UXHuRXVucIjb7jYvNkdxBZg0TBFid7PQTRAtX2xOiXkuMAMqYwkIE848rZFbjyNAmw9bIeweaZ2A5TgC7PnwKkTPtN+cTOrsyN3FEWAjRTAX6sA5ek77gSL6+WHZVQDAIHAjhJtN78aAS3lXAXYIivBOnCdyOAUYB6o0xqsvziry7FLE/Cp20cNcJEjDr8MUmVOVRzkVN+Nd7vZGVXXgiwxtPiRS5WFhz4fEq/zv4AvToMn7vCn3eAAAAABJRU5ErkJggg==",
33
+ Bitmap: "zmdi zmdi-brush",
34
+ Polyline: "zmdi zmdi-gesture",
35
+ Point: "zmdi zmdi-dot-circle-alt",
36
+ Cuboid: "zmdi zmdi-ungroup", #
37
+ GraphNodes: "zmdi zmdi-grain",
38
+ Cuboid3d: "zmdi zmdi-codepen",
39
+ Pointcloud: "zmdi zmdi-cloud-outline", # "zmdi zmdi-border-clear"
40
+ MultichannelBitmap: "zmdi zmdi-layers", # "zmdi zmdi-collection-item"
41
+ Point3d: "zmdi zmdi-filter-center-focus", # "zmdi zmdi-select-all"
42
+ }
5
43
  class ClassesSelector:
6
- title = "Classes Selector"
7
- description = "Select classes that will be used for inference"
44
+ title = "Classes"
45
+ description = "Select classes that will be used for inference. This classes are defined by the deployed model"
8
46
  lock_message = "Select previous step to unlock"
9
47
 
10
48
  def __init__(self):
@@ -24,7 +62,9 @@ class ClassesSelector:
24
62
  # -------------------------------- #
25
63
 
26
64
  # Classes
27
- self.classes_table = ClassesTable()
65
+ columns = ["class", "shape"]
66
+ self.classes_table = FastTable(columns=columns, page_size=100, is_selectable=True)
67
+ # self.classes_table = ClassesTable()
28
68
  self.classes_table.hide()
29
69
  # Add widgets to display ------------ #
30
70
  self.display_widgets.extend([self.classes_table])
@@ -45,25 +85,36 @@ class ClassesSelector:
45
85
  content=self.container,
46
86
  lock_message=self.lock_message,
47
87
  )
48
- self.card.lock()
49
88
  # -------------------------------- #
50
89
 
90
+ def lock(self):
91
+ self.card.lock()
92
+ self.classes_table.hide()
93
+ self.validator_text.hide()
94
+
95
+ def unlock(self):
96
+ self.card.unlock()
97
+ self.classes_table.show()
98
+
51
99
  @property
52
100
  def widgets_to_disable(self) -> list:
53
101
  return [self.classes_table]
54
102
 
103
+ def set_project_meta(self, project_meta) -> None:
104
+ self._update_meta(project_meta)
105
+
55
106
  def load_from_json(self, data: Dict[str, Any]) -> None:
56
107
  if "classes" in data:
57
108
  self.set_classes(data["classes"])
58
109
 
59
110
  def get_selected_classes(self) -> list:
60
- return self.classes_table.get_selected_classes()
111
+ return [row.row[0] for row in self.classes_table.get_selected_rows()]
61
112
 
62
113
  def set_classes(self, classes) -> None:
63
- self.classes_table.select_classes(classes)
114
+ self.classes_table.select_rows_by_value("class", classes)
64
115
 
65
116
  def select_all_classes(self) -> None:
66
- self.classes_table.select_all()
117
+ self.classes_table.select_rows(list(range(len(self.classes_table._rows_total))))
67
118
 
68
119
  def get_settings(self) -> Dict[str, Any]:
69
120
  return {"classes": self.get_selected_classes()}
@@ -73,7 +124,7 @@ class ClassesSelector:
73
124
  return True
74
125
 
75
126
  self.validator_text.hide()
76
- selected_classes = self.classes_table.get_selected_classes()
127
+ selected_classes = self.get_selected_classes()
77
128
  n_classes = len(selected_classes)
78
129
 
79
130
  if n_classes == 0:
@@ -89,3 +140,21 @@ class ClassesSelector:
89
140
  self.validator_text.set(text=". ".join(message_parts), status=status)
90
141
  self.validator_text.show()
91
142
  return is_valid
143
+
144
+ def _update_meta(self, project_meta: ProjectMeta) -> None:
145
+ table_data = []
146
+ for obj_class in project_meta.obj_classes:
147
+ table_line = []
148
+ name = obj_class.name
149
+ icon = type_to_zmdi_icon[AnyGeometry]
150
+ icon = type_to_zmdi_icon.get(obj_class.geometry_type, icon)
151
+ shape = obj_class.geometry_type.geometry_name().lower()
152
+ if shape == "graph":
153
+ shape = "graph (keypoints)"
154
+ table_line = [name, shape]
155
+ table_data.append(table_line)
156
+ self._table_data = table_data
157
+ if self._table_data:
158
+ self.classes_table.read_pandas(pd.DataFrame(self._table_data))
159
+ else:
160
+ self.classes_table.clear()