Merge pull request #2105 from LDOUBLEV/cp20
[cherry-pick] PR2073 PR2091
This commit is contained in:
commit
76752b6084
|
@ -76,7 +76,7 @@ void CRNNRecognizer::Run(std::vector<std::vector<std::vector<int>>> boxes,
|
||||||
float(*std::max_element(&predict_batch[n * predict_shape[2]],
|
float(*std::max_element(&predict_batch[n * predict_shape[2]],
|
||||||
&predict_batch[(n + 1) * predict_shape[2]]));
|
&predict_batch[(n + 1) * predict_shape[2]]));
|
||||||
|
|
||||||
if (argmax_idx > 0 && (!(i > 0 && argmax_idx == last_index))) {
|
if (argmax_idx > 0 && (!(n > 0 && argmax_idx == last_index))) {
|
||||||
score += max_value;
|
score += max_value;
|
||||||
count += 1;
|
count += 1;
|
||||||
str_res.push_back(label_list_[argmax_idx]);
|
str_res.push_back(label_list_[argmax_idx]);
|
||||||
|
|
|
@ -32,7 +32,6 @@ class MakeShrinkMap(object):
|
||||||
text_polys, ignore_tags = self.validate_polygons(text_polys,
|
text_polys, ignore_tags = self.validate_polygons(text_polys,
|
||||||
ignore_tags, h, w)
|
ignore_tags, h, w)
|
||||||
gt = np.zeros((h, w), dtype=np.float32)
|
gt = np.zeros((h, w), dtype=np.float32)
|
||||||
# gt = np.zeros((1, h, w), dtype=np.float32)
|
|
||||||
mask = np.ones((h, w), dtype=np.float32)
|
mask = np.ones((h, w), dtype=np.float32)
|
||||||
for i in range(len(text_polys)):
|
for i in range(len(text_polys)):
|
||||||
polygon = text_polys[i]
|
polygon = text_polys[i]
|
||||||
|
@ -51,7 +50,8 @@ class MakeShrinkMap(object):
|
||||||
shrinked = []
|
shrinked = []
|
||||||
|
|
||||||
# Increase the shrink ratio every time we get multiple polygon returned back
|
# Increase the shrink ratio every time we get multiple polygon returned back
|
||||||
possible_ratios = np.arange(self.shrink_ratio, 1, self.shrink_ratio)
|
possible_ratios = np.arange(self.shrink_ratio, 1,
|
||||||
|
self.shrink_ratio)
|
||||||
np.append(possible_ratios, 1)
|
np.append(possible_ratios, 1)
|
||||||
# print(possible_ratios)
|
# print(possible_ratios)
|
||||||
for ratio in possible_ratios:
|
for ratio in possible_ratios:
|
||||||
|
|
|
@ -39,10 +39,7 @@ class TextDetector(object):
|
||||||
self.args = args
|
self.args = args
|
||||||
self.det_algorithm = args.det_algorithm
|
self.det_algorithm = args.det_algorithm
|
||||||
pre_process_list = [{
|
pre_process_list = [{
|
||||||
'DetResizeForTest': {
|
'DetResizeForTest': None
|
||||||
'limit_side_len': args.det_limit_side_len,
|
|
||||||
'limit_type': args.det_limit_type
|
|
||||||
}
|
|
||||||
}, {
|
}, {
|
||||||
'NormalizeImage': {
|
'NormalizeImage': {
|
||||||
'std': [0.229, 0.224, 0.225],
|
'std': [0.229, 0.224, 0.225],
|
||||||
|
|
|
@ -97,7 +97,7 @@ def main():
|
||||||
preds = model(images)
|
preds = model(images)
|
||||||
post_result = post_process_class(preds, shape_list)
|
post_result = post_process_class(preds, shape_list)
|
||||||
boxes = post_result[0]['points']
|
boxes = post_result[0]['points']
|
||||||
# write resule
|
# write result
|
||||||
dt_boxes_json = []
|
dt_boxes_json = []
|
||||||
for box in boxes:
|
for box in boxes:
|
||||||
tmp_json = {"transcription": ""}
|
tmp_json = {"transcription": ""}
|
||||||
|
|
Loading…
Reference in New Issue