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

Auto-rotate images if necessary #971

Open
raphael0202 opened this issue Oct 24, 2022 · 1 comment
Open

Auto-rotate images if necessary #971

raphael0202 opened this issue Oct 24, 2022 · 1 comment

Comments

@raphael0202
Copy link
Collaborator

Some images that contributors send us are not correctly oriented (they may be rotated to the left, to the right or top-down).
Using Google Cloud Vision, we store the orientation of each detected word (up, right, down, left) as a prediction, in the prediction DB table, with the image_orientation type.
prediction.data has the following structure:

{"count":{"up":4,"left":1,"right":18},"rotation":270,"orientation":"right"}

The count field gives you how many words were correctly oriented ("up"), left-oriented ("left"), right-oriented ("right"), or flipped ("down").
The orientation with the highest count determines the values for the remaining fields:

  • orientation gives you the predicted image orientation
  • rotation gives you the rotation to apply to get a correctly oriented image

We would like to automatically rotate incorrectly-rotated images if we're confident enough that the rotation is incorrect:

  • predicted orientation is not up
  • fraction of words with the predicted orientation >= 0.95

Steps

  • Create a ImageOrientationImporter class in importer.py to import them as insights
  • Add annotator in annotate.py
@raphael0202 raphael0202 added ✨ enhancement New feature or request 🎯 P0 ⭐ top feature Top feature request. labels Oct 24, 2022
@teolemon
Copy link
Member

teolemon commented Oct 24, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants