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

Merged
merged 25 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
30785c7
remove unused file
rwood-97 Oct 8, 2024
030d9e2
update plotting in images.py, add infer coords from patches method, r…
rwood-97 Oct 8, 2024
f089310
return none if no annotations with specified label found in show_sample
rwood-97 Oct 8, 2024
fb80834
always add optimiser/scheduler/etc after calling ititialize_optimiser…
rwood-97 Oct 8, 2024
827cf95
ensure show works for grayscale images
rwood-97 Oct 10, 2024
8eae31b
update show and add explore to text spotting runners
rwood-97 Oct 10, 2024
8db862b
allow parent df to be None
rwood-97 Oct 10, 2024
cee4d21
add check for georeferencing
rwood-97 Oct 10, 2024
456c2ed
update requirements
rwood-97 Oct 10, 2024
21ace16
fix current tests
rwood-97 Oct 17, 2024
aa48a19
update tests for infer_coords_from_patches
rwood-97 Oct 29, 2024
7e5a198
add tests for classifier
rwood-97 Oct 29, 2024
cbf20c2
add tests for explore methods
rwood-97 Oct 29, 2024
b9b6f69
Merge branch 'main' into improve_show
rwood-97 Oct 29, 2024
40d1da9
add tests georeferencing
rwood-97 Oct 29, 2024
a26e87e
Merge branch 'main' into improve_show
rwood-97 Oct 30, 2024
509edb3
update changelog
rwood-97 Oct 30, 2024
16f0378
update worked examples and two minor fixes
rwood-97 Oct 31, 2024
93ef0a4
add worked example outputs to gitignore
rwood-97 Nov 1, 2024
c860b6a
update docs
rwood-97 Nov 1, 2024
4db7664
update docs and add `list_metrics` method to classify
rwood-97 Nov 1, 2024
caa4103
minor fix for georeferencing if no parents (i.e. load_patches)
rwood-97 Nov 8, 2024
b735342
Merge branch 'main' into improve_show
rwood-97 Nov 8, 2024
eede7bb
Fixing order of `explore_patches` if clauses
kallewesterling Nov 12, 2024
77187eb
Merge branch 'main' into improve_show
rwood-97 Nov 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ worked_examples/**/workshops_*/**/*.csv
worked_examples/**/workshops_*/**/*.geojson
worked_examples/**/workshops_*/**/*.xlsx

