@@ -570,7 +570,7 @@ def __init__(
570570 x [:, 0 ] = 0
571571
572572 n = len (shapes ) # number of images
573- bi = np .floor (np .arange (n ) / batch_size ).astype (np .int ) # batch index
573+ bi = np .floor (np .arange (n ) / batch_size ).astype (np .int32 ) # batch index
574574 nb = bi [- 1 ] + 1 # number of batches
575575 self .batch = bi # batch index of image
576576 self .n = n
@@ -599,7 +599,7 @@ def __init__(
599599 shapes [i ] = [1 , 1 / mini ]
600600
601601 self .batch_shapes = (
602- np .ceil (np .array (shapes ) * img_size / stride + pad ).astype (np .int )
602+ np .ceil (np .array (shapes ) * img_size / stride + pad ).astype (np .int32 )
603603 * stride
604604 )
605605
@@ -965,7 +965,7 @@ def __init__(
965965 x [:, 0 ] = 0
966966
967967 n = len (shapes ) # number of images
968- bi = np .floor (np .arange (n ) / batch_size ).astype (np .int ) # batch index
968+ bi = np .floor (np .arange (n ) / batch_size ).astype (np .int32 ) # batch index
969969 nb = bi [- 1 ] + 1 # number of batches
970970 self .batch = bi # batch index of image
971971 self .n = n
@@ -994,7 +994,7 @@ def __init__(
994994 shapes [i ] = [1 , 1 / mini ]
995995
996996 self .batch_shapes = (
997- np .ceil (np .array (shapes ) * img_size / stride + pad ).astype (np .int )
997+ np .ceil (np .array (shapes ) * img_size / stride + pad ).astype (np .int32 )
998998 * stride
999999 )
10001000
@@ -1332,7 +1332,7 @@ def copy_paste(img, labels, segments, probability=0.5):
13321332 segments .append (np .concatenate ((w - s [:, 0 :1 ], s [:, 1 :2 ]), 1 ))
13331333 cv2 .drawContours (
13341334 im_new ,
1335- [segments [j ].astype (np .int )],
1335+ [segments [j ].astype (np .int32 )],
13361336 - 1 ,
13371337 (255 , 255 , 255 ),
13381338 cv2 .FILLED ,
@@ -1355,7 +1355,7 @@ def remove_background(img, labels, segments):
13551355 img_new = np .ones (img .shape , np .uint8 ) * 114
13561356 for j in range (n ):
13571357 cv2 .drawContours (
1358- im_new , [segments [j ].astype (np .int )], - 1 , (255 , 255 , 255 ), cv2 .FILLED
1358+ im_new , [segments [j ].astype (np .int32 )], - 1 , (255 , 255 , 255 ), cv2 .FILLED
13591359 )
13601360
13611361 result = cv2 .bitwise_and (src1 = img , src2 = im_new )
@@ -1392,7 +1392,7 @@ def sample_segments(img, labels, segments, probability=0.5):
13921392 mask = np .zeros (img .shape , np .uint8 )
13931393
13941394 cv2 .drawContours (
1395- mask , [segments [j ].astype (np .int )], - 1 , (255 , 255 , 255 ), cv2 .FILLED
1395+ mask , [segments [j ].astype (np .int32 )], - 1 , (255 , 255 , 255 ), cv2 .FILLED
13961396 )
13971397 sample_masks .append (mask [box [1 ] : box [3 ], box [0 ] : box [2 ], :])
13981398
@@ -1699,7 +1699,7 @@ def pastein(image, labels, sample_labels, sample_images, sample_masks):
16991699 r_image = cv2 .resize (sample_images [sel_ind ], (r_w , r_h ))
17001700 temp_crop = image [ymin : ymin + r_h , xmin : xmin + r_w ]
17011701 m_ind = r_mask > 0
1702- if m_ind .astype (np .int ).sum () > 60 :
1702+ if m_ind .astype (np .int32 ).sum () > 60 :
17031703 temp_crop [m_ind ] = r_image [m_ind ]
17041704 # print(sample_labels[sel_ind])
17051705 # print(sample_images[sel_ind].shape)
@@ -1809,7 +1809,7 @@ def extract_boxes(
18091809 b = x [1 :] * [w , h , w , h ] # box
18101810 # b[2:] = b[2:].max() # rectangle to square
18111811 b [2 :] = b [2 :] * 1.2 + 3 # pad
1812- b = xywh2xyxy (b .reshape (- 1 , 4 )).ravel ().astype (np .int )
1812+ b = xywh2xyxy (b .reshape (- 1 , 4 )).ravel ().astype (np .int32 )
18131813
18141814 b [[0 , 2 ]] = np .clip (b [[0 , 2 ]], 0 , w ) # clip boxes outside of image
18151815 b [[1 , 3 ]] = np .clip (b [[1 , 3 ]], 0 , h )
0 commit comments