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

implement segmentation method for green view score #41

Closed
wants to merge 1 commit into from

Conversation

banjtheman
Copy link

Created a new module to calculate GVI based on the method from the StreetView-NatureVisibility project

README provides steps to install and run locally.

@danbjoseph
Copy link
Member

danbjoseph commented May 10, 2024

Thanks for working on this! It will be a valuable addition to the project.

  • can you please resubmit this against this PR against main? i find it confusing to have some already merged commits showing as changes alongside the changes you've made. the branch you've submitted against is 4 commits behind main.
  • the readme instructions should build on our existing readme. for example, we already have a "Setup" section.
  • what's the purpose of including a streamlit app?
  • this process should be a simple swap for our treepedia based option in 3. Assign a Green View score to each image/feature - when @dragonejt in fix: add LocalImages Image source to assign local images to points using EXIF data #42 is tackling having 2 options for step 2, he has gone the route of including an argument for the method. that is, when running python -m src.download_images the user can include a MAPILLARY or LOCAL argument. similarly, for step 3 calculating green view, we may want to let users include an argument defining their preferred analysis method, something like TREEPEDIA or MASK2FORMER

@banjtheman banjtheman changed the base branch from 10-use-class-segmentation-for-vegetationcanopy-estimation to main May 10, 2024 20:19
@banjtheman
Copy link
Author

  • Changed to main branch
  • Streamlit app provides a way to visualize how the segmentation works. It is open source and runs locally.
  • This part sounds like a new feature, since we would be editing the main script and pipeline. Let's have this PR be for integrating the standalone module.
  • We can then can create a new issue to migrate the module into the existing pipeline with the desired functionally (and the README update) (This also provides a good first issue for folks wanting to contribute!)

Copy link
Contributor

@jayqi jayqi left a comment

Choose a reason for hiding this comment

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

This part sounds like a new feature, since we would be editing the main script and pipeline. Let's have this PR be for integrating the standalone module.

I think what Dan is asking for is for this code to be better integrated into the rest of the project. I get that the current implementation is standalone and self-contained, but I think if we want to merge code into the main branch, it should be consistent and well-integrated with the rest of the project—specifically the rest of the source code in the project's Python package that's located in src/.

Some specifics:

  • The code in the PR should go into the src/gvi/segmentation submodule.
  • There should be a function implemented that matches the API from the existing get_gvi_score function. This function should take the path to a non-segmented image and output the GVI score for the image. (Both the segmenting and the GVI calculation should be encapsulated in that function.) Then we can easily implement the swapping when they have the same API.
    def get_gvi_score(image_path):
    """
    Calculate the Green View Index (GVI) for a given image file.
    Args:
    image_path (str): Path to the image file.
    Returns:
    float: The Green View Index (GVI) score for the given image.
    """
    • I think it could be reasonable to consider the swapping functionality to be a separate feature, like what you've said, in order to keep this PR smaller.
  • The requirements should be integrated into the package's requirements in pyproject.toml.

@dragonejt
Copy link
Contributor

dragonejt commented May 23, 2024

Agree with Jay, here's how I did something similar for image sources in #42 :

  • Add a submodule for this step of the project (src.gvi)
  • Add an interface (AbstractBaseClass) that both the classical GVI method and new segmentation GVI method will inherit from. Something like src/gvi/gvi_scorer.py, and there should at the very least be a common constructor and a get_gvi_for_image(image_path: Path) abstract method or similar
  • Add an Enum to select which GVI Scorer to use, and add it as a CLI argument

@danbjoseph danbjoseph changed the title #10 Created module for GVI Segmentation Method implement segmentation method for green view score Jun 24, 2024
@danbjoseph
Copy link
Member

this PR addresses #10

@danbjoseph
Copy link
Member

it would also be good to save the green score from this segmentation method to a column with a specific header so that the user could run both the "pixel-counting" method and this method on the same files, end up with both result columns, and then compare.

@danbjoseph
Copy link
Member

this is superseded by #55

@danbjoseph danbjoseph closed this Aug 26, 2024
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.

4 participants