Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

Commit

Permalink
Fix clobbering of ROI mask values used for training
Browse files Browse the repository at this point in the history
  • Loading branch information
ceholden committed Mar 19, 2015
1 parent 1e30d27 commit f882a00
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ q_max = 90
# Training data file
training_image = /home/ceholden/Documents/yatsm/examples/training_data.gtif
# Training data masked values
mask_values = 0,255
roi_mask_values = 0,255
# Date range
training_start = 1999-01-01
training_end = 2001-01-01
Expand Down
2 changes: 1 addition & 1 deletion examples/p035r032_example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ q_max = 90
# Training data file
training_image =
# Training data masked values
mask_values = 0,255
roi_mask_values = 0,255
# Date range
training_start = 1999-01-01
training_end = 2001-01-01
Expand Down
2 changes: 1 addition & 1 deletion scripts/train_yatsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def get_training_inputs(dataset_config, exit_on_missing=False):
raise

# Loop through samples in ROI extracting features
mask = ~np.in1d(roi, dataset_config['mask_values']).reshape(roi.shape)
mask = ~np.in1d(roi, dataset_config['roi_mask_values']).reshape(roi.shape)
row, col = np.where(mask)
y = roi[row, col]

Expand Down
12 changes: 6 additions & 6 deletions yatsm/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def parse_config_v0_1_x(config_file):
robust = false
[classification]
training_image = None
mask_values = 0, 255
roi_mask_values = 0, 255
cache_training =
"""

Expand All @@ -57,12 +57,12 @@ def parse_config_v0_1_x(config_file):
if config.has_section('classification'):
dataset_config['training_image'] = config.get('classification',
'training_image')
dataset_config['mask_values'] = config.get('classification',
'mask_values')
if dataset_config['mask_values']:
dataset_config['mask_values'] = np.array([
dataset_config['roi_mask_values'] = config.get('classification',
'roi_mask_values')
if dataset_config['roi_mask_values']:
dataset_config['roi_mask_values'] = np.array([
int(v) for v in
dataset_config['mask_values'].replace(' ', ',').split(',')
dataset_config['roi_mask_values'].replace(' ', ',').split(',')
if v != ','])
dataset_config['cache_training'] = config.get(
'classification', 'cache_training')
Expand Down

0 comments on commit f882a00

Please sign in to comment.