Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

point features will save as rasters #6

Merged
merged 2 commits into from
May 8, 2024
Merged

point features will save as rasters #6

merged 2 commits into from
May 8, 2024

Conversation

asaxton
Copy link
Collaborator

@asaxton asaxton commented May 6, 2024

No description provided.

@asaxton asaxton requested a review from robkooper May 6, 2024 16:23
@asaxton
Copy link
Collaborator Author

asaxton commented May 6, 2024

Tested with

apptainer run --nv -B /projects/bbym/saxton/MockValData:/data -B ./feedback:/feedback -B ./logs:/logs -B ./output:/output ./criticalmaas-pipeline_pr-6.sif -v --data /data/validation --output /output --legends /data/validation --log /logs/log.log --model golden_muscat --validation /data/validation_labels --output_types raster_masks

and

apptainer run --nv -B /projects/bbym/saxton/MockValData:/data -B ./feedback:/feedback -B ./logs:/logs -B ./output:/output ./criticalmaas-pipeline_pr-6.sif -v --data /data/validation --output /output --legends /data/validation --log /logs/log.log --model flat_iceberg --validation /data/validation_labels --output_types raster_masks

Exited cleanly, no exceptions raised. f1 scores were KY_WestFranklin: nan, OR_Carlton: 0.40 and KY_WestFranklin: 0.27 OR_Carlton: 0.45 respectively. Note: KY_WestFranklin had no point features. f1 of nan is correct.

io.saveGeoTiff(filepath, feature_mask, map_data.georef.crs, map_data.georef.transform)
if feature.type == MapUnitType.POLYGON:
if map_data.poly_segmentation_mask is None:
#pipeline_manager.log(logging.WARNING, f'Can\'t validate feature {feature.label}. No predicted segmentation mask present.')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use both types of quotes in this case.

Suggested change
#pipeline_manager.log(logging.WARNING, f'Can\'t validate feature {feature.label}. No predicted segmentation mask present.')
#pipeline_manager.log(logging.WARNING, f"Can't validate feature {feature.label}. No predicted segmentation mask present.")

Copy link
Collaborator

@robkooper robkooper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM some small comments.

feature_mask[map_data.poly_segmentation_mask == legend_index] = 1
filepath = os.path.join(output_dir, sanitize_filename(f'{map_data.name}_{feature.label}.tif'))
io.saveGeoTiff(filepath, feature_mask, map_data.georef.crs, map_data.georef.transform)
pipeline_manager.log(logging.DEBUG, f'{map_data.name}, {feature.label} {feature.type}')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need this line?

filepath = os.path.join(output_dir, sanitize_filename(f'{map_data.name}_{feature.label}.tif'))
io.saveGeoTiff(filepath, feature_mask, map_data.georef.crs, map_data.georef.transform)
pipeline_manager.log(logging.DEBUG, f'{map_data.name}, {feature.label} {feature.type}')
if feature.type == MapUnitType.POINT:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like most of the code is the same would it make sense to just use:

Suggested change
if feature.type == MapUnitType.POINT:
if feature.type == MapUnitType.POINT or feature.type == MapUnitType.POLYGON:

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a small difference between the two blocks. map_data.poly_segmentation_mask vs. map_data.point_segmentation_mask. But there was redundant code in them too. Take a look now, I've made some adjustments.

@asaxton asaxton requested a review from robkooper May 7, 2024 20:46
@asaxton asaxton merged commit 67f5a10 into main May 8, 2024
1 check passed
@asaxton asaxton deleted the bugfix/pt-save branch May 8, 2024 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants