提交 c5b040b3 编写于 作者: qq_25193841's avatar qq_25193841

Merge remote-tracking branch 'origin/dygraph' into dygraph

...@@ -624,6 +624,13 @@ class Canvas(QWidget): ...@@ -624,6 +624,13 @@ class Canvas(QWidget):
pal.setColor(self.backgroundRole(), QColor(232, 232, 232, 255)) pal.setColor(self.backgroundRole(), QColor(232, 232, 232, 255))
self.setPalette(pal) self.setPalette(pal)
# adaptive BBOX label & index font size
if self.pixmap:
h, w = self.pixmap.size().height(), self.pixmap.size().width()
fontszie = int(max(h, w) / 48)
for s in self.shapes:
s.fontsize = fontszie
p.end() p.end()
def fillDrawing(self): def fillDrawing(self):
......
...@@ -66,6 +66,7 @@ class Shape(object): ...@@ -66,6 +66,7 @@ class Shape(object):
self.NEAR_VERTEX: (4, self.P_ROUND), self.NEAR_VERTEX: (4, self.P_ROUND),
self.MOVE_VERTEX: (1.5, self.P_SQUARE), self.MOVE_VERTEX: (1.5, self.P_SQUARE),
} }
self.fontsize = 8
self._closed = False self._closed = False
...@@ -156,7 +157,7 @@ class Shape(object): ...@@ -156,7 +157,7 @@ class Shape(object):
min_y = min(min_y, point.y()) min_y = min(min_y, point.y())
if min_x != sys.maxsize and min_y != sys.maxsize: if min_x != sys.maxsize and min_y != sys.maxsize:
font = QFont() font = QFont()
font.setPointSize(8) font.setPointSize(self.fontsize)
font.setBold(True) font.setBold(True)
painter.setFont(font) painter.setFont(font)
if self.label is None: if self.label is None:
...@@ -174,7 +175,7 @@ class Shape(object): ...@@ -174,7 +175,7 @@ class Shape(object):
min_y = min(min_y, point.y()) min_y = min(min_y, point.y())
if min_x != sys.maxsize and min_y != sys.maxsize: if min_x != sys.maxsize and min_y != sys.maxsize:
font = QFont() font = QFont()
font.setPointSize(8) font.setPointSize(self.fontsize)
font.setBold(True) font.setBold(True)
painter.setFont(font) painter.setFont(font)
text = '' text = ''
......
...@@ -8,7 +8,7 @@ Global: ...@@ -8,7 +8,7 @@ Global:
# evaluation is run every 2000 iterations # evaluation is run every 2000 iterations
eval_batch_step: [0, 2000] eval_batch_step: [0, 2000]
cal_metric_during_train: True cal_metric_during_train: True
pretrained_model: pretrained_model: ./pretrain_models/abinet_vl_pretrained
checkpoints: checkpoints:
save_inference_dir: save_inference_dir:
use_visualdl: False use_visualdl: False
......
...@@ -81,7 +81,7 @@ Train: ...@@ -81,7 +81,7 @@ Train:
Eval: Eval:
dataset: dataset:
name: LMDBDataSet name: LMDBDataSet
data_dir: ./train_data/data_lmdb_release/evaluaiton/ data_dir: ./train_data/data_lmdb_release/evaluation/
transforms: transforms:
- DecodeImage: # load image - DecodeImage: # load image
img_mode: BGR img_mode: BGR
......
...@@ -129,11 +129,25 @@ class TableSystem(object): ...@@ -129,11 +129,25 @@ class TableSystem(object):
def rebuild_table(self, structure_res, dt_boxes, rec_res): def rebuild_table(self, structure_res, dt_boxes, rec_res):
pred_structures, pred_bboxes = structure_res pred_structures, pred_bboxes = structure_res
dt_boxes, rec_res = self.filter_ocr_result(pred_bboxes,dt_boxes, rec_res)
matched_index = self.match_result(dt_boxes, pred_bboxes) matched_index = self.match_result(dt_boxes, pred_bboxes)
pred_html, pred = self.get_pred_html(pred_structures, matched_index, pred_html, pred = self.get_pred_html(pred_structures, matched_index,
rec_res) rec_res)
return pred_html, pred return pred_html, pred
def filter_ocr_result(self, pred_bboxes,dt_boxes, rec_res):
y1 = pred_bboxes[:,1::2].min()
new_dt_boxes = []
new_rec_res = []
for box,rec in zip(dt_boxes, rec_res):
if np.max(box[1::2]) < y1:
continue
new_dt_boxes.append(box)
new_rec_res.append(rec)
return new_dt_boxes, new_rec_res
def match_result(self, dt_boxes, pred_bboxes): def match_result(self, dt_boxes, pred_bboxes):
matched = {} matched = {}
for i, gt_box in enumerate(dt_boxes): for i, gt_box in enumerate(dt_boxes):
......
...@@ -21,6 +21,18 @@ function func_parser_params(){ ...@@ -21,6 +21,18 @@ function func_parser_params(){
echo ${tmp} echo ${tmp}
} }
function set_dynamic_epoch(){
string=$1
num=$2
_str=${string:1:6}
IFS="C"
arr=(${_str})
M=${arr[0]}
P=${arr[1]}
ep=`expr $num \* $M \* $P`
echo $ep
}
function func_sed_params(){ function func_sed_params(){
filename=$1 filename=$1
line=$2 line=$2
...@@ -143,6 +155,7 @@ else ...@@ -143,6 +155,7 @@ else
precision="amp" precision="amp"
fi fi
epoch=$(set_dynamic_epoch $device_num $epoch)
fp_items_list=($precision) fp_items_list=($precision)
batch_size_list=($batch_size) batch_size_list=($batch_size)
device_num_list=($device_num) device_num_list=($device_num)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册