Skip to content

Commit

Permalink
add preview mode handler
Browse files Browse the repository at this point in the history
  • Loading branch information
vorozhkog committed Sep 16, 2024
1 parent 3de559a commit f289a49
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
29 changes: 16 additions & 13 deletions src/compute/layers/processing/SplitDataLayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,19 @@ def _split_by_tags() -> List[Tuple[ImageDescriptor, Annotation]]:
items.append((new_label_item_desc, ann))
return items

item_desc, ann = data_el
item_idx = item_desc.get_item_idx()

split_func_map = {
"percent": _split_by_percent,
"number": _split_by_num,
"classes": _split_by_class,
"tags": _split_by_tags,
}
split_method = self.settings["split_method"]
func = split_func_map.get(split_method)
items = func()
yield from items
if self.net.preview_mode:
yield data_el
else:
item_desc, ann = data_el
item_idx = item_desc.get_item_idx()

split_func_map = {
"percent": _split_by_percent,
"number": _split_by_num,
"classes": _split_by_class,
"tags": _split_by_tags,
}
split_method = self.settings["split_method"]
func = split_func_map.get(split_method)
items = func()
yield from items
2 changes: 1 addition & 1 deletion src/compute/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def main(
raise e

total = net.get_total_elements()
net.total_element_cnt = total
net.total_elements_cnt = total
if total == 0:
raise GraphError(
"There are no elements to process. Make sure that you selected input project and it's not empty"
Expand Down

0 comments on commit f289a49

Please sign in to comment.