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

[POC] classif step 3: segmentation classification #694

Open
adebardo opened this issue Mar 3, 2025 · 0 comments
Open

[POC] classif step 3: segmentation classification #694

adebardo opened this issue Mar 3, 2025 · 0 comments
Labels
[POC] Conception To review Tickets needs approval about it conception

Comments

@adebardo
Copy link
Contributor

adebardo commented Mar 3, 2025

Context

After implementing the ClassificationLayer base class, the next step is to develop the SegmentationClassificationLayer. This class handles segmentation-based classification of a DEM, where it classifies DEM pixels based on an external segmentation mask provided by the user.

The SegmentationClassificationLayer will inherit from the ClassificationLayer and will implement the logic for applying the segmentation mask to the DEM.

Code

In the same file (classification.py) as the ClassificationLayer base class, add the SegmentationClassificationLayer to define the segmentation classification logic.

  1. __init__() method:
    • Extend the initialization from the ClassificationLayer.
    • Include additional attributes specific to segmentation classification:
      • segmentation_mask_path: A string that represents the path to the external segmentation mask (e.g., a raster file).
      • class_names: A dictionary that maps class names to values in the segmentation mask (e.g., {"valid": 1, "water": 2, "land": 3}). Could be a YAML file too.
  2. apply_classification() method:
    • Load the segmentation mask from the file specified in segmentation_mask_path.
    • For each class defined in class_names, create a mask where DEM pixels match the segmentation values.
    • Store the resulting masks in the classification attribute, which is a geoutils.Mask 3D object, where the first dimension represents the class, and the two others represent the mask values.

Tests

  • Write unit tests for the SegmentationClassificationLayer class in test_classification.py file.
  • The unit tests should:
    1. Verify that the layer initializes properly with the provided configuration.
    2. Ensure that the classification logic works as expected.
    3. Confirm that statistics are computed as expected.
    4. Validate that the results are saved correctly.
@adebardo adebardo added the [POC] Conception To review Tickets needs approval about it conception label Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[POC] Conception To review Tickets needs approval about it conception
Projects
None yet
Development

No branches or pull requests

1 participant