提交 d4dbec29 编写于 作者: G Guanghua Yu 提交者: qingqing01

Fix pyramidbox load and flags (#3657)

上级 bdfc6ce7
......@@ -111,6 +111,7 @@ python -u train.py --batch_size=16 --pretrained_model=vgg_ilsvrc_16_fc_reduced
**注意**
- 本次开源模型中CPM模块与论文中有些许不同,相比论文中CPM模块训练和测试速度更快。
- Pyramid Anchors模块的body部分可以针对不同情况,进行相应的长宽设置来调参。同时face、head、body部分的loss对应的系数也可以通过调参优化。
- 针对GPU资源有限时,可采取显存优化策略,`train.py``derface_eval.py` 已经加入部分显存优化FLAGS,详情更多内容请参考[API文档](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/flags/memory_cn.html#flags-fraction-of-gpu-memory-to-use)
### 模型评估
......
......@@ -22,6 +22,19 @@ import argparse
import functools
from PIL import Image
def set_paddle_flags(**kwargs):
for key, value in kwargs.items():
if os.environ.get(key, None) is None:
os.environ[key] = str(value)
# NOTE(paddle-dev): All of these flags should be
# set before `import paddle`. Otherwise, it would
# not take any effect.
set_paddle_flags(
FLAGS_eager_delete_tensor_gb=0, # enable GC to save memory
)
import paddle.fluid as fluid
import reader
from pyramidbox import PyramidBox
......@@ -324,6 +337,7 @@ if __name__ == '__main__':
is_infer=True)
infer_program, nmsed_out = network.infer(main_program)
fetches = [nmsed_out]
exe.run(startup_program)
fluid.io.load_persistables(
exe, args.model_dir, main_program=infer_program)
# save model and program
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册