AugLy icon indicating copy to clipboard operation
AugLy copied to clipboard

Fixing the rotating bbox issue

Open LeoLee7 opened this issue 1 year ago • 0 comments

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!

LeoLee7 avatar Nov 09 '23 08:11 LeoLee7