supervisely 6.73.357__py3-none-any.whl → 6.73.359__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 (44) hide show
  1. supervisely/_utils.py +12 -0
  2. supervisely/api/annotation_api.py +3 -0
  3. supervisely/api/api.py +2 -2
  4. supervisely/api/app_api.py +27 -2
  5. supervisely/api/entity_annotation/tag_api.py +0 -1
  6. supervisely/api/nn/__init__.py +0 -0
  7. supervisely/api/nn/deploy_api.py +821 -0
  8. supervisely/api/nn/neural_network_api.py +248 -0
  9. supervisely/api/task_api.py +26 -467
  10. supervisely/app/fastapi/subapp.py +1 -0
  11. supervisely/nn/__init__.py +2 -1
  12. supervisely/nn/artifacts/artifacts.py +5 -5
  13. supervisely/nn/benchmark/object_detection/metric_provider.py +3 -0
  14. supervisely/nn/experiments.py +28 -5
  15. supervisely/nn/inference/cache.py +178 -114
  16. supervisely/nn/inference/gui/gui.py +18 -35
  17. supervisely/nn/inference/gui/serving_gui.py +3 -1
  18. supervisely/nn/inference/inference.py +1421 -1265
  19. supervisely/nn/inference/inference_request.py +412 -0
  20. supervisely/nn/inference/object_detection_3d/object_detection_3d.py +31 -24
  21. supervisely/nn/inference/session.py +2 -2
  22. supervisely/nn/inference/tracking/base_tracking.py +45 -79
  23. supervisely/nn/inference/tracking/bbox_tracking.py +220 -155
  24. supervisely/nn/inference/tracking/mask_tracking.py +274 -250
  25. supervisely/nn/inference/tracking/tracker_interface.py +23 -0
  26. supervisely/nn/inference/uploader.py +164 -0
  27. supervisely/nn/model/__init__.py +0 -0
  28. supervisely/nn/model/model_api.py +259 -0
  29. supervisely/nn/model/prediction.py +311 -0
  30. supervisely/nn/model/prediction_session.py +632 -0
  31. supervisely/nn/tracking/__init__.py +1 -0
  32. supervisely/nn/tracking/boxmot.py +114 -0
  33. supervisely/nn/tracking/tracking.py +24 -0
  34. supervisely/nn/training/train_app.py +61 -19
  35. supervisely/nn/utils.py +43 -3
  36. supervisely/task/progress.py +12 -2
  37. supervisely/video/video.py +107 -1
  38. {supervisely-6.73.357.dist-info → supervisely-6.73.359.dist-info}/METADATA +2 -1
  39. {supervisely-6.73.357.dist-info → supervisely-6.73.359.dist-info}/RECORD +43 -32
  40. supervisely/api/neural_network_api.py +0 -202
  41. {supervisely-6.73.357.dist-info → supervisely-6.73.359.dist-info}/LICENSE +0 -0
  42. {supervisely-6.73.357.dist-info → supervisely-6.73.359.dist-info}/WHEEL +0 -0
  43. {supervisely-6.73.357.dist-info → supervisely-6.73.359.dist-info}/entry_points.txt +0 -0
  44. {supervisely-6.73.357.dist-info → supervisely-6.73.359.dist-info}/top_level.txt +0 -0
supervisely/_utils.py CHANGED
@@ -4,6 +4,7 @@ import asyncio
4
4
  import base64
5
5
  import copy
6
6
  import hashlib
7
+ import inspect
7
8
  import json
8
9
  import os
9
10
  import random
@@ -533,6 +534,17 @@ def get_filename_from_headers(url):
533
534
  return None
534
535
 
535
536
 
537
+ def get_valid_kwargs(kwargs, func, exclude=None):
538
+ signature = inspect.signature(func)
539
+ valid_kwargs = {}
540
+ for key, value in kwargs.items():
541
+ if exclude is not None and key in exclude:
542
+ continue
543
+ if key in signature.parameters:
544
+ valid_kwargs[key] = value
545
+ return valid_kwargs
546
+
547
+
536
548
  def removesuffix(string, suffix):
537
549
  """
538
550
  Returns the string without the specified suffix if the string ends with that suffix.
@@ -46,6 +46,7 @@ class AnnotationInfo(NamedTuple):
46
46
  annotation: dict
47
47
  created_at: str
48
48
  updated_at: str
49
+ dataset_id: int = None
49
50
 
50
51
  def to_json(self) -> Dict[str, Any]:
51
52
  """
@@ -60,6 +61,7 @@ class AnnotationInfo(NamedTuple):
60
61
  ApiField.ANNOTATION: self.annotation,
61
62
  ApiField.CREATED_AT: self.created_at,
