-
Notifications
You must be signed in to change notification settings - Fork 3
Feature/fes/region filtering #153
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
base: main
Are you sure you want to change the base?
Conversation
"use_rds,geo_extension", | ||
([True, None], [False, ".gpkg"], [False, ".geojson"], [False, ".shp"]), | ||
) | ||
def test_empty(self, tmp_path, use_rds, geo_extension): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran into an error with an empty GDF, this test replicated the error and then started passing when the error was fixed.
Returns: | ||
gpd.GeoDataFrame: Detections in the requested CRS | ||
RegionDetections: Detections in the requested CRS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just updating the docstring to match what the code is doing
mask_iterator: Iterable[np.ndarray], | ||
threshold: float = 0.4, | ||
) -> List[RegionDetectionsSet]: | ||
) -> Union[List[RegionDetectionsSet], List[gpd.GeoDataFrame]]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a change in behavior, just correcting the hint to match the behavior
(x0, y0) center of the ellipse in x and y (pixels) | ||
axes (Tuple[int, int]): | ||
(a, b) semi-major and semi-minor axis lengths in pixels | ||
(a, b) x and y axis lengths (before rotation) in pixels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more correct description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice visualization tool!
detection_overlay = Image.new("RGBA", image.size, (0, 0, 0, 0)) | ||
detection_draw = ImageDraw.Draw(detection_overlay, "RGBA") | ||
for idx, row in gdf1.iterrows(): | ||
has_match = row["unique_ID"] in gdf2["unique_ID"].values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "unique_id" column gets created whenever merge()
is done on a RegionDetectionsSet
. So if the detections are being read from a .gpkg/.geojson file is it expected by the file to have the "unique_ID" column? If so should that be specified in the documentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, the files that I was using (documented in the PR description) came from TDF and had that column so I assumed it would generally be available. I suppose
- Is there a better column available?
- If not, we can add
id_column
as an argument withunique_ID
as the default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay. Any files created using TDF is guaranteed to have the unique_ID
column. I was only asking for use cases where this could get input vector files generated outside of TDF. But I guess there isn't a possibility of that happening.
If needed, I think it would be good to add id_column
as an argument with unique_ID
default like you suggested, just to keep it more flexible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Creates a visualization that allows you to see which detections were filtered out by a mask and why (by checking which detections different components of the mask overlaps with.
Tested using this code which resulted in images like this.