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

Group G,Group D #3981

Merged
merged 14 commits into from
Jun 8, 2021
Merged

Group G,Group D #3981

merged 14 commits into from
Jun 8, 2021

Conversation

harishsdev
Copy link
Contributor

test_five_crop
test_ten_crop
test_max_value
test_linear_transformation
test_autoaugment
test_center_crop
test_center_crop_2
test_color_jitter

test_five_crop
test_ten_crop
test_max_value
test_linear_transformation
test_autoaugment
test_center_crop
test_center_crop_2
test_color_jitter
@harishsdev
Copy link
Contributor Author

PR for :#3945

@NicolasHug
Copy link
Member

Thanks @harishsdev , there are failures, some of theme being undefined names: https://app.circleci.com/pipelines/github/pytorch/vision/8695/workflows/230c01ae-5eaa-4a88-9d4e-e480d9be8dfc/jobs/631032

Did you manage to run the tests locally?

@harishsdev
Copy link
Contributor Author

@NicolasHug Thanks for your support,I'm able run tests in my local PC,I found no error there,

Please help to resolve below error

assertEqual(output_pil.size()[1:3], crop_size,
"image_size: {} crop_size: {}".format(input_image_size, crop_size))
E NameError: name 'assertEqual' is not defined

test/test_transforms.py:1948: NameError

@harishsdev
Copy link
Contributor Author

My doubt is how to write assertEqual for formating expression!

@NicolasHug
Copy link
Member

I'm able run tests in my local PC,I found no error there,

There's probably something wrong then because otherwise you would have gotten the same issue as above. did you run pytest test/test_transforms.py ?

My doubt is how to write assertEqual for formating expression!

you can juste write assert a == b, without an error message.

@harishsdev
Copy link
Contributor Author

one function is failing as per my observation

pytest test/test_transforms.py -vvv -k test_five_crop-passed
pytest test/test_transforms.py -vvv -k test_ten_crop-passed
pytest test/test_transforms.py -vvv -k test_linear_transformation-failed
pytest test/test_transforms.py -vvv -k test_autoaugment -passed
pytest test/test_transforms.py -vvv -k test_center_crop -passed
pytest test/test_transforms.py -vvv -k test_center_crop_2 -passed
pytest test/test_transforms.py -vvv -k test_color_jitter-passed

@harishsdev
Copy link
Contributor Author

Group G,Group D

PR for #3945

@harishsdev
Copy link
Contributor Author

@NicolasHug please give me inputs if any further modifications required

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @harishsdev , we can parametrize a bit further but this looks quite good already



def test_max_value():
for dtype in int_dtypes():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could parametrize over dtype here

to_pil_image = transforms.ToPILImage()
h = random.randint(5, 25)
w = random.randint(5, 25)
for single_dim in [True, False]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can parametrize over single_dim

crop_size_delta = [-2 * delta, -delta, 0, delta, 2 * delta]
crop_size_params = itertools.product(input_image_sizes, crop_size_delta, crop_size_delta)

for (input_image_size, delta_height, delta_width) in crop_size_params:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's parametrize over these 3 variables as well.

Comment on lines 1924 to 1925
even_image_size = (random.randint(10, 32) * 2, random.randint(10, 32) * 2)
odd_image_size = (even_image_size[0] + 1, even_image_size[1] + 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to parametrize over input_images_sizes and preserve the current logic, we can do something like:

@pytest.mark.parametrize('odd_size', (True, False))
def test_center_crop_2(odd_size, ...):
    input_image_size = (random.randint(10, 32) * 2, random.randint(10, 32) * 2)
    if odd_size:
        input_image_size = (input_image_size[0] + 1, input_image_size[1] + 1)

test/test_transforms.py Outdated Show resolved Hide resolved
@harishsdev
Copy link
Contributor Author

(myenv) PS D:\contrib\19283975\exp\vision> pytest test/test_transforms.py -vvv -k test_five_crop
==================================================== test session starts ====================================================
platform win32 -- Python 3.8.8, pytest-6.2.3, py-1.10.0, pluggy-0.13.1 -- G:\installconda\python.exe
cachedir: .pytest_cache
rootdir: D:\contrib\19283975\exp\vision
plugins: anyio-2.2.0
collected 0 items / 1 error

========================================================== ERRORS ===========================================================
_________________________________________ ERROR collecting test/test_transforms.py __________________________________________
test\test_transforms.py:25: in
from common_utils import cycle_over, int_dtypes, float_dtypes
test\common_utils.py:20: in
from _assert_utils import assert_equal
test_assert_utils.py:11: in
assert_equal = functools.partial(torch.testing.assert_close, rtol=0, atol=0)
E AttributeError: module 'torch.testing' has no attribute 'assert_close'
===================================================== warnings summary ======================================================
G:\installconda\lib\site-packages\pyreadline\py3k_compat.py:8
G:\installconda\lib\site-packages\pyreadline\py3k_compat.py:8: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
return isinstance(x, collections.Callable)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
================================================== short test summary info ==================================================
ERROR test/test_transforms.py - AttributeError: module 'torch.testing' has no attribute 'assert_close'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================ 1 warning, 1 error in 1.59s ================================================

@NicolasHug
Copy link
Member

I already replied to you about this issue here: #3975 (comment)

@harishsdev
Copy link
Contributor Author

@NicolasHug Looks like all the tests passed finally,Can you please help me to merge this change

@harishsdev harishsdev requested a review from NicolasHug June 7, 2021 18:54
@NicolasHug
Copy link
Member

Thanks @harishsdev , I took care of the prameterization of test_center_crop_2. I'll merge when green

@NicolasHug NicolasHug merged commit befbe1b into pytorch:master Jun 8, 2021
facebook-github-bot pushed a commit that referenced this pull request Jun 14, 2021
Reviewed By: fmassa

Differential Revision: D29097722

fbshipit-source-id: e3d32e0e95465aafd474ba300cf21e2b863ad320
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants