Skip to content

Commit

Permalink
Merge pull request #275 from tink2123/rever_interpolate
Browse files Browse the repository at this point in the history
revert interpolate type
  • Loading branch information
LDOUBLEV committed Jun 30, 2020
2 parents 1bcfd9f + 25f16f2 commit 36964d0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tools/infer/predict_rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ def __init__(self, args):
self.character_type = args.rec_char_type
self.rec_batch_num = args.rec_batch_num
self.rec_algorithm = args.rec_algorithm
char_ops_params = {"character_type": args.rec_char_type,
"character_dict_path": args.rec_char_dict_path}
char_ops_params = {
"character_type": args.rec_char_type,
"character_dict_path": args.rec_char_dict_path
}
if self.rec_algorithm != "RARE":
char_ops_params['loss_type'] = 'ctc'
self.loss_type = 'ctc'
Expand All @@ -58,7 +60,7 @@ def resize_norm_img(self, img, max_wh_ratio):
resized_w = imgW
else:
resized_w = int(math.ceil(imgH * ratio))
resized_image = cv2.resize(img, (resized_w, imgH), interpolation=cv2.INTER_CUBIC)
resized_image = cv2.resize(img, (resized_w, imgH))
resized_image = resized_image.astype('float32')
resized_image = resized_image.transpose((2, 0, 1)) / 255
resized_image -= 0.5
Expand Down Expand Up @@ -91,7 +93,8 @@ def __call__(self, img_list):
max_wh_ratio = max(max_wh_ratio, wh_ratio)
for ino in range(beg_img_no, end_img_no):
# norm_img = self.resize_norm_img(img_list[ino], max_wh_ratio)
norm_img = self.resize_norm_img(img_list[indices[ino]], max_wh_ratio)
norm_img = self.resize_norm_img(img_list[indices[ino]],
max_wh_ratio)
norm_img = norm_img[np.newaxis, :]
norm_img_batch.append(norm_img)
norm_img_batch = np.concatenate(norm_img_batch)
Expand Down

0 comments on commit 36964d0

Please sign in to comment.