Skip to content

Commit

Permalink
Change raster loader to not flatten patches; change flattened pixel v…
Browse files Browse the repository at this point in the history
…alue extractor to scale based on min max #58
  • Loading branch information
bdubayah committed Oct 17, 2021
1 parent 0b659a2 commit ae0e2b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dora_exp_pipeline/dora_data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def _load(self, dir_path: str, patch_size: int, stride: int = 1,
# append the patch coordinate as the id
data_dict['id'].append('%d-%d' % (i, j))
# append the patch data
data_dict['data'].append(patch.flatten())
data_dict['data'].append(patch)
j += stride
i += stride
else:
Expand Down
5 changes: 4 additions & 1 deletion dora_exp_pipeline/dora_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ def extract(self, data_cube, **kwargs):
ret_features[ind, :] = data.flatten()

if kwargs.get('normalize_pixels'):
ret_features = ret_features / 255.
min_val = np.min(ret_features)
max_val = np.max(ret_features)
scaled = np.subtract(ret_features, min_val) / (max_val - min_val)
ret_features = scaled

return ret_features

Expand Down

0 comments on commit ae0e2b0

Please sign in to comment.