66from torchvision .transforms .functional import (_get_perspective_coeffs ,
77 to_tensor )
88
9- from .model import WPODNet
9+ from .. model import WPODNet
1010
1111
1212class Prediction :
@@ -34,7 +34,8 @@ def annotate(self, outline: str = 'red', width: int = 3) -> Image.Image:
3434 def warp (self , width : int = 208 , height : int = 60 ) -> Image .Image :
3535 # Get the perspective matrix
3636 coeffs = self ._get_perspective_coeffs (width , height )
37- warped = self .image .transform ((width , height ), Image .PERSPECTIVE , coeffs )
37+ warped = self .image .transform (
38+ (width , height ), Image .PERSPECTIVE , coeffs )
3839 return warped
3940
4041
@@ -99,7 +100,8 @@ def _get_bounds(self, affines: np.ndarray, anchor_y: int, anchor_x: int, scaling
99100 theta [1 , 1 ] = max (theta [1 , 1 ], 0.0 )
100101
101102 # Convert theta into the bounding polygon
102- bounds = np .matmul (theta , self ._q ) * self ._scaling_const * scaling_ratio
103+ bounds = np .matmul (theta , self ._q ) * \
104+ self ._scaling_const * scaling_ratio
103105
104106 # Normalize the bounds
105107 _ , grid_h , grid_w = affines .shape
@@ -113,7 +115,8 @@ def predict(self, image: Image.Image, scaling_ratio: float = 1.0, dim_min: int =
113115
114116 # Resize the image to fixed ratio
115117 # This operation is convienence for setup the anchors
116- resized = self ._resize_to_fixed_ratio (image , dim_min = dim_min , dim_max = dim_max )
118+ resized = self ._resize_to_fixed_ratio (
119+ image , dim_min = dim_min , dim_max = dim_max )
117120 resized = self ._to_torch_image (resized )
118121 resized = resized .to (self .wpodnet .device )
119122
0 commit comments