hityzy1122 / opencv_transforms_torchvision

opencv reimplement for transforms in torchvision
MIT License
193 stars 29 forks source link

repair incompatibility with deep reference and borken changed above p… #23

Closed hongchu098 closed 2 years ago

hongchu098 commented 2 years ago
  1. When "cvtorchvision" folder is not in the default search path, e.g., not in the top-level folder of the project, directly import like "from cvtorchvision import cvtransforms" will throw an error. This PR will repair it by using relative import like "from . import cvtransforms".
  2. According to the offical Python documentation (https://docs.python.org/3.9/library/collections.html) , Collections Abstract Base Classes in "collections" module has been moved to "collections.abc" module since version 3.3, and it is deleted completely in "collections" module at version 3.10 and later. So the current code will throw an error while running the latest Python. This PR propose a workaround by "import collections.abc as collections" instead, which is not beautiful but works.