提交 bbe37535 编写于 作者: W WenmuZhou

删除check_static函数

上级 122c82e9
......@@ -21,7 +21,6 @@ __dir__ = os.path.dirname(os.path.abspath(__file__))
sys.path.append(__dir__)
sys.path.append('/home/zhoujun20/PaddleOCR')
import paddle
from paddle import nn
from ppocr.modeling.transform import build_transform
from ppocr.modeling.backbones import build_backbone
......@@ -83,40 +82,4 @@ class Model(nn.Layer):
if self.use_neck:
x = self.neck(x)
x = self.head(x)
return x
def check_static():
import numpy as np
from ppocr.utils.save_load import load_dygraph_pretrain
from ppocr.utils.logging import get_logger
from tools import program
config = program.load_config('configs/det/det_r50_vd_db.yml')
logger = get_logger()
np.random.seed(0)
data = np.random.rand(1, 3, 640, 640).astype(np.float32)
paddle.disable_static()
x = paddle.to_tensor(data)
config['Architecture']['in_channels'] = 3
config['Architecture']["Head"]['out_channels'] = 37
model = Model(config['Architecture'])
model.eval()
load_dygraph_pretrain(
model, logger, 'det_r50_vd_db/best_accuracy', load_static_weights=True)
y = model(x)
for y1 in y:
print(y1.shape)
static_out = np.load('static_out.npy')
diff = y.numpy() - static_out
print(y.shape, static_out.shape, diff.mean())
if __name__ == '__main__':
check_static()
return x
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册