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

Improve show methods #511

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Improve show methods #511

wants to merge 10 commits into from

Conversation

rwood-97
Copy link
Collaborator

@rwood-97 rwood-97 commented Oct 10, 2024

Summary

Currently we have some very basic "show" methods for veiwing results. This is good for a quick look but would be better if we had some more advanced tools for visualising our results as part of the MapReader library.

Fixes #341
Address #478 - removed the utils.py file from annotate

Describe your changes

  • Updates the show methods in images.py, runner_base.py and rec_runner_base.py and adds explore_xx methods in each of these classes. Explore uses geopandas explore to create an interactive visualisation of results.
  • Also adds a check_georeferencing method ot the runners as this is needed to ensure we can convert to geo coords and therefore use the explore methods.
  • Adds infer_coords_from_patches method in images.py which uses patches to infer parent coords. This is for e.g. if you have loaded patches via the load_patches method and only added patch metadata (e.g. predictions).
  • Updates the way in which metrics are stored in classifier.py - now instead of train_loss_epoch and train_fscore_epoch as the key for a dict, we have nested dict with keys of train, val, etc and then within that keys of loss, fscore etc.
  • This enables simplification of the plot_metrics method, users now pass a list of metrics to plot (e.g. "loss", "fscore_micro", etc) and it will plot by default all phases. Can tell it just to plot for one phase by passing the phases argument.
  • I moved initialise model to the top of the file because it made sense to be grouped with the initialise_optimiser, initialise_scheduler etc methods.

Using the show_patches method:

image

Using the explore_patches method:

image image

Using explore_predictions method (i.e. the equivalent to explore_patches but for text spotting):

image

Checklist before assigning a reviewer (update as needed)

  • Self-review code
  • Ensure submission passes current tests
  • Add tests
  • Update relevant docs
  • Update changelog

Reviewer checklist

Please add anything you want reviewers to specifically focus/comment on.

  • Everything looks ok?

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

Attention: Patch coverage is 52.51397% with 170 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mapreader/classify/classifier.py 64.70% 54 Missing ⚠️
mapreader/spot_text/runner_base.py 0.00% 43 Missing ⚠️
mapreader/load/images.py 62.16% 42 Missing ⚠️
mapreader/spot_text/rec_runner_base.py 0.00% 28 Missing ⚠️
mapreader/classify/load_annotations.py 0.00% 3 Missing ⚠️
Flag Coverage Δ
unittests 70.76% <52.51%> (+2.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
mapreader/spot_text/deepsolo_runner.py 12.06% <ø> (ø)
mapreader/spot_text/dptext_detr_runner.py 8.69% <ø> (ø)
mapreader/spot_text/maptext_runner.py 11.66% <ø> (ø)
setup.py 0.00% <ø> (ø)
tests/test_classify/test_classifier.py 100.00% <100.00%> (ø)
tests/test_load/test_images.py 100.00% <100.00%> (ø)
mapreader/classify/load_annotations.py 59.29% <0.00%> (-0.64%) ⬇️
mapreader/spot_text/rec_runner_base.py 0.00% <0.00%> (ø)
mapreader/load/images.py 86.27% <62.16%> (+7.69%) ⬆️
mapreader/spot_text/runner_base.py 0.00% <0.00%> (ø)
... and 1 more

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.

Update show() method to enable plotting of discrete data (e.g. labels) using legend rather than colormap
1 participant