From ea06538ffd1abfc380492b66b7b4be8032ce224e Mon Sep 17 00:00:00 2001 From: Rosie Wood Date: Thu, 12 Sep 2024 13:56:19 +0100 Subject: [PATCH] add docs, update changelog --- CHANGELOG.md | 1 + .../developers-corner/running-tests.rst | 45 ++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e72137e0..c828444e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ _ADD NEW CHANGES HERE_ - All file loading methods now support `pathlib.Path` and `gpd.GeoDataFrame` objects as input ([#495](https://github.com/maps-as-data/MapReader/pull/495)) - Loading of dataframes from GeoJSON files now supported in many file loading methods (e.g. `add_metadata`, `Annotator.__init__`, `AnnotationsLoader.load`, etc.) ([#495](https://github.com/maps-as-data/MapReader/pull/495)) - `load_frames.py` added to `mapreader.utils`. This has functions for loading from various file formats (e.g. CSV, Excel, GeoJSON, etc.) and converting to GeoDataFrames ([#495](https://github.com/maps-as-data/MapReader/pull/495)) +- Added tests for text spotting code ([#500](https://github.com/maps-as-data/MapReader/pull/500)) ### Changed diff --git a/docs/source/community-and-contributions/contribution-guide/developers-corner/running-tests.rst b/docs/source/community-and-contributions/contribution-guide/developers-corner/running-tests.rst index db20c10a..4b885ef4 100644 --- a/docs/source/community-and-contributions/contribution-guide/developers-corner/running-tests.rst +++ b/docs/source/community-and-contributions/contribution-guide/developers-corner/running-tests.rst @@ -1,9 +1,9 @@ Running tests ============= -To run the tests for MapReader, you will need to have installed the **dev dependencies** as described above. +To run the tests for MapReader, you will need to have installed the **dev dependencies** (as described :doc:`here `. -Also, if you have followed the "Install from PyPI" instructions, you will need to clone the MapReader repository to access the tests. i.e.: +.. note:: If you have followed the "Install from PyPI" instructions, you will also need to clone the MapReader repository to access the tests. i.e.: .. code-block:: bash @@ -18,3 +18,44 @@ You can then run the tests using from the root of the MapReader directory using python -m pytest -v If all tests pass, this means that MapReader has been installed and is working as expected. + +Testing text spotting +--------------------- + +The tests for the text spotting code are separated from the main tests due to dependency conflicts. + +You will only be able to run the text spotting tests for the text spotting framework (DPTextDETR, DeepSolo or MapTextPipeline) you have installed. + +For DPTextDETR, use the following commands: + +.. code-block:: bash + + cd path/to/MapReader # change this to your path, e.g. cd ~/MapReader + conda activate mapreader + export ADET_PATH=path/to/DPTextDETR # change this to the path where you have saved the DPTextDETR repository + wget https://huggingface.co/rwood-97/DPText_DETR_ArT_R_50_poly/resolve/main/art_final.pth # download the model weights + python -m pytest -v tests_text_spotting/test_dptext_runner.py + + +For DeepSolo: + +.. code-block:: bash + + cd path/to/MapReader # change this to your path, e.g. cd ~/MapReader + conda activate mapreader + export ADET_PATH=path/to/DeepSolo # change this to the path where you have saved the DeepSolo repository + wget https://huggingface.co/rwood-97/DeepSolo_ic15_res50/resolve/main/ic15_res50_finetune_synth-tt-mlt-13-15-textocr.pth # download the model weights + python -m pytest -v tests_text_spotting/test_deepsolo_runner.py + +For MapTextPipeline: + +.. code-block:: bash + + cd path/to/MapReader # change this to your path, e.g. cd ~/MapReader + conda activate mapreader + export ADET_PATH=path/to/MapTextPipeline # change this to the path where you have saved the MapTextPipeline repository + wget https://huggingface.co/rwood-97/MapTextPipeline_rumsey/resolve/main/rumsey-finetune.pth # download the model weights + python -m pytest -v tests_text_spotting/test_maptext_runner.py + + +If all tests pass, this means that the text spotting framework has been installed and is working as expected.