提交 3517bca6 编写于 作者: L LielinJiang

add requirement

上级 a9f53f29
......@@ -4,6 +4,15 @@
* 在阅读本教程前,请确保您已经了解过PaddleSeg的[快速入门](../README.md#快速入门)[基础功能](../README.md#基础功能)等章节,以便对PaddleSeg有一定的了解
## 环境依赖
* PaddlePaddle >= 1.7.0 或develop版本
* Python 2.7 or 3.5+
通过以下命令安装python包依赖,请确保在该分支上至少执行过一次以下命令
```shell
$ pip install -r requirements.txt
```
## 一. 准备待训练数据
......@@ -114,9 +123,10 @@ CUDA_VISIBLE_DEVICES=0 python -u eval.py --use_gpu --cfg configs/lanenet.yaml
```
## 七. 可视化
我们提供了一个训练好的模型,点击[链接](https://paddleseg.bj.bcebos.com/models/LaneNet_vgg_tusimple.tar),下载后放在```./pretrained_model/```下,使用如下命令进行可视化
我们提供了一个训练好的模型,点击[链接](https://paddleseg.bj.bcebos.com/models/lanenet_vgg_tusimple.tar),下载后放在```./pretrained_models/```下,使用如下命令进行可视化
```shell
CUDA_VISIBLE_DEVICES=0 python -u ./vis.py --cfg configs/lanenet.yaml --use_gpu --vis_dir vis_result
CUDA_VISIBLE_DEVICES=0 python -u ./vis.py --cfg configs/lanenet.yaml --use_gpu --vis_dir vis_result \
TEST.TEST_MODEL pretrained_models/LaneNet_vgg_tusimple/ \
```
可视化结果示例:
......
pre-commit
yapf == 0.26.0
flake8
pyyaml >= 5.1
tb-paddle
tensorboard >= 1.15.0
Pillow
numpy
six
opencv-python
tqdm
requests
sklearn
import os
from paddle import fluid
def load_fp16_vars(executor, dirname, program):
load_dirname = os.path.normpath(dirname)
def _if_exist(var):
name = var.name[:-7] if var.name.endswith('.master') else var.name
b = os.path.exists(os.path.join(load_dirname, name))
if not b and isinstance(var, fluid.framework.Parameter):
print("===== {} not found ====".format(var.name))
return b
load_prog = fluid.Program()
load_block = load_prog.global_block()
vars = list(filter(_if_exist, program.list_vars()))
for var in vars:
new_var = fluid.io._clone_var_in_block_(load_block, var)
name = var.name[:-7] if var.name.endswith('.master') else var.name
file_path = os.path.join(load_dirname, name)
load_block.append_op(
type='load',
inputs={},
outputs={'Out': [new_var]},
attrs={
'file_path': file_path,
'load_as_fp16': var.dtype == fluid.core.VarDesc.VarType.FP16
})
executor.run(load_prog)
\ No newline at end of file
......@@ -137,14 +137,6 @@ def process_tusimple_dataset(src_dir):
shutil.copyfile(json_label_path, ops.join(testing_folder_path, json_label_name))
# train_gt_image_dir = ops.join(traing_folder_path, 'gt_image')
# train_gt_binary_dir = ops.join(traing_folder_path, 'gt_binary_image')
# train_gt_instance_dir = ops.join(traing_folder_path, 'gt_instance_image')
#
# test_gt_image_dir = ops.join(testing_folder_path, 'gt_image')
# test_gt_binary_dir = ops.join(testing_folder_path, 'gt_binary_image')
# test_gt_instance_dir = ops.join(testing_folder_path, 'gt_instance_image')
train_gt_image_dir = ops.join('training', 'gt_image')
train_gt_binary_dir = ops.join('training', 'gt_binary_image')
train_gt_instance_dir = ops.join('training', 'gt_instance_image')
......@@ -166,13 +158,6 @@ def process_tusimple_dataset(src_dir):
gen_sample(src_dir, train_gt_binary_dir, train_gt_instance_dir, train_gt_image_dir, 'train', True)
for json_label_path in glob.glob('{:s}/*.json'.format(testing_folder_path)):
process_json_file(json_label_path, src_dir, test_gt_image_dir, test_gt_binary_dir, test_gt_instance_dir)
gen_sample(src_dir, test_gt_binary_dir, test_gt_instance_dir, test_gt_image_dir, 'test')
return
if __name__ == '__main__':
args = init_args()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册