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

Ch/review assess flai #2

Merged
merged 4 commits into from
Aug 22, 2023
Merged

Ch/review assess flai #2

merged 4 commits into from
Aug 22, 2023

Conversation

cleherny
Copy link
Collaborator

@cleherny cleherny commented Aug 15, 2023

Review branch gs/assess_flai

The evaluation of the results with metrics computation is improved with the implementation of a new function taking into account the fact that detection can overlap several labels.

General:

  • Does the function “one to many” work for several detections overlapping a single GT polygon?

assess_flai.py:

  • I added gdf.to_crs(epsg) on line 58 and 64 because there was a crs mismatch. We can consider adding a function that in case there is a mismatch, uniformize the crs.
  • I still have a Warning due to CRS that I don’t quite understand because all the gdf to be concatenated have the same crs

image

fct_metrics.py:

  • Docstrings for “apply_iou_threshold_one_to_many” and “apply_iou_threshold_one_to_one” are the same.
  • Why set coverage at 25%? It misses some detection that could be counted as TP

Copy link
Member

@GwenaelleSa GwenaelleSa left a comment

Choose a reason for hiding this comment

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

General:
As discussed at the last reunion, currently, one-to-many is one prediction to many labels only.

fct_metrics.py:
Thank you for remarking the problem with the docstring. I corrected it in the branch gs/dev_pcdseg, maybe you can correct here. Otherwise, I will do it once the PC is merged.
The limit on the coverage is entirely arbitrary. Maybe we should test by iteration, with the limit that the lower is probably the lower, even if sometimes, the label would only brush the prediction.

If you don't have any further changes to propose, you can merge. It is all ok for me :)

@@ -23,21 +23,22 @@ def format_logger(logger):
level="ERROR")
return logger

def test_crs(crs1, crs2 = "EPSG:2056"):
def test_crs(crs1, crs2="EPSG:2056"):
Copy link
Member

Choose a reason for hiding this comment

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

Why change here to remove the spaces and below to add them?
You added them in the whole branch, you might as well leave them here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here again I tried to follow the pep8 style convention:
image
image

@@ -9,7 +9,8 @@
# Copyright (c) 2020 Republic and Canton of Geneva
#

import os, sys
import os
import sys
Copy link
Member

Choose a reason for hiding this comment

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

Did you change to match your scripts? Becaus I do it in all mines, so I would have to change them all.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes I (will) change it in my scripts. I try to follow the pep8 convention style for python script:
image

@@ -19,9 +20,9 @@

sys.path.insert(1, 'scripts')
import functions.fct_metrics as metrics
import functions.fct_misc as fct_misc
import functions.fct_misc as misc
Copy link
Member

Choose a reason for hiding this comment

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

Same as above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can do it as you prefer, either we always have a function alias named "x" or named "fct_x". I tend to think the 1st option is lighter but I have no strong opinion on that, just that everything must follow the same pattern.

logger.info(f"Read detection file: {gdf_detec.shape[0]} shapes")

gdf_gt = gpd.read_file(GT)
gdf_gt['ID_GT'] = gdf_gt['fid']
gdf_gt = gdf_gt.rename(columns={"area": "area_GT"})
gdf_gt = gdf_gt.to_crs(EPSG)

misc.test_crs(gdf_detec.crs, gdf_gt.crs)
Copy link
Member

Choose a reason for hiding this comment

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

To test the CRS you just set seems a bit over the top. I think we could lighten the code and not put line 66.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can remove line 66.



# Set the final dataframe with tagged prediction
logger.info(f"Set the final dataframe")

tagged_preds_gdf = pd.concat([tp_gdf, fp_gdf, fn_gdf])
tagged_preds_gdf = tagged_preds_gdf.drop(['index_right', 'geom_GT', 'FID', 'fid', 'OBSTACLE', 'geom_DET'], axis = 1)
tagged_preds_gdf = tagged_preds_gdf.drop(['index_right', 'geom_GT', 'FID', 'fid', 'geom_DET'], axis = 1)
Copy link
Member

Choose a reason for hiding this comment

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

Here, I removed the 'OBSTACLE' attribute because my layer only have objects and no planes, so it is always equals to 1. If you want to keep it because it could have different values, you would need to check when reading the predictions that you only keep the obstacles and not the free spaces.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, for the image segmentation, I have only objects. so no need to keep it.

@cleherny
Copy link
Collaborator Author

  • Yes, we might try to include iteration on the overlap area to observe when it is pertinent to discard a detection overlapping a label.
  • About spaces and other styles in scripts, I try to follow the pep8 style convention: https://peps.python.org/pep-0008/#introduction.
  • I deleted the line checking for CRS matching in the script assess_flai.py.
  • I corrected the docstring of the function of "apply_iou_threshold_one_to_many" in fct_metrics.py replacing "Each detection can only correspond to one label." to "Each detection can correspond to several labels."

It is all good for me 👍

@cleherny cleherny merged commit 3007d42 into gs/assess_flai Aug 22, 2023
@cleherny cleherny deleted the ch/review_assess_flai branch August 22, 2023 13:36
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