supervisely 6.73.250__py3-none-any.whl → 6.73.252__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.

Potentially problematic release.


This version of supervisely might be problematic. Click here for more details.

Files changed (35) hide show
  1. supervisely/api/dataset_api.py +17 -1
  2. supervisely/api/project_api.py +4 -1
  3. supervisely/api/volume/volume_annotation_api.py +7 -4
  4. supervisely/app/widgets/experiment_selector/experiment_selector.py +16 -8
  5. supervisely/nn/benchmark/base_benchmark.py +17 -2
  6. supervisely/nn/benchmark/base_evaluator.py +28 -6
  7. supervisely/nn/benchmark/instance_segmentation/benchmark.py +1 -1
  8. supervisely/nn/benchmark/instance_segmentation/evaluator.py +14 -0
  9. supervisely/nn/benchmark/object_detection/benchmark.py +1 -1
  10. supervisely/nn/benchmark/object_detection/evaluator.py +43 -13
  11. supervisely/nn/benchmark/object_detection/metric_provider.py +7 -0
  12. supervisely/nn/benchmark/semantic_segmentation/evaluator.py +33 -7
  13. supervisely/nn/benchmark/utils/detection/utlis.py +6 -4
  14. supervisely/nn/experiments.py +23 -16
  15. supervisely/nn/inference/gui/serving_gui_template.py +2 -35
  16. supervisely/nn/inference/inference.py +71 -8
  17. supervisely/nn/training/__init__.py +2 -0
  18. supervisely/nn/training/gui/classes_selector.py +14 -14
  19. supervisely/nn/training/gui/gui.py +28 -13
  20. supervisely/nn/training/gui/hyperparameters_selector.py +90 -41
  21. supervisely/nn/training/gui/input_selector.py +8 -6
  22. supervisely/nn/training/gui/model_selector.py +7 -5
  23. supervisely/nn/training/gui/train_val_splits_selector.py +8 -9
  24. supervisely/nn/training/gui/training_logs.py +17 -17
  25. supervisely/nn/training/gui/training_process.py +41 -36
  26. supervisely/nn/training/loggers/__init__.py +22 -0
  27. supervisely/nn/training/loggers/base_train_logger.py +8 -5
  28. supervisely/nn/training/loggers/tensorboard_logger.py +4 -11
  29. supervisely/nn/training/train_app.py +276 -90
  30. {supervisely-6.73.250.dist-info → supervisely-6.73.252.dist-info}/METADATA +8 -3
  31. {supervisely-6.73.250.dist-info → supervisely-6.73.252.dist-info}/RECORD +35 -35
  32. {supervisely-6.73.250.dist-info → supervisely-6.73.252.dist-info}/LICENSE +0 -0
  33. {supervisely-6.73.250.dist-info → supervisely-6.73.252.dist-info}/WHEEL +0 -0
  34. {supervisely-6.73.250.dist-info → supervisely-6.73.252.dist-info}/entry_points.txt +0 -0
  35. {supervisely-6.73.250.dist-info → supervisely-6.73.252.dist-info}/top_level.txt +0 -0
@@ -22,34 +22,36 @@ class TrainingProcess:
22
22
  lock_message = "Select hyperparametrs to unlock"
23
23
 
24
24
  def __init__(self, app_options: Dict[str, Any]):
25
- self.app_options = app_options
26
- self.experiment_name_input = Input("Enter experiment name")
27
- self.experiment_name_field = Field(
28
- title="Experiment name",
29
- description="Experiment name will be saved to experiment_info.json",
30
- content=self.experiment_name_input,
31
- )
32
-
25
+ self.display_widgets = []
33
26
  self.success_message_text = (
34
27
  "Training completed. Training artifacts were uploaded to Team Files. "
35
28
  "You can find and open tensorboard logs in the artifacts folder via the "
36
29
  "<a href='https://ecosystem.supervisely.com/apps/tensorboard-logs-viewer' target='_blank'>Tensorboard</a> app."
37
30
  )
38
- self.success_message = DoneLabel(text=self.success_message_text)
39
- self.success_message.hide()
31
+ self.app_options = app_options
40
32
 
41
- self.artifacts_thumbnail = FolderThumbnail()
42
- self.artifacts_thumbnail.hide()
33
+ # GUI Components
34
+ # Optional Select CUDA device
35
+ if self.app_options.get("device_selector", False):
36
+ self.select_device = SelectCudaDevice()
37
+ self.select_cuda_device_field = Field(
38
+ title="Select CUDA device",
39
+ description="The device on which the model will be trained",
40
+ content=self.select_device,
41
+ )
42
+ self.display_widgets.extend([self.select_cuda_device_field])
43
+ # -------------------------------- #
43
44
 
44
- self.model_benchmark_report_thumbnail = ReportThumbnail()
45
- self.model_benchmark_report_thumbnail.hide()
45
+ self.experiment_name_input = Input("Enter experiment name")
46
+ self.experiment_name_field = Field(
47
+ title="Experiment name",
48
+ description="Experiment name will be saved to experiment_info.json",
49
+ content=self.experiment_name_input,
50
+ )
46
51
 
47
- self.validator_text = Text("")
48
- self.validator_text.hide()
49
52
  self.start_button = Button("Start")
50
53
  self.stop_button = Button("Stop", button_type="danger")
51
54
  self.stop_button.hide() # @TODO: implement stop and hide stop button until training starts
52
-
53
55
  button_container = Container(
54
56
  [self.start_button, self.stop_button, Empty()],
55
57
  "horizontal",
@@ -58,29 +60,34 @@ class TrainingProcess:
58
60
  gap=1,
59
61
  )
60
62
 
61
- container_widgets = [
62
- self.experiment_name_field,
63
- button_container,
64
- self.validator_text,
65
- self.artifacts_thumbnail,
66
- self.model_benchmark_report_thumbnail,
67
- ]
63
+ self.validator_text = Text("")
64
+ self.validator_text.hide()
68
65
 
69
- if self.app_options.get("device_selector", False):
70
- self.select_device = SelectCudaDevice()
71
- self.select_cuda_device_field = Field(
72
- title="Select CUDA device",
73
- description="The device on which the model will be trained",
74
- content=self.select_device,
75
- )
76
- container_widgets.insert(1, self.select_cuda_device_field)
66
+ self.artifacts_thumbnail = FolderThumbnail()
67
+ self.artifacts_thumbnail.hide()
77
68
 
78
- container = Container(container_widgets)
69
+ self.display_widgets.extend(
70
+ [
71
+ self.experiment_name_field,
72
+ button_container,
73
+ self.validator_text,
74
+ self.artifacts_thumbnail,
75
+ ]
76
+ )
77
+ # -------------------------------- #
79
78
 
79
+ # Optional Model Benchmark
80
+ if app_options.get("model_benchmark", False):
81
+ self.model_benchmark_report_thumbnail = ReportThumbnail()
82
+ self.model_benchmark_report_thumbnail.hide()
83
+ self.display_widgets.extend([self.model_benchmark_report_thumbnail])
84
+ # -------------------------------- #
85
+
86
+ self.container = Container(self.display_widgets)
80
87
  self.card = Card(
81
88
  title=self.title,
82
89
  description=self.description,
83
- content=container,
90
+ content=self.container,
84
91
  lock_message=self.lock_message,
85
92
  )
86
93
  self.card.lock()
@@ -92,8 +99,6 @@ class TrainingProcess:
92
99
  widgets.append(self.experiment_name_input)
93
100
  return widgets
94
101
 
95
- return []
96
-
97
102
  def validate_step(self) -> bool:
98
103
  return True
99
104
 
@@ -0,0 +1,22 @@
1
+ from supervisely.nn.training.loggers.base_train_logger import BaseTrainLogger
2
+ from supervisely.nn.training.loggers.tensorboard_logger import (
3
+ TensorboardLogger,
4
+ tensorboard_installed,
5
+ )
6
+
7
+ train_logger = BaseTrainLogger()
8
+
9
+
10
+ def setup_train_logger(name="tensorboard_logger"):
11
+ global train_logger
12
+ if name == "tensorboard_logger":
13
+ if tensorboard_installed:
14
+ if not isinstance(train_logger, TensorboardLogger):
15
+ train_logger = TensorboardLogger()
16
+ else:
17
+ raise ImportError("TensorboardX is not installed")
18
+ elif name == "default_logger":
19
+ if not isinstance(train_logger, BaseTrainLogger):
20
+ train_logger = BaseTrainLogger()
21
+ else:
22
+ raise ValueError(f"Logger {name} is not supported")
@@ -7,7 +7,7 @@ class BaseTrainLogger:
7
7
  self._on_train_finished_callbacks = []
8
8
  self._on_epoch_started_callbacks = []
9
9
  self._on_epoch_finished_callbacks = []
10
- self._on_step_callbacks = []
10
+ self._on_step_finished_callbacks = []
11
11
  self.epoch_idx = 0
12
12
  self.step_idx = 0
13
13
 
@@ -28,9 +28,9 @@ class BaseTrainLogger:
28
28
  for callback in self._on_epoch_finished_callbacks:
29
29
  callback()
30
30
 
31
- def on_step_end(self):
31
+ def step_finished(self):
32
32
  self.step_idx += 1
33
- for callback in self._on_step_callbacks:
33
+ for callback in self._on_step_finished_callbacks:
34
34
  callback()
35
35
 
36
36
  def add_on_train_started_callback(self, callback: Callable):
@@ -45,8 +45,8 @@ class BaseTrainLogger:
45
45
  def add_on_epoch_finish_callback(self, callback: Callable):
46
46
  self._on_epoch_finished_callbacks.append(callback)
47
47
 
48
- def add_on_step_callback(self, callback: Callable):
49
- self._on_step_callbacks.append(callback)
48
+ def add_on_step_finished_callback(self, callback: Callable):
49
+ self._on_step_finished_callbacks.append(callback)
50
50
 
51
51
  def log(self, logs: dict, idx: int):
52
52
  raise NotImplementedError
@@ -56,3 +56,6 @@ class BaseTrainLogger:
56
56
 
57
57
  def log_epoch(self, logs: dict):
58
58
  raise NotImplementedError
59
+
60
+ def close(self):
61
+ pass
@@ -1,13 +1,10 @@
1
- from supervisely import logger
2
-
1
+ from supervisely.nn.training.loggers.base_train_logger import BaseTrainLogger
2
+ tensorboard_installed = False
3
3
  try:
4
4
  from tensorboardX import SummaryWriter
5
- _tensorboard_supported = True
5
+ tensorboard_installed = True
6
6
  except ImportError:
7
- logger.warning("TensorboardX is not installed. TensorboardLogger will not work.")
8
- _tensorboard_supported = False
9
-
10
- from supervisely.nn.training.loggers.base_train_logger import BaseTrainLogger
7
+ pass
11
8
 
12
9
 
13
10
  class TensorboardLogger(BaseTrainLogger):
@@ -40,7 +37,3 @@ class TensorboardLogger(BaseTrainLogger):
40
37
 
41
38
  def log_epoch(self, logs: dict):
42
39
  self.log(logs, self.epoch_idx)
43
-
44
-
45
- if _tensorboard_supported:
46
- tb_logger = TensorboardLogger()