Skip to content

Commit 60fc122

Browse files
committed
update np.int32 and np.float32
1 parent 4c0eaa4 commit 60fc122

59 files changed

Lines changed: 184 additions & 184 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

alignment/coordinate_reg/image_infer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
color = (200, 160, 75)
1616
for face in faces:
1717
lmk = face.landmark_2d_106
18-
lmk = np.round(lmk).astype(np.int)
18+
lmk = np.round(lmk).astype(np.int32)
1919
for i in range(lmk.shape[0]):
2020
p = tuple(lmk[i])
2121
cv2.circle(tim, p, 1, color, 1, cv2.LINE_AA)

alignment/heatmap/metric.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def cal_nme(self, label, pred_label):
5151
ind_gt = np.array(ind_gt)
5252
else:
5353
ind_gt = label[b][p]
54-
#ind_gt = ind_gt.astype(np.int)
54+
#ind_gt = ind_gt.astype(np.int32)
5555
#print(ind_gt)
5656
heatmap_pred = pred_label[b][p]
5757
heatmap_pred = cv2.resize(

alignment/synthetics/datasets/augs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def apply(self, image, border_size_limit, **params):
2424
border_size[2] *= image.shape[1]
2525
border_size[1] *= image.shape[0]
2626
border_size[3] *= image.shape[0]
27-
border_size = border_size.astype(np.int)
27+
border_size = border_size.astype(np.int32)
2828
image[:,:border_size[0],:] = self.fill_value
2929
image[:border_size[1],:,:] = self.fill_value
3030
image[:,-border_size[2]:,:] = self.fill_value

alignment/synthetics/test_synthetics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@
8585
outf.write(' ')
8686
outf.write(' '.join(["%.5f"%x for x in kps.flatten()]))
8787
outf.write("\n")
88-
box = bbox.astype(np.int)
88+
box = bbox.astype(np.int32)
8989
color = (0, 0, 255)
9090
cv2.rectangle(dimg, (box[0], box[1]), (box[2], box[3]), color, 2)
91-
kps = kps.astype(np.int)
91+
kps = kps.astype(np.int32)
9292
#print(landmark.shape)
9393
for l in range(kps.shape[0]):
9494
color = (0, 0, 255)

alignment/synthetics/tools/prepare_synthetics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@
4848
_scale = output_size / (max(w, h)*1.5)
4949
aimg, M = face_align.transform(dimg, center, output_size, _scale, rotate)
5050
pred = face_align.trans_points(pred, M)
51-
#box = bbox.astype(np.int)
51+
#box = bbox.astype(np.int32)
5252
#color = (0, 0, 255)
5353
#cv2.rectangle(dimg, (box[0], box[1]), (box[2], box[3]), color, 2)
5454

55-
#kps = pred.astype(np.int)
55+
#kps = pred.astype(np.int32)
5656
#for l in range(kps.shape[0]):
5757
# color = (0, 0, 255)
5858
# cv2.circle(aimg, (kps[l][0], kps[l][1]), 1, color, 2)

detection/retinaface/rcnn/PY_OP/cascade_refine.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ def assign_anchor_fpn(self,
127127
if gt_boxes.size > 0:
128128
# overlap between the anchors and the gt boxes
129129
# overlaps (ex, gt)
130-
overlaps = bbox_overlaps(anchors.astype(np.float),
131-
gt_boxes.astype(np.float))
130+
overlaps = bbox_overlaps(anchors.astype(np.float32),
131+
gt_boxes.astype(np.float32))
132132
argmax_overlaps = overlaps.argmax(axis=1)
133133
#print('AAA', argmax_overlaps.shape)
134134
max_overlaps = overlaps[np.arange(num_anchors), argmax_overlaps]
@@ -344,13 +344,13 @@ def forward(self, is_train, req, in_data, out_data, aux):
344344
assert anchors_t1.shape[0] == self.ori_anchors.shape[0]
345345

346346
#for i in range(_gt_boxes.shape[0]):
347-
# box = _gt_boxes[i].astype(np.int)
347+
# box = _gt_boxes[i].astype(np.int32)
348348
# print('%d: gt%d'%(self.nbatch, i), box)
349349
# #color = (0,0,255)
350350
# #cv2.rectangle(img, (box[0], box[1]), (box[2], box[3]), color, 2)
351351
#for i in range(anchors_t1.shape[0]):
352-
# box1 = self.ori_anchors[i].astype(np.int)
353-
# box2 = anchors_t1[i].astype(np.int)
352+
# box1 = self.ori_anchors[i].astype(np.int32)
353+
# box2 = anchors_t1[i].astype(np.int32)
354354
# print('%d %d: anchorscompare %d'%(self.nbatch, self.stride, i), box1, box2)
355355
#color = (255,255,0)
356356
#cv2.rectangle(img, (box[0], box[1]), (box[2], box[3]), color, 2)

detection/retinaface/rcnn/core/loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def get_batch(self):
247247
print('DEBUG SHAPE', data['data'].shape,
248248
label['gt_boxes'].shape)
249249

250-
box = label['gt_boxes'].copy()[0][0:4].astype(np.int)
250+
box = label['gt_boxes'].copy()[0][0:4].astype(np.int32)
251251
cv2.rectangle(img, (box[0], box[1]), (box[2], box[3]),
252252
(0, 255, 0), 2)
253253
filename = './debugout/%d.png' % (self._debug_id)

detection/retinaface/rcnn/core/tester.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ def test_proposals(predictor, test_data, imdb, roidb, vis=False):
238238
gt_boxes[:, 1] + 1)
239239
num_pos += gt_boxes.shape[0]
240240

241-
overlaps = bbox_overlaps(boxes.astype(np.float),
242-
gt_boxes.astype(np.float))
241+
overlaps = bbox_overlaps(boxes.astype(np.float32),
242+
gt_boxes.astype(np.float32))
243243
#print(im_info, gt_boxes.shape, boxes.shape, overlaps.shape, file=sys.stderr)
244244

245245
_gt_overlaps = np.zeros((gt_boxes.shape[0]))

detection/retinaface/rcnn/cython/bbox.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cimport cython
99
import numpy as np
1010
cimport numpy as np
1111

12-
DTYPE = np.float
12+
DTYPE = np.float32
1313
ctypedef np.float_t DTYPE_t
1414

1515
def bbox_overlaps_cython(

detection/retinaface/rcnn/cython/cpu_nms.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cdef inline np.float32_t max(np.float32_t a, np.float32_t b):
1414
cdef inline np.float32_t min(np.float32_t a, np.float32_t b):
1515
return a if a <= b else b
1616

17-
def cpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh):
17+
def cpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float32 thresh):
1818
cdef np.ndarray[np.float32_t, ndim=1] x1 = dets[:, 0]
1919
cdef np.ndarray[np.float32_t, ndim=1] y1 = dets[:, 1]
2020
cdef np.ndarray[np.float32_t, ndim=1] x2 = dets[:, 2]
@@ -26,7 +26,7 @@ def cpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh):
2626

2727
cdef int ndets = dets.shape[0]
2828
cdef np.ndarray[np.int_t, ndim=1] suppressed = \
29-
np.zeros((ndets), dtype=np.int)
29+
np.zeros((ndets), dtype=np.int32)
3030

3131
# nominal indices
3232
cdef int _i, _j

0 commit comments

Comments
 (0)