From 8f1b9c8b0d1febe585a0b204f791011548bdb272 Mon Sep 17 00:00:00 2001 From: WenmuZhou Date: Fri, 16 Oct 2020 20:18:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E9=BD=90=E9=9D=99=E6=80=81=E5=9B=BE?= =?UTF-8?q?=E6=97=B6=E4=BD=BF=E7=94=A8random=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ppocr/modeling/architectures/model.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/ppocr/modeling/architectures/model.py b/ppocr/modeling/architectures/model.py index c8cb6f24..5723beb7 100644 --- a/ppocr/modeling/architectures/model.py +++ b/ppocr/modeling/architectures/model.py @@ -94,13 +94,11 @@ def check_static(): from ppocr.utils.logging import get_logger from tools import program - config = program.load_config('configs/det/det_r50_vd_db.yml') + config = program.load_config('configs/rec/rec_r34_vd_none_bilstm_ctc.yml') - # import cv2 - # data = cv2.imread('doc/imgs/1.jpg') - # data = normalize(data) logger = get_logger() - data = np.zeros((1, 3, 640, 640), dtype=np.float32) + np.random.seed(0) + data = np.random.rand(1, 3, 32, 320).astype(np.float32) paddle.disable_static() config['Architecture']['in_channels'] = 3 @@ -110,17 +108,15 @@ def check_static(): load_dygraph_pretrain( model, logger, - '/Users/zhoujun20/Desktop/code/PaddleOCR/db/db', + '/Users/zhoujun20/Desktop/code/PaddleOCR/cnn_ctc/cnn_ctc', load_static_weights=True) - x = paddle.to_variable(data) + x = paddle.to_tensor(data) y = model(x) for y1 in y: print(y1.shape) - # - # # from matplotlib import pyplot as plt - # # plt.imshow(y.numpy()) - # # plt.show() - static_out = np.load('/Users/zhoujun20/Desktop/code/PaddleOCR/db/db.npy') + + static_out = np.load( + '/Users/zhoujun20/Desktop/code/PaddleOCR/output/conv.npy') diff = y.numpy() - static_out print(y.shape, static_out.shape, diff.mean()) -- GitLab