@@ -116,18 +116,16 @@ def test_crop_orientation_model(mock_text_box):
116
116
117
117
118
118
def test_page_orientation_model (mock_payslip ):
119
- image_rot_0 = cv2 .imread (mock_payslip )
119
+ text_box_0 = cv2 .imread (mock_payslip )
120
120
# rotates counter-clockwise
121
- image_rot_90 = np .rot90 (image_rot_0 , 3 )
122
- image_rot_180 = np .rot90 (image_rot_0 , 2 )
123
- image_rot_270 = np .rot90 (image_rot_0 , 1 )
124
- classifier = classification .page_orientation_predictor ("mobilenet_v3_small_page_orientation" , pretrained = True )
125
- assert classifier ([image_rot_0 , image_rot_270 , image_rot_180 , image_rot_90 ])[0 ] == [0 , 1 , 2 , 3 ]
121
+ text_box_270 = np .rot90 (text_box_0 , 1 )
122
+ text_box_180 = np .rot90 (text_box_0 , 2 )
123
+ text_box_90 = np .rot90 (text_box_0 , 3 )
124
+ classifier = classification .crop_orientation_predictor ("mobilenet_v3_small_page_orientation" , pretrained = True )
125
+ assert classifier ([text_box_0 , text_box_270 , text_box_180 , text_box_90 ])[0 ] == [0 , 1 , 2 , 3 ]
126
126
# 270 degrees is equivalent to -90 degrees
127
- assert classifier ([image_rot_0 , image_rot_270 , image_rot_180 , image_rot_90 ])[1 ] == [0 , - 90 , 180 , 90 ]
128
- assert all (
129
- isinstance (pred , float ) for pred in classifier ([image_rot_0 , image_rot_270 , image_rot_180 , image_rot_90 ])[2 ]
130
- )
127
+ assert classifier ([text_box_0 , text_box_270 , text_box_180 , text_box_90 ])[1 ] == [0 , - 90 , 180 , 90 ]
128
+ assert all (isinstance (pred , float ) for pred in classifier ([text_box_0 , text_box_270 , text_box_180 , text_box_90 ])[2 ])
131
129
132
130
133
131
# temporarily fix to avoid killing the CI (tf2onnx v1.14 memory leak issue)
0 commit comments