label-studio-ml-backend icon indicating copy to clipboard operation
label-studio-ml-backend copied to clipboard

fix: Apply exif_transpose

Open rick0000 opened this issue 1 year ago • 1 comments

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.

rick0000 avatar May 03 '24 06:05 rick0000

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!

niklub avatar May 06 '24 15:05 niklub

/jira create

sajarin avatar May 08 '24 19:05 sajarin

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?

rick0000 avatar May 12 '24 00:05 rick0000

Hi @niklub, I would be glad to know if there is something wrong with this PR !

rick0000 avatar May 27 '24 04:05 rick0000

@rick0000 thanks for your contribution, much appreaciated!

niklub avatar Jun 01 '24 09:06 niklub

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.

codecov-commenter avatar Jun 01 '24 10:06 codecov-commenter