Skip to content

Commit

Permalink
Chipping: Try hard to return a window, but fail gracefully if not (#1898
Browse files Browse the repository at this point in the history
)
  • Loading branch information
James McClain committed Sep 5, 2023
1 parent 14d21e9 commit 5056806
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ def chip(self, split_ind: int = 0, num_splits: int = 1):

def chip_scene(scene, split):
windows = self.get_train_windows(scene)
if len(windows) == 0:
log.warning(f'Scene {scene.id} produced no windows')
return
with tqdm(
windows,
desc=f'Making {split} chips from scene {scene.id}',
Expand Down Expand Up @@ -229,9 +232,9 @@ def build_scene(scene_id: str) -> Scene:
try:
evaluator.process(group_scenes, self.tmp_dir)
except FileNotFoundError:
log.warn(f'Skipping scene group "{group_name}". '
'Either labels or predictions are missing for '
'some scene.')
log.warning(f'Skipping scene group "{group_name}". '
'Either labels or predictions are missing for '
'some scene.')

def bundle(self):
"""Save a model bundle with whatever is needed to make predictions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ def should_use_window(window: Box) -> bool:
if len(windows) == 0:
windows = [a_window]
elif len(windows) == 0:
return [unfiltered_windows[0]]
if len(unfiltered_windows) > 0:
return [unfiltered_windows[0]]
else:
return []
elif co.window_method == SemanticSegmentationWindowMethod.random_sample:
windows = []
attempts = 0
Expand Down

0 comments on commit 5056806

Please sign in to comment.