1. 29 Jul, 2020 1 commit
  2. 17 Jul, 2020 1 commit
  3. 16 Jul, 2020 1 commit
    • vfdev's avatar
      Unified input for F.affine (#2444) · 5f4b5794
      vfdev authored
      * [WIP] F.affine
      
      * [WIP] F.affine + tests
      
      * Unified input for F.affine
      
      * Removed commented code
      
      * Removed unused imports
      5f4b5794
  4. 15 Jul, 2020 1 commit
  5. 08 Jul, 2020 1 commit
  6. 07 Jul, 2020 1 commit
    • vfdev's avatar
      Unified input for resized crop op (#2396) · 9b804659
      vfdev authored
      * [WIP] Unify random resized crop
      
      * Unify input for RandomResizedCrop
      
      * Fixed bugs and updated test
      
      * Added resized crop functional test
      - fixed bug with size convention
      
      * Fixed incoherent sampling
      
      * Fixed torch randint review remark
      9b804659
  7. 06 Jul, 2020 1 commit
    • vfdev's avatar
      Unified input for resize op (#2394) · e212cc86
      vfdev authored
      * [WIP] F.resize with tensor
      
      * Adapted T.Resize and F.resize with a test
      
      * According to the review, fixed copy-pasted messages and unused imports
      e212cc86
  8. 03 Jul, 2020 1 commit
  9. 30 Jun, 2020 2 commits
    • vfdev's avatar
      Improved docs and tests for (#2371) · e50c2e36
      vfdev authored
      - RandomCrop: crop with padding using all commonly supported modes
      e50c2e36
    • vfdev's avatar
      Unified Tensor/PIL crop (#2342) · a99b6bd7
      vfdev authored
      * [WIP] Unified Tensor/PIL crop
      
      * Fixed misplaced type annotation
      
      * Fixed tests
      - crop with padding
      - other tests using mising private functions: _is_pil_image, _get_image_size
      
      * Unified CenterCrop and F.center_crop
      - sorted includes in transforms.py
      - used py3 annotations
      
      * Unified FiveCrop and F.five_crop
      
      * Improved tests and docs
      
      * Unified TenCrop and F.ten_crop
      
      * Removed useless typing in functional_pil
      
      * Updated code according to the review
      - removed useless torch.jit.export
      - added missing typing return type
      - fixed F.F_pil._is_pil_image -> F._is_pil_image
      
      * Removed useless torch.jit.export
      
      * Improved code according to the review
      a99b6bd7
  10. 26 Jun, 2020 1 commit
  11. 19 Jun, 2020 1 commit
    • Vitaliy Chiley's avatar
      spelling error (#2333) · cd2b7f07
      Vitaliy Chiley authored
      I was reading through the code and noticed a few spelling errors
      orignal -> original
      maintaing -> maintaining
      cd2b7f07
  12. 11 Jun, 2020 1 commit
    • Philip Meier's avatar
      Add convert_image_dtype to functionals (#2078) · c2e8a008
      Philip Meier authored
      
      
      * add convert_image_dtype to functionals
      
      * add ConvertImageDtype transform
      
      * add test
      
      * remove underscores from numbers since they are not compatible with python<3.6
      
      * address review comments 1/3
      
      * fix torch.bool
      
      * use torch.iinfo in test
      
      * fix flake8
      
      * remove double conversion
      
      * fix flake9
      
      * bug fix
      
      * add error messages to test
      
      * disable torch.float16 and torch.half for now
      
      * add docstring
      
      * add test for consistency
      
      * move nested function to top
      
      * test in CI
      
      * dirty progress
      
      * add int to int and cleanup
      
      * lint
      Co-authored-by: default avatarPhilip Meier <meier.philip@posteo.de>
      c2e8a008
  13. 10 Jun, 2020 1 commit
  14. 04 Jun, 2020 2 commits
  15. 18 May, 2020 2 commits
    • Steven Basart's avatar
      Add pil_to_tensor to functionals (#2092) · e6d3f8c5
      Steven Basart authored
      * Adds as_tensor to functional.py
      
      Similar functionality to to_tensor without the default conversion to float and division by 255.
      Also adds support for Image mode 'L'.
      
      * Adds tests to AsTensor()
      
      Adds tests to AsTensor and removes the conversion to float and division by 255.
      
      * Adds AsTensor to transforms.py
      
      Calls the as_tensor function in functionals and adds the function AsTensor as callable from transforms.
      
      * Removes the pic.mode == 'L'
      
      This was handled by the else condition previously so I'll remove it.
      
      * Fix Lint issue
      
      Adds two line breaks between functions to fix lint issue
      
      * Replace from_numpy with as_tensor
      
      Removes the extra if conditionals and replaces from_numpy with as_tensor.
      
      * Renames as_tensor to pil_to_tensor
      
      Renames the function as_tensor to pil_to_tensor and narrows the scope of the function.  At the same time also creates a flag that defaults to True for swapping to the channels first format.
      
      * Renames AsTensor to PILToImage
      
      Renames the function AsTensor to PILToImage and modifies the description.  Adds the swap_to_channelsfirst boolean variable to indicate if the user wishes to change the shape of the input.
      
      * Add the __init__ function to PILToTensor 
      
      Add the __init__ function to PILToTensor since it contains the swap_to_channelsfirst parameter now.
      
      * fix lint issue
      
      remove trailing white space
      
      * Fix the tests
      
      Reflects the name change to PILToTensor and the parameter to the function as well as the new narrowed scope that the function only accepts PIL images.
      
      * fix tests
      
      Instead of undoing the transpose just create a new tensor and test that one.
      
      * Add the view back
      
      Add img.view(pic.size[1], pic.size[0], len(pic.getbands())) back to outside the if condition.
      
      * fix test
      
      fix conversion from torch tensor to PIL back to torch tensor.
      
      * fix lint issues
      
      * fix lint
      
      remove trailing white space
      
      * Fixed the channel swapping tensor test
      
      Torch tranpose operates differently than numpy transpose.  Changed operation to permute.
      
      * Add mode='F'
      
      Add mode information when converting to PIL Image from Float Tensor.
      
      * Added inline comments to follow shape changes
      
      * ToPILImage converts FloatTensors to uint8
      
      * Remove testing not swapping
      
      * Removes the swap_channelsfirst parameter
      
      Makes the channel swapping the default behavior.
      
      * Remove the swap_channelsfirst argument
      
      Remove the swap_channelsfirst argument and makes the swapping the default functionality.
      e6d3f8c5
    • Francisco Massa's avatar
      Fix Python lint (#2226) · e2e511be
      Francisco Massa authored
      e2e511be
  16. 04 May, 2020 1 commit
  17. 03 Apr, 2020 1 commit
  18. 02 Apr, 2020 1 commit
  19. 01 Apr, 2020 2 commits
  20. 31 Mar, 2020 1 commit
  21. 30 Mar, 2020 1 commit
  22. 23 Mar, 2020 2 commits
  23. 27 Feb, 2020 1 commit
  24. 25 Feb, 2020 1 commit
    • Phoenix Meadowlark's avatar
      Improved error messages for transforms.functional.normalize(). (#1915) · 2f433e0a
      Phoenix Meadowlark authored
      * Improved error messages for transforms.functional.normalize().
      
      Split the original TypeError into 1. a TypeError if `tensor` is not a torch.Tensor and 2. a ValueError if `tensor` does not have the correct dimensionality.
      
      Added more detail to the error for when `tensor` has the wrong dimension to make it easier to diagnose. This is useful when this function isn't called directly by the user (e.g. when the user uses transforms.Normalize and can't directly see this functions doc string).
      
      Deleted hanging function `_is_tensor_image()`. It isn't used in this file and isn't used internally anywhere else in torchvision that I can see. (Some users will have used it despite the underscore prefix, but a quick google search for "F._is_tensor_image" suggests this is rare).
      
      * Value checking to prevent division by zero runtime crashes.
      
      Added a ValueError to check for and avoid division by zero in `div_`. Not preventing the call leads to runtime crashes, at least in some environments.
      
      * Fixed div by zero check for non-scalar inputs.
      2f433e0a
  25. 29 Jan, 2020 1 commit
  26. 22 Jan, 2020 2 commits
  27. 29 Oct, 2019 1 commit
    • pedrofreire's avatar
      Make shear operation area preserving (#1529) · c226bb95
      pedrofreire authored
      * Improve readability of affine transformation code
      
      * Make shear transformation area preserving
      
      The previous shear implementation did not preserve area, and we
      implement a version that does.
      
      The formula used was verified with the following sympy code:
      
      from sympy import Matrix, cos, sin, tan, simplify
      from sympy.abc import x, y, phi
      
      Xs = Matrix(
              [[1, -tan(x)],
               [0, 1]]
              )
      
      Ys = Matrix(
              [[1, 0],
               [-tan(y), 1]]
              )
      
      R = Matrix(
              [[cos(phi), -sin(phi)],
               [sin(phi), cos(phi)]]
              )
      
      RSS = Matrix(
              [[cos(phi - y)/cos(y), -cos(phi - y)*tan(x)/cos(y) - sin(phi)],
               [sin(phi - y)/cos(y), -sin(phi - y)*tan(x)/cos(y) + cos(phi)]])
      
      print(simplify(R * Ys * Xs - RSS))
      
      One thing that is not clear (and could be tested) is whether avoiding
      the explicit products and calculations in _get_inverse_affine_matrix
      really gives performance benefits - compared to doing the explicit
      calculation done in _test_transformation.
      
      * Use np.matmul instead of @
      
      The @ syntax is not supported in Python 2.
      c226bb95
  28. 18 Oct, 2019 1 commit
  29. 30 Sep, 2019 1 commit
  30. 11 Sep, 2019 1 commit
  31. 06 Sep, 2019 1 commit
  32. 09 Jul, 2019 1 commit
  33. 06 Jul, 2019 1 commit
    • Zhun Zhong's avatar
      Fix bug to RandomErasing (#1095) · 34833427
      Zhun Zhong authored
      * Fix bug to Random Erasing
      
      1. Avoid forever loop for getting parameters of erase.
      2. replace' img_b' by 'img_c', because it indicates the channel.
      3. replace v = torch.rand([img_c, h, w]) by v = torch.empty([img_c, h, w], dtype=torch.float32).normal_(). Normally distributed achieves better performance.
      
      * add test
      
      * Update test_transforms.py
      
      * Update transforms.py
      
      * Update test_transforms.py
      
      * Update transforms.py
      
      * Update functional.py
      34833427
  34. 03 Jul, 2019 1 commit