62
63
  ApiField.UPDATED_AT: self.updated_at,
64
+ ApiField.DATASET_ID: self.dataset_id,
63
65
  }
64
66
 
65
67
 
@@ -112,6 +114,7 @@ class AnnotationApi(ModuleApi):
112
114
  ApiField.ANNOTATION,
113
115
  ApiField.CREATED_AT,
114
116
  ApiField.UPDATED_AT,
117
+ ApiField.DATASET_ID,
115
118
  ]
116
119
 
117
120
  @staticmethod
supervisely/api/api.py CHANGED
@@ -45,9 +45,9 @@ import supervisely.api.image_api as image_api
45
45
  import supervisely.api.import_storage_api as import_stoarge_api
46
46
  import supervisely.api.issues_api as issues_api
47
47
  import supervisely.api.labeling_job_api as labeling_job_api
48
+ import supervisely.api.nn.neural_network_api as neural_network_api
48
49
  import supervisely.api.labeling_queue_api as labeling_queue_api
49
50
  import supervisely.api.entities_collection_api as entities_collection_api
50
- import supervisely.api.neural_network_api as neural_network_api
51
51
  import supervisely.api.object_class_api as object_class_api
52
52
  import supervisely.api.plugin_api as plugin_api
53
53
  import supervisely.api.pointcloud.pointcloud_api as pointcloud_api
@@ -345,7 +345,7 @@ class Api:
345
345
  self.team = team_api.TeamApi(self)
346
346
  self.workspace = workspace_api.WorkspaceApi(self)
347
347
  self.project = project_api.ProjectApi(self)
348
- self.model = neural_network_api.NeuralNetworkApi(self)
348
+ self.nn = neural_network_api.NeuralNetworkApi(self)
349
349
  self.task = task_api.TaskApi(self)
350
350
  self.dataset = dataset_api.DatasetApi(self)
351
351
  self.image = image_api.ImageApi(self)
@@ -7,6 +7,8 @@ from dataclasses import dataclass
7
7
  from time import sleep
8
8
  from typing import Any, Dict, List, NamedTuple, Optional, Union
9
9
 
10
+ from typing_extensions import Literal
11
+
10
12
  from supervisely._utils import is_community, is_development, take_with_default
11
13
  from supervisely.api.module_api import ApiField
12
14
  from supervisely.api.task_api import TaskApi
@@ -1532,10 +1534,21 @@ class AppApi(TaskApi):
1532
1534
  )
1533
1535
  return modules[0]["id"]
1534
1536
 
1535
- def get_list_ecosystem_modules(self):
1537
+ def get_list_ecosystem_modules(
1538
+ self,
1539
+ search: Optional[str] = None,
1540
+ categories: Optional[List[str]] = None,
1541
+ categories_operation: Literal["or", "and"] = "or",
1542
+ ):
1543
+ data = {}
1544
+ if search is not None:
1545
+ data["search"] = search
1546
+ if categories is not None:
1547
+ data["categories"] = categories
1548
+ data["categoriesOperation"] = categories_operation
1536
1549
  modules = self.get_list_all_pages(
1537
1550
  method="ecosystem.list",
1538
- data={},
1551
+ data=data,
1539
1552
  convert_json_info_cb=lambda x: x,
1540
1553
  )
1541
1554
  if len(modules) == 0:
@@ -1771,8 +1784,20 @@ class AppApi(TaskApi):
1771
1784
  else:
1772
1785
  is_ready = True
1773
1786
  break
1787
+ if is_ready:
1788
+ logger.info("App is ready for API calls")
1789
+ else:
1790
+ logger.info("App is not ready for API calls after all attempts")
1774
1791
  return is_ready
1775
1792
 
1793
+ def find_module_id_by_app_name(self, app_name):
1794
+ modules = self._api.app.get_list_ecosystem_modules(search=app_name)
1795
+ if len(modules) == 0:
1796
+ raise ValueError(f"No serving apps found for app name {app_name}")
1797
+ if len(modules) > 1:
1798
+ raise ValueError(f"Multiple serving apps found for app name {app_name}")
1799
+ return modules[0]["id"]
1800
+
1776
1801
 
1777
1802
  # info about app in team
1778
1803
  # {
@@ -7,7 +7,6 @@ from supervisely.api.module_api import ApiField, ModuleApi
7
7
  from supervisely.collection.key_indexed_collection import KeyIndexedCollection
8
8
  from supervisely.task.progress import tqdm_sly
9
9
  from supervisely.video_annotation.key_id_map import KeyIdMap
10
- from supervisely.task.progress import tqdm_sly
11
10
 
12
11
 
13
12
  class TagApi(ModuleApi):
File without changes