supervisely 6.73.359__py3-none-any.whl → 6.73.360__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.
@@ -50,8 +50,9 @@ class ProjectThumbnail(Widget):
50
50
  self._description = f"{info.items_count} {info.type} in project"
51
51
  self._url = Project.get_url(info.id)
52
52
  self._image_preview_url = info.image_preview_url
53
- if is_development() or is_debug_with_sly_net():
54
- self._image_preview_url = abs_url(self._image_preview_url)
53
+ if self._image_preview_url is not None:
54
+ if is_development() or is_debug_with_sly_net():
55
+ self._image_preview_url = abs_url(self._image_preview_url)
55
56
 
56
57
  def set(self, info: ProjectInfo):
57
58
  self._set_info(info)
@@ -47,6 +47,17 @@ class RandomSplitsTable(Widget):
47
47
  def get_splits_counts(self) -> Dict[str, int]:
48
48
  return StateJson()[self.widget_id]["count"]
49
49
 
50
+ def set_items_count(self, items_count: int):
51
+ self._items_count = items_count
52
+ current_train_percent = self._percent["train"]
53
+ train_count = int(items_count * current_train_percent / 100)
54
+ self._count = {"total": items_count, "train": train_count, "val": items_count - train_count}
55
+
56
+ DataJson()[self.widget_id]["items_count"] = self._items_count
57
+ DataJson().send_changes()
58
+ StateJson()[self.widget_id]["count"] = self._count
59
+ StateJson().send_changes()
60
+
50
61
  def set_train_split_percent(self, percent: int):
51
62
  if 1 <= percent <= 99:
52
63
  self._percent["train"] = percent
@@ -60,7 +71,7 @@ class RandomSplitsTable(Widget):
60
71
  else:
61
72
  raise ValueError("percent must be in range [1; 99].")
62
73
 
63
- def get_train_split_percent(self) -> Dict[str, int]:
74
+ def get_train_split_percent(self) -> int:
64
75
  return StateJson()[self.widget_id]["percent"]["train"]
65
76
 
66
77
  def set_val_split_percent(self, percent: int):
@@ -75,5 +86,5 @@ class RandomSplitsTable(Widget):
75
86
  else:
76
87
  raise ValueError("percent must be in range [1; 99].")
77
88
 
78
- def get_val_split_percent(self) -> Dict[str, int]:
89
+ def get_val_split_percent(self) -> int:
79
90
  return StateJson()[self.widget_id]["percent"]["val"]
@@ -6,12 +6,12 @@
6
6
  </el-tag>
7
7
  </template>
8
8
  </el-table-column>
9
- <el-table-column label="Number of images" width="180">
9
+ <el-table-column label="Number of items" width="180">
10
10
  <template scope="scope">
11
11
  <span style="margin-left: 10px">{{state.{{{widget.widget_id}}}.count[scope.row.name]}}</span>
12
12
  </template>
13
13
  </el-table-column>
14
- <el-table-column label="Percent of images">
14
+ <el-table-column label="Percent of items">
15
15
  <template scope="scope">
16
16
  <div v-if="scope.row.name !== 'train'">
17
17
  <span style="margin-left: 10px">{{state.{{{widget.widget_id}}}.percent[scope.row.name]}}%</span>
@@ -28,6 +28,9 @@ class SelectAppSession(Widget):
28
28
  self._size = size
29
29
  self._operation = operation
30
30
 
31
+ if not isinstance(tags, list):
32
+ raise ValueError("Parameter tags must be a list of strings")
33
+
31
34
  if len(tags) < 1:
32
35
  raise ValueError("Parameter tags must be a list of strings, but got empty list")
33
36
 
@@ -80,7 +80,7 @@ class TrainValSplits(Widget):
80
80
  contents.append(self._get_random_content())
81
81
  if tags_splits:
82
82
  self._split_methods.append("Based on item tags")
83
- tabs_descriptions.append("Images should have assigned train or val tag")
83
+ tabs_descriptions.append(f"{self._project_type.capitalize()} should have assigned train or val tag")
84
84
  contents.append(self._get_tags_content())
85
85
  if datasets_splits:
86
86
  self._split_methods.append("Based on datasets")
@@ -128,26 +128,26 @@ class TrainValSplits(Widget):
128
128
  self._untagged_select = SelectString(
129
129
  values=["train", "val", "ignore"],
130
130
  labels=[
131
- "add untagged images to train set",
132
- "add untagged images to val set",
133
- "ignore untagged images",
131
+ f"add untagged {self._project_type} to train set",
132
+ f"add untagged {self._project_type} to val set",
133
+ f"ignore untagged {self._project_type}",
134
134
  ],
135
135
  placeholder="Select action",
136
136
  )
