Skip to content

Commit

Permalink
log.warn -> log.warning (#1901)
Browse files Browse the repository at this point in the history
  • Loading branch information
James McClain committed Sep 6, 2023
1 parent 5056806 commit 6249e01
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ def get_scores(self) -> 'SemanticSegmentationSmoothLabels':
hits_uri_local = download_if_needed(self.hits_uri)
hits_arr = np.load(hits_uri_local)
except NotReadableError:
log.warn(f'Pixel hits array not found at {self.hits_uri}.'
'Setting all pixels hits to 1.')
log.warning(f'Pixel hits array not found at {self.hits_uri}.'
'Setting all pixels hits to 1.')
hits_arr = np.ones(extent.size, dtype=np.uint8)

score_arr = self.score_source.get_chip(extent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def __init__(self,

block_shapes = set(self.image_dataset.block_shapes)
if len(block_shapes) > 1:
log.warn('Raster bands have non-identical block shapes: '
f'{block_shapes}. This can slow down reading. '
'Consider re-tiling using GDAL.')
log.warning('Raster bands have non-identical block shapes: '
f'{block_shapes}. This can slow down reading. '
'Consider re-tiling using GDAL.')

self._crs_transformer = RasterioCRSTransformer.from_dataset(
self.image_dataset)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,5 @@ def sanitize_geojson(geojson: dict,
if to_map_coords:
geojson = pixel_to_map_coords(geojson, crs_transformer)
if not all_geoms_valid(geojson):
log.warn(f'Invalid geometries found in features in the GeoJSON.')
log.warning(f'Invalid geometries found in features in the GeoJSON.')
return geojson
7 changes: 4 additions & 3 deletions rastervision_core/rastervision/core/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ def __init__(self,
if scene_group is not None:
t.scene_group = scene_group
else:
log.warn(f'Using stats for scene group "{t.scene_group}". '
'To use a different scene group, specify '
'--scene-group <scene-group-name>.')
log.warning(
f'Using stats for scene group "{t.scene_group}". '
'To use a different scene group, specify '
'--scene-group <scene-group-name>.')
t.update_root(bundle_dir)

if self.update_stats:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def predict_scene(self, scene: 'Scene', backend: 'Backend') -> 'Labels':
if crop_sz == 'auto':
overlap_sz = chip_sz - stride
if overlap_sz % 2 == 1:
log.warn(
log.warning(
'Using crop_sz="auto" but overlap size (chip_sz minus '
'stride) is odd. This means that one pixel row/col will '
'still overlap after cropping.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __getitem__(self, key) -> Tuple[torch.Tensor, torch.Tensor]:
try:
x, y = self.transform(val)
except Exception as exc:
log.warn(
log.warning(
'Many albumentations transforms require uint8 input. Therefore, we '
'recommend passing a MinMaxTransformer or StatsTransformer to the '
'RasterSource so the input will be converted to uint8.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ def _sample_pos_window(self) -> Box:
if h >= box_h and w >= box_w:
window = bbox.make_random_box_container(h, w)
return window
log.warn('ObjectDetectionRandomWindowGeoDataset: Failed to find '
'suitable (h, w) for positive window. '
f'Using (hmax, wmax) = ({hmax}, {wmax}) instead.')
log.warning('ObjectDetectionRandomWindowGeoDataset: Failed to find '
'suitable (h, w) for positive window. '
f'Using (hmax, wmax) = ({hmax}, {wmax}) instead.')
window = bbox.make_random_box_container(hmax, wmax)
return window

Expand All @@ -285,8 +285,8 @@ def _sample_neg_window(self) -> Box:
if len(labels) == 0:
return window

log.warn('ObjectDetectionRandomWindowGeoDataset: Failed to find '
'negative window. Returning last sampled window.')
log.warning('ObjectDetectionRandomWindowGeoDataset: Failed to find '
'negative window. Returning last sampled window.')
return window

def _sample_window(self) -> Box:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ def __init__(self,
raise ValueError('output_dir or LearnerConfig.output_uri must '
'be specified.')
if output_dir is not None and cfg.output_uri is not None:
log.warn('Both output_dir and LearnerConfig.output_uri specified. '
'LearnerConfig.output_uri will be ignored.')
log.warning(
'Both output_dir and LearnerConfig.output_uri specified. '
'LearnerConfig.output_uri will be ignored.')
if output_dir is None:
assert cfg.output_uri is not None
self.output_dir = cfg.output_uri
Expand Down Expand Up @@ -851,7 +852,7 @@ def build_model(self, model_def_path: Optional[str] = None) -> nn.Module:

in_channels = cfg.data.img_channels
if in_channels is None:
log.warn('DataConfig.img_channels is None. Defaulting to 3.')
log.warning('DataConfig.img_channels is None. Defaulting to 3.')
in_channels = 3

model = cfg.model.build(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -910,8 +910,8 @@ def build(self,
test_mode=test_mode)

if self.uri is not None:
log.warn('Both DataConfig.uri and DataConfig.group_uris '
'specified. Only DataConfig.group_uris will be used.')
log.warning('Both DataConfig.uri and DataConfig.group_uris '
'specified. Only DataConfig.group_uris will be used.')

train_ds, valid_ds, test_ds = self.get_datasets_from_group_uris(
self.group_uris,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ def channel_groups_to_imgs(
img = torch.cat((img, third_channel), dim=-1)
elif len(ch_inds) > 3:
# only use the first 3 channels
log.warn(f'Only plotting first 3 channels of channel-group '
f'{title}: {ch_inds}.')
log.warning(f'Only plotting first 3 channels of channel-group '
f'{title}: {ch_inds}.')
img = x[..., ch_inds[:3]]
imgs.append(img)
return imgs
Expand Down

0 comments on commit 6249e01

Please sign in to comment.