Skip to content

Commit 06648ed

Browse files
authored
fix attribute error numpy.int (#3655)
1 parent c03cafa commit 06648ed

File tree

10 files changed

+16
-17
lines changed

10 files changed

+16
-17
lines changed

demos/image_inpainting_demo/python/image_inpainting_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def create_random_mask(parts, max_vertex, max_length, max_brush_width, h, w, max
7878
next_y = start_y + length * np.cos(angle)
7979
next_x = start_x + length * np.sin(angle)
8080

81-
next_y = np.clip(next_y, 0, h - 1).astype(np.int)
82-
next_x = np.clip(next_x, 0, w - 1).astype(np.int)
81+
next_y = np.clip(next_y, 0, h - 1).astype(np.int32)
82+
next_x = np.clip(next_x, 0, w - 1).astype(np.int32)
8383
cv2.line(mask, (start_y, start_x), (next_y, next_x), 1, brush_width)
8484
cv2.circle(mask, (start_y, start_x), brush_width // 2, 1)
8585

demos/image_translation_demo/python/image_translation_demo/preprocessing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
def scatter(source, classes, axis=1, base=0, value=1):
1919
shape = [1, 1, *source.shape]
2020
shape[axis] = classes
21-
label_map = np.full(shape, base, np.int)
21+
label_map = np.full(shape, base, np.int32)
2222
ndim = len(shape)
2323
expanded_index = []
2424
for i in range(ndim):

tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/text_detection.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def get_valid_y(y_coord):
131131

132132
rect = ((rect[0], rect[1]), (rect[2], rect[3]), rect[4])
133133
points = cv2.boxPoints(rect)
134-
points = points.astype(np.int0)
134+
points = points.astype(np.intp)
135135
for i_xy, (x_coord, y_coord) in enumerate(points):
136136
x_coord = get_valid_x(x_coord)
137137
y_coord = get_valid_y(y_coord)
@@ -677,10 +677,10 @@ def get_mini_boxes(contour):
677677
def box_score_fast(bitmap, _box):
678678
h, w = bitmap.shape[:2]
679679
box = _box.copy()
680-
xmin = np.clip(np.floor(box[:, 0].min()).astype(np.int), 0, w - 1)
681-
xmax = np.clip(np.ceil(box[:, 0].max()).astype(np.int), 0, w - 1)
682-
ymin = np.clip(np.floor(box[:, 1].min()).astype(np.int), 0, h - 1)
683-
ymax = np.clip(np.ceil(box[:, 1].max()).astype(np.int), 0, h - 1)
680+
xmin = np.clip(np.floor(box[:, 0].min()).astype(np.int32), 0, w - 1)
681+
xmax = np.clip(np.ceil(box[:, 0].max()).astype(np.int32), 0, w - 1)
682+
ymin = np.clip(np.floor(box[:, 1].min()).astype(np.int32), 0, h - 1)
683+
ymax = np.clip(np.ceil(box[:, 1].max()).astype(np.int32), 0, h - 1)
684684
mask = np.zeros((ymax - ymin + 1, xmax - xmin + 1), dtype=np.uint8)
685685
box[:, 0] = box[:, 0] - xmin
686686
box[:, 1] = box[:, 1] - ymin

tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/imagenet.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"""
1616

1717
from pathlib import Path
18-
import numpy as np
1918

2019
from ..config import PathField, BoolField
2120
from ..representation import ClassificationAnnotation
@@ -71,7 +70,7 @@ def convert(self, check_content=False, progress_callback=None, progress_interval
7170
if not check_file_existence(self.images_dir / image_name):
7271
content_errors.append('{}: does not exist'.format(self.images_dir / image_name))
7372

74-
label = np.int64(label) if not self.has_background else np.int64(label) + 1
73+
label = int(label) if not self.has_background else int(label) + 1
7574
annotation.append(ClassificationAnnotation(image_name, label))
7675
if progress_callback is not None and image_id % progress_interval == 0:
7776
progress_callback(image_id / num_iterations * 100)

tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/asr_encoder_prediction_joint_evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def predict(self, identifiers, input_data, callback=None):
358358
class EncoderONNXModel(CommonONNXModel):
359359
def fit_to_input(self, input_data):
360360
frames, _, _ = input_data.shape
361-
return {self.input_blob.name: input_data, '1': np.array([frames], dtype=np.int64)}
361+
return {self.input_blob.name: input_data, '1': np.array([frames], dtype=int)}
362362

363363

364364
class PredictionONNXModel(CommonONNXModel):

tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/input_feeder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
'I8': np.int8, # signed char
6969
'I16': np.int16, # signed short
7070
'I32': np.int32, # signed int
71-
'I64': np.int64, # signed long int
71+
'I64': int, # signed long int
7272
'STR': str, # string'
7373
'BOOL': bool,
7474
'f32': np.float32,

tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/openvino_launcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747

4848
format_map = {
49-
'f32': np.float32, 'i32': np.int32, 'i64': np.int64,
49+
'f32': np.float32, 'i32': np.int32, 'i64': int,
5050
'fp16': np.float16, 'f16': np.float16, 'i16': np.int16, 'u16': np.uint16,
5151
'i8': np.int8, 'u8': np.uint8, 'boolean': np.uint8
5252
}

tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/background_matting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def gauss_gradient(self, img):
118118

119119
def gauss_filter(self, sigma, epsilon=1e-2):
120120
half_size = np.ceil(sigma * np.sqrt(-2 * np.log(np.sqrt(2 * np.pi) * sigma * epsilon)))
121-
size = np.int(2 * half_size + 1)
121+
size = np.int32(2 * half_size + 1)
122122
# create filter in x axis
123123
filter_x = np.zeros((size, size))
124124
for i in range(size):

tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/inpainting_preprocessor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def _free_form_mask(mask, max_vertex, max_length, max_brush_width, h, w, max_ang
6868
next_y = start_y + length * np.cos(angle)
6969
next_x = start_x + length * np.sin(angle)
7070

71-
next_y = np.clip(next_y, 0, h - 1).astype(np.int)
72-
next_x = np.clip(next_x, 0, w - 1).astype(np.int)
71+
next_y = np.clip(next_y, 0, h - 1).astype(np.int32)
72+
next_x = np.clip(next_x, 0, w - 1).astype(np.int32)
7373
cv2.line(mask, (start_y, start_x), (next_y, next_x), 1, brush_width)
7474
cv2.circle(mask, (start_y, start_x), brush_width // 2, 1)
7575

tools/accuracy_checker/openvino/tools/accuracy_checker/preprocessor/one_hot_encoding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def process_data(data, classes, axis, value, base):
6262
shapes = list(data.shape)
6363
ndim = len(shapes)
6464
shapes[axis] = classes
65-
base_arr = np.full(shapes, base, np.int)
65+
base_arr = np.full(shapes, base, np.int32)
6666
expanded_index = []
6767
for i in range(ndim):
6868
arr = (data if axis == i

0 commit comments

Comments
 (0)