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

Fixing the rotating bbox issue #250

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

LeoLee7
Copy link

@LeoLee7 LeoLee7 commented Nov 9, 2023

Related Issue

Fixes #{issue number}

Summary

  • [√ ] I have read CONTRIBUTING.md to understand how to contribute to this repository :)

I fix the bbox rotation issue. The bugs are:

  1. Rotation matrix initialization
  2. Coordinate translation for rotated image (making left up point as (0,0))
  3. Coordinate translation for cropped image (making left up point as (0,0)

Previous failure case:

Test case after fixing

Unit Tests

If your changes touch the audio module, please run all of the audio tests and paste the output here. Likewise for image, text, & video. If your changes could affect behavior in multiple modules, please run the tests for all potentially affected modules. If you are unsure of which modules might be affected by your changes, please just run all the unit tests.

I had a fail in image test.

.................s..../pvcvolume/AugLy/augly/image/utils/utils.py:62: ResourceWarning: unclosed file <_io.BufferedReader name='/pvcvolume/AugLy/augly/assets/screenshot_templates/bboxes.json'>
return json.load(open(local_bbox_path, "rb"))
ResourceWarning: Enable tracemalloc to get the object allocation traceback
..s../pvcvolume/AugLy/augly/image/utils/utils.py:205: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
A = np.matrix(matrix, dtype=float)
/opt/conda/lib/python3.11/site-packages/numpy/matrixlib/defmatrix.py:69: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
return matrix(data, dtype=dtype, copy=False)
............./pvcvolume/AugLy/augly/tests/image_tests/base_unit_test.py:85: ResourceWarning: unclosed file <_io.BufferedReader name='/pvcvolume/AugLy/augly/tests/assets/image/inputs/dfdc_1.jpg'>
cls.img = Image.open(cls.local_img_path)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
................s..../pvcvolume/AugLy/augly/image/utils/metadata.py:222: ResourceWarning: unclosed file <_io.BufferedReader name='/pvcvolume/AugLy/augly/assets/screenshot_templates/web.png'>
metadata[-1]["intensity"] = getattr(
ResourceWarning: Enable tracemalloc to get the object allocation traceback
..s../pvcvolume/AugLy/augly/image/utils/bboxes.py:301: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
A = np.matrix(a, dtype=float)
.....s....F/opt/conda/lib/python3.11/unittest/case.py:622: ResourceWarning: unclosed file <_io.BufferedReader name='/pvcvolume/AugLy/augly/tests/assets/image/dfdc_expected_output/test_rotate.png'>
with outcome.testPartExecutor(self):
ResourceWarning: Enable tracemalloc to get the object allocation traceback
.......
======================================================================
FAIL: test_Rotate (transforms_unit_test.TransformsImageUnitTest.test_Rotate)


Traceback (most recent call last):
File "/pvcvolume/AugLy/augly/tests/image_tests/transforms_unit_test.py", line 194, in test_Rotate
self.evaluate_class(imaugs.Rotate(), fname="rotate")
...
Ran 84 tests in 44.236s
FAILED (failures=1, skipped=5)
sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='/pvcvolume/AugLy/augly/tests/assets/image/inputs/dfdc_1.jpg'>

Other testing

I can run it on my own test cases. But I'm not sure why it can not pass the rotation unit test. Please let me know if I'm wrong. Thanks!

1. change the initialization of transform matrix with degree
2. change the coordinate translation process
fix the cropping issue
Now we can test the alignment of bbox and image with rotation degree 90, 270, or 360
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants