@@ -116,15 +116,16 @@ def test_draw_boxes():
116116 assert_equal (img , img_cp )
117117
118118
119- def test_draw_boxes_dtypes ():
119+ @pytest .mark .parametrize ("fill" , [True , False ])
120+ def test_draw_boxes_dtypes (fill ):
120121 img_uint8 = torch .full ((3 , 100 , 100 ), 255 , dtype = torch .uint8 )
121- out_uint8 = utils .draw_bounding_boxes (img_uint8 , boxes )
122+ out_uint8 = utils .draw_bounding_boxes (img_uint8 , boxes , fill = fill )
122123
123124 assert img_uint8 is not out_uint8
124125 assert out_uint8 .dtype == torch .uint8
125126
126127 img_float = to_dtype (img_uint8 , torch .float , scale = True )
127- out_float = utils .draw_bounding_boxes (img_float , boxes )
128+ out_float = utils .draw_bounding_boxes (img_float , boxes , fill = fill )
128129
129130 assert img_float is not out_float
130131 assert out_float .is_floating_point ()
@@ -168,7 +169,6 @@ def test_draw_boxes_grayscale():
168169
169170def test_draw_invalid_boxes ():
170171 img_tp = ((1 , 1 , 1 ), (1 , 2 , 3 ))
171- img_wrong1 = torch .full ((3 , 5 , 5 ), 255 , dtype = torch .float )
172172 img_wrong2 = torch .full ((1 , 3 , 5 , 5 ), 255 , dtype = torch .uint8 )
173173 img_correct = torch .zeros ((3 , 10 , 10 ), dtype = torch .uint8 )
174174 boxes = torch .tensor ([[0 , 0 , 20 , 20 ], [0 , 0 , 0 , 0 ], [10 , 15 , 30 , 35 ], [23 , 35 , 93 , 95 ]], dtype = torch .float )
@@ -178,8 +178,6 @@ def test_draw_invalid_boxes():
178178
179179 with pytest .raises (TypeError , match = "Tensor expected" ):
180180 utils .draw_bounding_boxes (img_tp , boxes )
181- with pytest .raises (ValueError , match = "Tensor uint8 expected" ):
182- utils .draw_bounding_boxes (img_wrong1 , boxes )
183181 with pytest .raises (ValueError , match = "Pass individual images, not batches" ):
184182 utils .draw_bounding_boxes (img_wrong2 , boxes )
185183 with pytest .raises (ValueError , match = "Only grayscale and RGB images are supported" ):
0 commit comments