Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Pad0y committed Jul 24, 2020
1 parent 0753af5 commit 600ced9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ http://127.0.0.1:8080/ocr
<img width="500" height="300" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/ncnn_project/ocr/res_imgs/res_3.jpg"/>
<img width="500" height="300" src="https://github.com/ouyanghuiyu/chineseocr_lite/blob/master/ncnn_project/ocr/res_imgs/res_2.jpg"/>

## flask-restful api 内存测试(dbnet)
200张图片测试稳定在1-1.5G左右的内存
![](test_imgs/flask-api.png)


## 参考
Expand Down
2 changes: 1 addition & 1 deletion dbnet/dbnet_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def draw_bbox(img_path, result, color=(255, 0, 0), thickness=2):
return img_path


class DBNET(object, metaclass=SingletonType):
class DBNET(metaclass=SingletonType):
def __init__(self, MODEL_PATH, short_size=640):
self.sess = rt.InferenceSession(MODEL_PATH)
self.short_size = short_size
Expand Down
8 changes: 4 additions & 4 deletions dbnet/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, thresh=0.3, box_thresh=0.5, max_candidates=1000, unclip_ratio
self.unclip_ratio = unclip_ratio

def __call__(self, pred, height, width):
'''
"""
batch: (image, polygons, ignore_tags
batch: a dict produced by dataloaders.
image: tensor of shape (N, C, H, W).
Expand All @@ -25,7 +25,7 @@ def __call__(self, pred, height, width):
binary: text region segmentation map, with shape (N, H, W)
thresh: [if exists] thresh hold prediction with shape (N, H, W)
thresh_binary: [if exists] binarized with threshhold, (N, H, W)
'''
"""

pred = pred[0, :, :]
segmentation = self.binarize(pred)
Expand All @@ -38,10 +38,10 @@ def binarize(self, pred):
return pred > self.thresh

def boxes_from_bitmap(self, pred, bitmap, dest_width, dest_height):
'''
"""
_bitmap: single map with shape (H, W),
whose values are binarized as {0, 1}
'''
"""

assert len(bitmap.shape) == 2
# bitmap = _bitmap.cpu().numpy() # The first channel
Expand Down

0 comments on commit 600ced9

Please sign in to comment.