# worked examples
worked_examples/**/patches_*_*/*.png
worked_examples/**/patches_*_*/*.tif
worked_examples/**/maps/*.png
worked_examples/**/*.csv
worked_examples/**/*.geojson
worked_examples/**/models_tutorial/*
worked_examples/**/tboard_tutorial/*
worked_examples/**/tmp_checkpoints/*

# test outputs
/broken_files.txt
Expand Down
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,29 @@ The following table shows which versions of MapReader are compatible with which
## Pre-release

_Add new changes here_
### Added

- Added `infer_parent_coords_from_patches` method to `MapImages` class ([#511](https://github.com/maps-as-data/MapReader/pull/511))
- Added `explore_patches` method to `MapImages` class for interactive exploration of patches ([#511](https://github.com/maps-as-data/MapReader/pull/511))
- Added `explore_predictions` and `explore_search_results` methods to text runners ([#511](https://github.com/maps-as-data/MapReader/pull/511))

### Changed

- Metrics are now stored in a nested dictionary (e.g. `metrics['train']['loss']` instead of `metrics["epoch_loss_train]`) ([#511](https://github.com/maps-as-data/MapReader/pull/511))
- `plot_metric` method is simplified - see updated docs ([#511](https://github.com/maps-as-data/MapReader/pull/511))
- Renamed `show_parent` as `show_patches` ([#511](https://github.com/maps-as-data/MapReader/pull/511))

## [v1.5.1](https://github.com/Living-with-machines/MapReader/releases/tag/v1.5.1) (2024-10-30)

## Added
### Added

- Added `text-requirement.txt` file to install text spotting dependencies. Users can now install text spotting dependencies using `pip install -r text-requirements.txt` ([#515](https://github.com/maps-as-data/MapReader/pull/515))

## Removed
### Removed

- Removed `text` extras from `setup.py` ([#515](https://github.com/maps-as-data/MapReader/pull/515))

## Fixed
### Fixed

- Fixes upload to PyPI by removing `text` extras ([#515](https://github.com/maps-as-data/MapReader/pull/515))

Expand Down
46 changes: 23 additions & 23 deletions docs/source/using-mapreader/step-by-step-guide/1-download.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ To help you visualize your maps, the boundaries of the map sheets included in yo
Passing ``add_id=True`` when calling this method will add the WFS ID numbers of your map sheets to your plot.
This can be helpful in identifying the map sheets you'd like to download.

Another helpful method is the ``get_minmax_latlon()`` method, which will print out the minimum and maximum latitudes and longitudes of all your map sheets and can help you identify valid ranges of latitudes and longitudes to use for querying.
Another helpful method is the ``get_minmax_latlon`` method, which will print out the minimum and maximum latitudes and longitudes of all your map sheets and can help you identify valid ranges of latitudes and longitudes to use for querying.
It's use is as follows:

.. code-block:: python
Expand All @@ -112,7 +112,7 @@ It's use is as follows:


As well as geographic information, it can also be helpful to know the range of publication dates for your map sheets.
This can be done using the ``extract_published_dates()`` method:
This can be done using the ``extract_published_dates`` method:

.. code-block:: python

Expand Down Expand Up @@ -154,7 +154,7 @@ For all query methods, you should be aware of the following arguments:
- ``append`` - By default, this is set to ``False`` and so a new query list is created each time you make a new query. Setting it to ``True`` (i.e. by specifying ``append=True``) will result in your newly query results being appended to your previous ones.
- ``print`` - By default, this is set to ``False`` and so query results will not be printed when you run the query method. Setting it to ``True`` will result in your query results being printed.

The ``print_found_queries()`` method, which can be used to print your query results at any time.
The ``print_found_queries`` method, which can be used to print your query results at any time.
It's use is as follows:

.. code-block:: python
Expand All @@ -163,8 +163,8 @@ It's use is as follows:

.. note:: You can also set ``print=True`` in the query commands to print your results in situ. See above.

The ``plot_queries_on_map()`` method, which can be used to plot your query results on a map.
As with the ``plot_all_metadata_on_map()``, you can specify ``add_id=True`` to add the WFS ID numbers to your plot. Use this method as follows:
The ``plot_queries_on_map`` method, which can be used to plot your query results on a map.
As with the ``plot_all_metadata_on_map``, you can specify ``add_id=True`` to add the WFS ID numbers to your plot. Use this method as follows:

.. code-block:: python

Expand Down Expand Up @@ -254,16 +254,16 @@ This would result in a metadata.csv with the following columns:
1. Finding map sheets which overlap or intersect with a polygon.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``query_map_sheets_by_polygon()`` and ``download_map_sheets_by_polygon()`` methods can be used find and download map sheets which are within or intersect/overlap with a `shapely.Polygon <https://shapely.readthedocs.io/en/stable/reference/shapely.Polygon.html#shapely.Polygon>`_.
The ``query_map_sheets_by_polygon`` and ``download_map_sheets_by_polygon`` methods can be used find and download map sheets which are within or intersect/overlap with a `shapely.Polygon <https://shapely.readthedocs.io/en/stable/reference/shapely.Polygon.html#shapely.Polygon>`_.
These methods have two modes:

- "within" - This finds map sheets whose bounds are completely within the given polygon.
- "intersects" - This finds map sheets which intersect/overlap with the given polygon.

The ``mode`` can be selected by specifying ``mode="within"`` or ``mode="intersects"``.

The ``query_map_sheets_by_polygon()`` and ``download_map_sheets_by_polygon()`` methods take a `shapely.Polygon <https://shapely.readthedocs.io/en/stable/reference/shapely.Polygon.html#shapely.Polygon>`_ object as the ``polygon`` argument.
These polygons can be created using MapReader's ``create_polygon_from_latlons()`` function:
The ``query_map_sheets_by_polygon`` and ``download_map_sheets_by_polygon`` methods take a `shapely.Polygon <https://shapely.readthedocs.io/en/stable/reference/shapely.Polygon.html#shapely.Polygon>`_ object as the ``polygon`` argument.
These polygons can be created using MapReader's ``create_polygon_from_latlons`` function:

.. code-block:: python

Expand Down Expand Up @@ -302,7 +302,7 @@ By default, this will result in the directory structure shown in download_guidan

.. note:: Further information on the use of the download methods can be found in download_guidance_.

Alternatively, you can bypass the querying step and download map sheets directly using the ``download_map_sheets_by_polygon()`` method.
Alternatively, you can bypass the querying step and download map sheets directly using the ``download_map_sheets_by_polygon`` method.

To download map sheets which fall within the bounds of this polygon, use:

Expand All @@ -318,12 +318,12 @@ Or, to find map sheets which intersect with this polygon, use:

Again, by default, this will result in the directory structure shown in download_guidance_.

.. note:: As with the ``download_map_sheets_by_queries()`` method, see download_guidance_ for further guidance.
.. note:: As with the ``download_map_sheets_by_queries``, see download_guidance_ for further guidance.

1. Finding map sheets which contain a set of coordinates.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``query_map_sheets_by_coordinates()`` and ``download_map_sheets_by_coordinates()`` methods can be used find and download map sheets which contain a set of coordinates.
The ``query_map_sheets_by_coordinates`` and ``download_map_sheets_by_coordinates`` methods can be used find and download map sheets which contain a set of coordinates.

To find maps sheets which contain a given set of coordinates, use:

Expand All @@ -350,7 +350,7 @@ By default, this will result in the directory structure shown in download_guidan

.. note:: Further information on the use of the download methods can be found in download_guidance_.

Alternatively, you can bypass the querying step and download map sheets directly using the ``download_map_sheets_by_coordinates()`` method:
Alternatively, you can bypass the querying step and download map sheets directly using the ``download_map_sheets_by_coordinates`` method:

.. code-block:: python

Expand All @@ -365,15 +365,15 @@ e.g. :

Again, by default, these will result in the directory structure shown in download_guidance_.

.. note:: As with the ``download_map_sheets_by_queries()`` method, see download_guidance_ for further guidance.
.. note:: As with the ``download_map_sheets_by_queries`` method, see download_guidance_ for further guidance.

3. Finding map sheets which intersect with a line.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``query_map_sheets_by_line()`` and ``download_map_sheets_by_line()`` methods can be used find and download map sheets which intersect with a line.
The ``query_map_sheets_by_line`` and ``download_map_sheets_by_line`` methods can be used find and download map sheets which intersect with a line.

These methods take a `shapely.LineString <https://shapely.readthedocs.io/en/stable/reference/shapely.LineString.html#shapely.LineString>`_ object as the ``line`` argument.
These lines can be created using MapReader's ``create_line_from_latlons()`` function:
These lines can be created using MapReader's ``create_line_from_latlons`` function:

.. code-block:: python

Expand Down Expand Up @@ -406,20 +406,20 @@ By default, this will result in the directory structure shown in download_guidan

.. note:: Further information on the use of the download methods can be found in download_guidance_.

Alternatively, you can bypass the querying step and download map sheets directly using the ``download_map_sheets_by_line()`` method:
Alternatively, you can bypass the querying step and download map sheets directly using the ``download_map_sheets_by_line`` method:

.. code-block:: python

my_ts.download_map_sheets_by_polygon(my_line)

Again, by default, this will result in the directory structure shown in download_guidance_.

.. note:: As with the ``download_map_sheets_by_queries()`` method, see download_guidance_ for further guidance.
.. note:: As with the ``download_map_sheets_by_queries`` method, see download_guidance_ for further guidance.

4. Finding map sheets using their WFS ID numbers.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``query_map_sheets_by_wfs_ids()`` and ``download_map_sheets_by_wfs_ids()`` methods can be used find and download map sheets using their WFS ID numbers.
The ``query_map_sheets_by_wfs_ids`` and ``download_map_sheets_by_wfs_ids`` methods can be used find and download map sheets using their WFS ID numbers.

To find maps sheets using their WFS ID numbers, use:

Expand Down Expand Up @@ -447,7 +447,7 @@ By default, this will result in the directory structure shown in download_guidan

.. note:: Further information on the use of the download methods can be found in download_guidance_.

Alternatively, you can bypass the querying step and download map sheets directly using the ``download_map_sheets_by_wfs_ids()`` method:
Alternatively, you can bypass the querying step and download map sheets directly using the ``download_map_sheets_by_wfs_ids`` method:

.. code-block:: python

Expand All @@ -463,12 +463,12 @@ or

Again, by default, these will result in the directory structure shown in download_guidance_.

.. note:: As with the ``download_map_sheets_by_queries()`` method, see download_guidance_ for further guidance.
.. note:: As with the ``download_map_sheets_by_queries`` method, see download_guidance_ for further guidance.

5. Finding map sheets by searching for a string in their metadata.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``query_map_sheets_by_string()`` and ``download_map_sheets_by_string()`` methods can be used find and download map sheets by searching for a string in their metadata.
The ``query_map_sheets_by_string`` and ``download_map_sheets_by_string`` methods can be used find and download map sheets by searching for a string in their metadata.

These methods use `regex string searching <https://docs.python.org/3/library/re.html>`__ to find map sheets whose metadata contains a given string.
Wildcards and regular expressions can therefore be used in the ``string`` argument.
Expand Down Expand Up @@ -506,7 +506,7 @@ By default, this will result in the directory structure shown in download_guidan

.. note:: Further information on the use of the download methods can be found in download_guidance_.

Alternatively, you can bypass the querying step and download map sheets directly using the ``download_map_sheets_by_string()`` method:
Alternatively, you can bypass the querying step and download map sheets directly using the ``download_map_sheets_by_string`` method:

.. code-block:: python

Expand All @@ -521,4 +521,4 @@ e.g. to search for "shire" (e.g. Wiltshire, Lanarkshire, etc.):

Again, by default, these will result in the directory structure shown in download_guidance_.

.. note:: As with the ``download_map_sheets_by_queries()`` method, see download_guidance_ for further guidance.
.. note:: As with the ``download_map_sheets_by_queries`` method, see download_guidance_ for further guidance.
Loading
Loading