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

feat: Added page visualization function #54

Merged
merged 14 commits into from
Feb 4, 2021
Merged

feat: Added page visualization function #54

merged 14 commits into from
Feb 4, 2021

Conversation

charlesmindee
Copy link
Collaborator

@charlesmindee charlesmindee commented Feb 2, 2021

Implements a visualization function of all elements (blocks, artefacts, lines, words) inside a page, with the matplotlib & mplcursors libs.

viz

@charlesmindee charlesmindee added the module: io Related to doctr.io label Feb 2, 2021
@charlesmindee charlesmindee self-assigned this Feb 2, 2021
@fg-mindee fg-mindee added this to the 0.1.0 milestone Feb 2, 2021
@codecov
Copy link

codecov bot commented Feb 2, 2021

Codecov Report

Merging #54 (0b2104f) into main (5afb0d7) will decrease coverage by 2.30%.
The diff coverage is 62.26%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #54      +/-   ##
==========================================
- Coverage   94.73%   92.43%   -2.31%     
==========================================
  Files          23       24       +1     
  Lines         703      753      +50     
==========================================
+ Hits          666      696      +30     
- Misses         37       57      +20     
Impacted Files Coverage Δ
doctr/models/_utils.py 92.85% <ø> (ø)
doctr/utils/_typing.py 100.00% <ø> (ø)
doctr/utils/visualization.py 60.00% <60.00%> (ø)
doctr/documents/elements.py 98.73% <100.00%> (ø)
doctr/utils/__init__.py 100.00% <100.00%> (ø)
doctr/utils/geometry.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5afb0d7...0b2104f. Read the comment docs.

@fg-mindee fg-mindee mentioned this pull request Feb 2, 2021
2 tasks
Copy link
Contributor

@fg-mindee fg-mindee left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Good design overall, I added some suggestions for user flexibility!

Regarding unittest, could you, without checking the output, at least trying to plot it in the test? (using plt.show(block=False)). It will at least ensure that this gets executed without raising issues

setup.py Outdated Show resolved Hide resolved
doctr/utils/visualization.py Outdated Show resolved Hide resolved
doctr/utils/visualization.py Outdated Show resolved Hide resolved
doctr/utils/visualization.py Outdated Show resolved Hide resolved
doctr/utils/visualization.py Outdated Show resolved Hide resolved
doctr/utils/visualization.py Show resolved Hide resolved
doctr/utils/visualization.py Outdated Show resolved Hide resolved
doctr/utils/visualization.py Outdated Show resolved Hide resolved
doctr/utils/visualization.py Outdated Show resolved Hide resolved
@charlesmindee charlesmindee linked an issue Feb 3, 2021 that may be closed by this pull request
2 tasks
@fg-mindee fg-mindee changed the title Feat: added page visualization function feat: Added page visualization function Feb 3, 2021
@fg-mindee fg-mindee added module: utils Related to doctr.utils and removed module: io Related to doctr.io labels Feb 3, 2021
Copy link
Contributor

@fg-mindee fg-mindee left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Small modifications for the actual plotting and we're good to go!

test/test_utils.py Outdated Show resolved Hide resolved
doctr/utils/visualization.py Show resolved Hide resolved
doctr/utils/visualization.py Outdated Show resolved Hide resolved
Copy link
Contributor

@fg-mindee fg-mindee left a comment

Choose a reason for hiding this comment

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

I added a fix suggestion, could you test it locally before pushing?

pages = _mock_pages()
images = [np.ones((300, 200, 3)), np.ones((500, 1000, 3))]
for image, page in zip(images, pages):
utils.visualize_page(page, image)
Copy link
Contributor

Choose a reason for hiding this comment

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

utils.visualization.visualize_page(page, image) I guess

Copy link
Contributor

@fg-mindee fg-mindee left a comment

Choose a reason for hiding this comment

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

Thanks for the edits!

@charlesmindee charlesmindee merged commit 54731e5 into main Feb 4, 2021
@charlesmindee charlesmindee deleted the design_plot branch February 4, 2021 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: utils Related to doctr.utils
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[utils] Add visualization utilities
2 participants