fix: Apply exif_transpose
issue: https://github.com/HumanSignal/label-studio-ml-backend/issues/535
In this PR, I have integrated the ImageOps.exif_transpose() function into the ml-backend examples that load images using Pillow. This change resolves the discrepancy between the orientation of images in Label Studio and their orientation in the ml-backend.
Note on Testing: As discussed here, it seems preferable to store the test images in a location separate from the existing tests. I had initially planned to include tests for this feature. However, I was unable to identify a suitable repository location for storing the test images, and as a result, no tests have been added at this time. I would greatly appreciate any suggestions regarding appropriate locations to store these files, as this would enable me to proceed with implementing the necessary tests.
Hello, @rick0000 ! Nice catch on the bug, and thanks a lot for your contribution! Regarding the test - to assist you with nailing down this patch with the right test, here is the change introduced to the testing with image URLS: https://github.com/HumanSignal/label-studio-ml-backend/blob/master/label_studio_ml/examples/easyocr/test_api.py#L48
Namely, patch the image URL with the response library and return the binary content as in the example above. Use test_data dir inside the directory to put testing images into it, and don't forget to include this directory in .dockerignore file.
Hope that helps!
/jira create
Hello, @niklub ! Thank you very much for providing detailed examples and key points to consider regarding the handling of test files! Your guidance was immensely helpful. I have added some tests, could you please take a moment to review them?
Hi @niklub, I would be glad to know if there is something wrong with this PR !
@rick0000 thanks for your contribution, much appreaciated!
Codecov Report
Attention: Patch coverage is 81.81818% with 2 lines in your changes are missing coverage. Please review.
Project coverage is 47.02%. Comparing base (
17e0932) to head (60fa129). Report is 6 commits behind head on master.
| Files | Patch % | Lines |
|---|---|---|
| label_studio_ml/examples/llm_interactive/model.py | 50.00% | 1 Missing :warning: |
| label_studio_ml/examples/tesseract/tesseract.py | 88.88% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #536 +/- ##
==========================================
- Coverage 49.71% 47.02% -2.70%
==========================================
Files 40 15 -25
Lines 2669 940 -1729
==========================================
- Hits 1327 442 -885
+ Misses 1342 498 -844
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.