137
137
  train_field = Field(
138
138
  self._train_tag_select,
139
139
  title="Train tag",
140
- description="all images with this tag are considered as training set",
140
+ description=f"all {self._project_type} with this tag are considered as training set",
141
141
  )
142
142
  val_field = Field(
143
143
  self._val_tag_select,
144
144
  title="Validation tag",
145
- description="all images with this tag are considered as validation set",
145
+ description=f"all {self._project_type} with this tag are considered as validation set",
146
146
  )
147
147
  without_tags_field = Field(
148
148
  self._untagged_select,
149
- title="Images without selected tags",
150
- description="Choose what to do with untagged images",
149
+ title=f"{self._project_type.capitalize()} without selected tags",
150
+ description=f"Choose what to do with untagged {self._project_type}",
151
151
  )
152
152
  return Container(
153
153
  widgets=[
@@ -205,12 +205,12 @@ class TrainValSplits(Widget):
205
205
  train_field = Field(
206
206
  self._train_ds_select,
207
207
  title="Train dataset(s)",
208
- description="all images in selected dataset(s) are considered as training set",
208
+ description=f"all {self._project_type} in selected dataset(s) are considered as training set",
209
209
  )
210
210
  val_field = Field(
211
211
  self._val_ds_select,
212
212
  title="Validation dataset(s)",
213
- description="all images in selected dataset(s) are considered as validation set",
213
+ description=f"all {self._project_type} in selected dataset(s) are considered as validation set",
214
214
  )
215
215
  return Container(
216
216
  widgets=[notification_box, train_field, val_field], direction="vertical", gap=5
@@ -306,10 +306,10 @@ class TrainValSplits(Widget):
306
306
  else:
307
307
  raise ValueError("Split value must be 'train', 'training', 'val' or 'validation'")
308
308
 
309
- def get_train_split_percent(self) -> List[int]:
309
+ def get_train_split_percent(self) -> int:
310
310
  return self._random_splits_table.get_train_split_percent()
311
311
 
312
- def get_val_split_percent(self) -> List[int]:
312
+ def get_val_split_percent(self) -> int:
313
313
  return 100 - self._random_splits_table.get_train_split_percent()
314
314
 
315
315
  def set_tags_splits(
@@ -342,24 +342,36 @@ class TrainValSplits(Widget):
342
342
 
343
343
  def disable(self):
344
344
  self._content.disable()
345
- self._random_splits_table.disable()
346
- self._train_tag_select.disable()
347
- self._val_tag_select.disable()
348
- self._untagged_select.disable()
349
- self._train_ds_select.disable()
350
- self._val_ds_select.disable()
345
+ if self._random_splits_table is not None:
346
+ self._random_splits_table.disable()
347
+ if self._train_tag_select is not None:
348
+ self._train_tag_select.disable()
349
+ if self._val_tag_select is not None:
350
+ self._val_tag_select.disable()
351
+ if self._untagged_select is not None:
352
+ self._untagged_select.disable()
353
+ if self._train_ds_select is not None:
354
+ self._train_ds_select.disable()
355
+ if self._val_ds_select is not None:
356
+ self._val_ds_select.disable()
351
357
  self._disabled = True
352
358
  DataJson()[self.widget_id]["disabled"] = self._disabled
353
359
  DataJson().send_changes()
354
360
 
355
361
  def enable(self):
356
362
  self._content.enable()
357
- self._random_splits_table.enable()
358
- self._train_tag_select.enable()
359
- self._val_tag_select.enable()
360
- self._untagged_select.enable()
361
- self._train_ds_select.enable()
362
- self._val_ds_select.enable()
363
+ if self._random_splits_table is not None:
364
+ self._random_splits_table.enable()
365
+ if self._train_tag_select is not None:
366
+ self._train_tag_select.enable()
367
+ if self._val_tag_select is not None:
368
+ self._val_tag_select.enable()
369
+ if self._untagged_select is not None:
370
+ self._untagged_select.enable()
371
+ if self._train_ds_select is not None:
372
+ self._train_ds_select.enable()
373
+ if self._val_ds_select is not None:
374
+ self._val_ds_select.enable()
363
375
  self._disabled = False
364
376
  DataJson()[self.widget_id]["disabled"] = self._disabled
365
377
  DataJson().send_changes()