We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
icnet 存在的几个问题
[icnet](https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/icnet)里存在诸多问题:
1.文档有误，--model_path="./cnkpnt/100"应该是--model_path="./chkpnt/100"
2.训练时没有输出中间过程信息，仅在最后输出几个loss信息
3.文档中给的预训练模型无法用于infer，能提供下训好的cnkpnt/100模型吗？

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `PaddleCV/icnet/train.py`
Content:
```
1 """Trainer for ICNet model."""
2 from __future__ import absolute_import
3 from __future__ import division
4 from __future__ import print_function
5 from icnet import icnet
6 import cityscape
7 import argparse
8 import functools
9 import sys
10 import os
11 import time
12 import paddle.fluid as fluid
13 import numpy as np
14 from utils import add_arguments, print_arguments, get_feeder_data, check_gpu
15 from paddle.fluid.layers.learning_rate_scheduler import _decay_step_counter
16 from paddle.fluid.initializer import init_on_cpu
17 
18 if 'ce_mode' in os.environ:
19     np.random.seed(10)
20     fluid.default_startup_program().random_seed = 90
21 
22 parser = argparse.ArgumentParser(description=__doc__)
23 add_arg = functools.partial(add_arguments, argparser=parser)
24 # yapf: disable
25 add_arg('batch_size',        int,   16,         "Minibatch size.")
26 add_arg('checkpoint_path',   str,   None,       "Checkpoint svae path.")
27 add_arg('init_model',        str,   None,       "Pretrain model path.")
28 add_arg('use_gpu',           bool,  True,       "Whether use GPU to train.")
29 add_arg('random_mirror',     bool,  True,       "Whether prepare by random mirror.")
30 add_arg('random_scaling',    bool,  True,       "Whether prepare by random scaling.")
31 # yapf: enable
32 
33 LAMBDA1 = 0.16
34 LAMBDA2 = 0.4
35 LAMBDA3 = 1.0
36 LEARNING_RATE = 0.003
37 POWER = 0.9
38 LOG_PERIOD = 100
39 CHECKPOINT_PERIOD = 100
40 TOTAL_STEP = 100
41 
42 no_grad_set = []
43 
44 
45 def create_loss(predict, label, mask, num_classes):
46     predict = fluid.layers.transpose(predict, perm=[0, 2, 3, 1])
47     predict = fluid.layers.reshape(predict, shape=[-1, num_classes])
48     label = fluid.layers.reshape(label, shape=[-1, 1])
49     predict = fluid.layers.gather(predict, mask)
50     label = fluid.layers.gather(label, mask)
51     label = fluid.layers.cast(label, dtype="int64")
52     loss = fluid.layers.softmax_with_cross_entropy(predict, label)
53     no_grad_set.append(label.name)
54     return fluid.layers.reduce_mean(loss)
55 
56 
57 def poly_decay():
58     global_step = _decay_step_counter()
59     with init_on_cpu():
60         decayed_lr = LEARNING_RATE * (fluid.layers.pow(
61             (1 - global_step / TOTAL_STEP), POWER))
62     return decayed_lr
63 
64 
65 def train(args):
66     data_shape = cityscape.train_data_shape()
67     num_classes = cityscape.num_classes()
68     # define network
69     images = fluid.layers.data(name='image', shape=data_shape, dtype='float32')
70     label_sub1 = fluid.layers.data(name='label_sub1', shape=[1], dtype='int32')
71     label_sub2 = fluid.layers.data(name='label_sub2', shape=[1], dtype='int32')
72     label_sub4 = fluid.layers.data(name='label_sub4', shape=[1], dtype='int32')
73     mask_sub1 = fluid.layers.data(name='mask_sub1', shape=[-1], dtype='int32')
74     mask_sub2 = fluid.layers.data(name='mask_sub2', shape=[-1], dtype='int32')
75     mask_sub4 = fluid.layers.data(name='mask_sub4', shape=[-1], dtype='int32')
76 
77     sub4_out, sub24_out, sub124_out = icnet(
78         images, num_classes, np.array(data_shape[1:]).astype("float32"))
79     loss_sub4 = create_loss(sub4_out, label_sub4, mask_sub4, num_classes)
80     loss_sub24 = create_loss(sub24_out, label_sub2, mask_sub2, num_classes)
81     loss_sub124 = create_loss(sub124_out, label_sub1, mask_sub1, num_classes)
82     reduced_loss = LAMBDA1 * loss_sub4 + LAMBDA2 * loss_sub24 + LAMBDA3 * loss_sub124
83 
84     regularizer = fluid.regularizer.L2Decay(0.0001)
85     optimizer = fluid.optimizer.Momentum(
86         learning_rate=poly_decay(), momentum=0.9, regularization=regularizer)
87     _, params_grads = optimizer.minimize(reduced_loss, no_grad_set=no_grad_set)
88 
89     # prepare environment
90     place = fluid.CPUPlace()
91     if args.use_gpu:
92         place = fluid.CUDAPlace(0)
93     exe = fluid.Executor(place)
94 
95     exe.run(fluid.default_startup_program())
96 
97     if args.init_model is not None:
98         print("load model from: %s" % args.init_model)
99 
100         def if_exist(var):
101             return os.path.exists(os.path.join(args.init_model, var.name))
102 
103         fluid.io.load_vars(exe, args.init_model, predicate=if_exist)
104 
105     iter_id = 0
106     t_loss = 0.
107     sub4_loss = 0.
108     sub24_loss = 0.
109     sub124_loss = 0.
110     train_reader = cityscape.train(
111         args.batch_size, flip=args.random_mirror, scaling=args.random_scaling)
112     start_time = time.time()
113     while True:
114         # train a pass
115         for data in train_reader():
116             if iter_id > TOTAL_STEP:
117                 end_time = time.time()
118                 print("kpis	train_duration	%f" % (end_time - start_time))
119                 return
120             iter_id += 1
121             results = exe.run(
122                 feed=get_feeder_data(data, place),
123                 fetch_list=[reduced_loss, loss_sub4, loss_sub24, loss_sub124])
124             t_loss += results[0]
125             sub4_loss += results[1]
126             sub24_loss += results[2]
127             sub124_loss += results[3]
128             # training log
129             if iter_id % LOG_PERIOD == 0:
130                 print(
131                     "Iter[%d]; train loss: %.3f; sub4_loss: %.3f; sub24_loss: %.3f; sub124_loss: %.3f"
132                     % (iter_id, t_loss / LOG_PERIOD, sub4_loss / LOG_PERIOD,
133                        sub24_loss / LOG_PERIOD, sub124_loss / LOG_PERIOD))
134                 print("kpis	train_cost	%f" % (t_loss / LOG_PERIOD))
135 
136                 t_loss = 0.
137                 sub4_loss = 0.
138                 sub24_loss = 0.
139                 sub124_loss = 0.
140                 sys.stdout.flush()
141 
142             if iter_id % CHECKPOINT_PERIOD == 0 and args.checkpoint_path is not None:
143                 dir_name = args.checkpoint_path + "/" + str(iter_id)
144                 fluid.io.save_persistables(exe, dirname=dir_name)
145                 print("Saved checkpoint: %s" % (dir_name))
146 
147 
148 def main():
149     args = parser.parse_args()
150     print_arguments(args)
151     check_gpu(args.use_gpu)
152     train(args)
153 
154 
155 if __name__ == "__main__":
156     main()
157
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/PaddleCV/icnet/train.py b/PaddleCV/icnet/train.py
--- a/PaddleCV/icnet/train.py
+++ b/PaddleCV/icnet/train.py
@@ -35,9 +35,11 @@
 LAMBDA3 = 1.0
 LEARNING_RATE = 0.003
 POWER = 0.9
-LOG_PERIOD = 100
-CHECKPOINT_PERIOD = 100
-TOTAL_STEP = 100
+LOG_PERIOD = 1
+CHECKPOINT_PERIOD = 1000
+TOTAL_STEP = 60000
+if 'ce_mode' in os.environ:
+    TOTAL_STEP = 100
 
 no_grad_set = []

{"golden_diff": "diff --git a/PaddleCV/icnet/train.py b/PaddleCV/icnet/train.py\n--- a/PaddleCV/icnet/train.py\n+++ b/PaddleCV/icnet/train.py\n@@ -35,9 +35,11 @@\n LAMBDA3 = 1.0\n LEARNING_RATE = 0.003\n POWER = 0.9\n-LOG_PERIOD = 100\n-CHECKPOINT_PERIOD = 100\n-TOTAL_STEP = 100\n+LOG_PERIOD = 1\n+CHECKPOINT_PERIOD = 1000\n+TOTAL_STEP = 60000\n+if 'ce_mode' in os.environ:\n+    TOTAL_STEP = 100\n \n no_grad_set = []\n", "issue": "icnet \u5b58\u5728\u7684\u51e0\u4e2a\u95ee\u9898\n[icnet](https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/icnet)\u91cc\u5b58\u5728\u8bf8\u591a\u95ee\u9898:\r\n1.\u6587\u6863\u6709\u8bef\uff0c--model_path=\"./cnkpnt/100\"\u5e94\u8be5\u662f--model_path=\"./chkpnt/100\"\r\n2.\u8bad\u7ec3\u65f6\u6ca1\u6709\u8f93\u51fa\u4e2d\u95f4\u8fc7\u7a0b\u4fe1\u606f\uff0c\u4ec5\u5728\u6700\u540e\u8f93\u51fa\u51e0\u4e2aloss\u4fe1\u606f\r\n3.\u6587\u6863\u4e2d\u7ed9\u7684\u9884\u8bad\u7ec3\u6a21\u578b\u65e0\u6cd5\u7528\u4e8einfer\uff0c\u80fd\u63d0\u4f9b\u4e0b\u8bad\u597d\u7684cnkpnt/100\u6a21\u578b\u5417\uff1f\n", "before_files": [{"content": "\"\"\"Trainer for ICNet model.\"\"\"\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom icnet import icnet\nimport cityscape\nimport argparse\nimport functools\nimport sys\nimport os\nimport time\nimport paddle.fluid as fluid\nimport numpy as np\nfrom utils import add_arguments, print_arguments, get_feeder_data, check_gpu\nfrom paddle.fluid.layers.learning_rate_scheduler import _decay_step_counter\nfrom paddle.fluid.initializer import init_on_cpu\n\nif 'ce_mode' in os.environ:\n    np.random.seed(10)\n    fluid.default_startup_program().random_seed = 90\n\nparser = argparse.ArgumentParser(description=__doc__)\nadd_arg = functools.partial(add_arguments, argparser=parser)\n# yapf: disable\nadd_arg('batch_size',        int,   16,         \"Minibatch size.\")\nadd_arg('checkpoint_path',   str,   None,       \"Checkpoint svae path.\")\nadd_arg('init_model',        str,   None,       \"Pretrain model path.\")\nadd_arg('use_gpu',           bool,  True,       \"Whether use GPU to train.\")\nadd_arg('random_mirror',     bool,  True,       \"Whether prepare by random mirror.\")\nadd_arg('random_scaling',    bool,  True,       \"Whether prepare by random scaling.\")\n# yapf: enable\n\nLAMBDA1 = 0.16\nLAMBDA2 = 0.4\nLAMBDA3 = 1.0\nLEARNING_RATE = 0.003\nPOWER = 0.9\nLOG_PERIOD = 100\nCHECKPOINT_PERIOD = 100\nTOTAL_STEP = 100\n\nno_grad_set = []\n\n\ndef create_loss(predict, label, mask, num_classes):\n    predict = fluid.layers.transpose(predict, perm=[0, 2, 3, 1])\n    predict = fluid.layers.reshape(predict, shape=[-1, num_classes])\n    label = fluid.layers.reshape(label, shape=[-1, 1])\n    predict = fluid.layers.gather(predict, mask)\n    label = fluid.layers.gather(label, mask)\n    label = fluid.layers.cast(label, dtype=\"int64\")\n    loss = fluid.layers.softmax_with_cross_entropy(predict, label)\n    no_grad_set.append(label.name)\n    return fluid.layers.reduce_mean(loss)\n\n\ndef poly_decay():\n    global_step = _decay_step_counter()\n    with init_on_cpu():\n        decayed_lr = LEARNING_RATE * (fluid.layers.pow(\n            (1 - global_step / TOTAL_STEP), POWER))\n    return decayed_lr\n\n\ndef train(args):\n    data_shape = cityscape.train_data_shape()\n    num_classes = cityscape.num_classes()\n    # define network\n    images = fluid.layers.data(name='image', shape=data_shape, dtype='float32')\n    label_sub1 = fluid.layers.data(name='label_sub1', shape=[1], dtype='int32')\n    label_sub2 = fluid.layers.data(name='label_sub2', shape=[1], dtype='int32')\n    label_sub4 = fluid.layers.data(name='label_sub4', shape=[1], dtype='int32')\n    mask_sub1 = fluid.layers.data(name='mask_sub1', shape=[-1], dtype='int32')\n    mask_sub2 = fluid.layers.data(name='mask_sub2', shape=[-1], dtype='int32')\n    mask_sub4 = fluid.layers.data(name='mask_sub4', shape=[-1], dtype='int32')\n\n    sub4_out, sub24_out, sub124_out = icnet(\n        images, num_classes, np.array(data_shape[1:]).astype(\"float32\"))\n    loss_sub4 = create_loss(sub4_out, label_sub4, mask_sub4, num_classes)\n    loss_sub24 = create_loss(sub24_out, label_sub2, mask_sub2, num_classes)\n    loss_sub124 = create_loss(sub124_out, label_sub1, mask_sub1, num_classes)\n    reduced_loss = LAMBDA1 * loss_sub4 + LAMBDA2 * loss_sub24 + LAMBDA3 * loss_sub124\n\n    regularizer = fluid.regularizer.L2Decay(0.0001)\n    optimizer = fluid.optimizer.Momentum(\n        learning_rate=poly_decay(), momentum=0.9, regularization=regularizer)\n    _, params_grads = optimizer.minimize(reduced_loss, no_grad_set=no_grad_set)\n\n    # prepare environment\n    place = fluid.CPUPlace()\n    if args.use_gpu:\n        place = fluid.CUDAPlace(0)\n    exe = fluid.Executor(place)\n\n    exe.run(fluid.default_startup_program())\n\n    if args.init_model is not None:\n        print(\"load model from: %s\" % args.init_model)\n\n        def if_exist(var):\n            return os.path.exists(os.path.join(args.init_model, var.name))\n\n        fluid.io.load_vars(exe, args.init_model, predicate=if_exist)\n\n    iter_id = 0\n    t_loss = 0.\n    sub4_loss = 0.\n    sub24_loss = 0.\n    sub124_loss = 0.\n    train_reader = cityscape.train(\n        args.batch_size, flip=args.random_mirror, scaling=args.random_scaling)\n    start_time = time.time()\n    while True:\n        # train a pass\n        for data in train_reader():\n            if iter_id > TOTAL_STEP:\n                end_time = time.time()\n                print(\"kpis\ttrain_duration\t%f\" % (end_time - start_time))\n                return\n            iter_id += 1\n            results = exe.run(\n                feed=get_feeder_data(data, place),\n                fetch_list=[reduced_loss, loss_sub4, loss_sub24, loss_sub124])\n            t_loss += results[0]\n            sub4_loss += results[1]\n            sub24_loss += results[2]\n            sub124_loss += results[3]\n            # training log\n            if iter_id % LOG_PERIOD == 0:\n                print(\n                    \"Iter[%d]; train loss: %.3f; sub4_loss: %.3f; sub24_loss: %.3f; sub124_loss: %.3f\"\n                    % (iter_id, t_loss / LOG_PERIOD, sub4_loss / LOG_PERIOD,\n                       sub24_loss / LOG_PERIOD, sub124_loss / LOG_PERIOD))\n                print(\"kpis\ttrain_cost\t%f\" % (t_loss / LOG_PERIOD))\n\n                t_loss = 0.\n                sub4_loss = 0.\n                sub24_loss = 0.\n                sub124_loss = 0.\n                sys.stdout.flush()\n\n            if iter_id % CHECKPOINT_PERIOD == 0 and args.checkpoint_path is not None:\n                dir_name = args.checkpoint_path + \"/\" + str(iter_id)\n                fluid.io.save_persistables(exe, dirname=dir_name)\n                print(\"Saved checkpoint: %s\" % (dir_name))\n\n\ndef main():\n    args = parser.parse_args()\n    print_arguments(args)\n    check_gpu(args.use_gpu)\n    train(args)\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "PaddleCV/icnet/train.py"}], "after_files": [{"content": "\"\"\"Trainer for ICNet model.\"\"\"\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom icnet import icnet\nimport cityscape\nimport argparse\nimport functools\nimport sys\nimport os\nimport time\nimport paddle.fluid as fluid\nimport numpy as np\nfrom utils import add_arguments, print_arguments, get_feeder_data, check_gpu\nfrom paddle.fluid.layers.learning_rate_scheduler import _decay_step_counter\nfrom paddle.fluid.initializer import init_on_cpu\n\nif 'ce_mode' in os.environ:\n    np.random.seed(10)\n    fluid.default_startup_program().random_seed = 90\n\nparser = argparse.ArgumentParser(description=__doc__)\nadd_arg = functools.partial(add_arguments, argparser=parser)\n# yapf: disable\nadd_arg('batch_size',        int,   16,         \"Minibatch size.\")\nadd_arg('checkpoint_path',   str,   None,       \"Checkpoint svae path.\")\nadd_arg('init_model',        str,   None,       \"Pretrain model path.\")\nadd_arg('use_gpu',           bool,  True,       \"Whether use GPU to train.\")\nadd_arg('random_mirror',     bool,  True,       \"Whether prepare by random mirror.\")\nadd_arg('random_scaling',    bool,  True,       \"Whether prepare by random scaling.\")\n# yapf: enable\n\nLAMBDA1 = 0.16\nLAMBDA2 = 0.4\nLAMBDA3 = 1.0\nLEARNING_RATE = 0.003\nPOWER = 0.9\nLOG_PERIOD = 1\nCHECKPOINT_PERIOD = 1000\nTOTAL_STEP = 60000\nif 'ce_mode' in os.environ:\n    TOTAL_STEP = 100\n\nno_grad_set = []\n\n\ndef create_loss(predict, label, mask, num_classes):\n    predict = fluid.layers.transpose(predict, perm=[0, 2, 3, 1])\n    predict = fluid.layers.reshape(predict, shape=[-1, num_classes])\n    label = fluid.layers.reshape(label, shape=[-1, 1])\n    predict = fluid.layers.gather(predict, mask)\n    label = fluid.layers.gather(label, mask)\n    label = fluid.layers.cast(label, dtype=\"int64\")\n    loss = fluid.layers.softmax_with_cross_entropy(predict, label)\n    no_grad_set.append(label.name)\n    return fluid.layers.reduce_mean(loss)\n\n\ndef poly_decay():\n    global_step = _decay_step_counter()\n    with init_on_cpu():\n        decayed_lr = LEARNING_RATE * (fluid.layers.pow(\n            (1 - global_step / TOTAL_STEP), POWER))\n    return decayed_lr\n\n\ndef train(args):\n    data_shape = cityscape.train_data_shape()\n    num_classes = cityscape.num_classes()\n    # define network\n    images = fluid.layers.data(name='image', shape=data_shape, dtype='float32')\n    label_sub1 = fluid.layers.data(name='label_sub1', shape=[1], dtype='int32')\n    label_sub2 = fluid.layers.data(name='label_sub2', shape=[1], dtype='int32')\n    label_sub4 = fluid.layers.data(name='label_sub4', shape=[1], dtype='int32')\n    mask_sub1 = fluid.layers.data(name='mask_sub1', shape=[-1], dtype='int32')\n    mask_sub2 = fluid.layers.data(name='mask_sub2', shape=[-1], dtype='int32')\n    mask_sub4 = fluid.layers.data(name='mask_sub4', shape=[-1], dtype='int32')\n\n    sub4_out, sub24_out, sub124_out = icnet(\n        images, num_classes, np.array(data_shape[1:]).astype(\"float32\"))\n    loss_sub4 = create_loss(sub4_out, label_sub4, mask_sub4, num_classes)\n    loss_sub24 = create_loss(sub24_out, label_sub2, mask_sub2, num_classes)\n    loss_sub124 = create_loss(sub124_out, label_sub1, mask_sub1, num_classes)\n    reduced_loss = LAMBDA1 * loss_sub4 + LAMBDA2 * loss_sub24 + LAMBDA3 * loss_sub124\n\n    regularizer = fluid.regularizer.L2Decay(0.0001)\n    optimizer = fluid.optimizer.Momentum(\n        learning_rate=poly_decay(), momentum=0.9, regularization=regularizer)\n    _, params_grads = optimizer.minimize(reduced_loss, no_grad_set=no_grad_set)\n\n    # prepare environment\n    place = fluid.CPUPlace()\n    if args.use_gpu:\n        place = fluid.CUDAPlace(0)\n    exe = fluid.Executor(place)\n\n    exe.run(fluid.default_startup_program())\n\n    if args.init_model is not None:\n        print(\"load model from: %s\" % args.init_model)\n\n        def if_exist(var):\n            return os.path.exists(os.path.join(args.init_model, var.name))\n\n        fluid.io.load_vars(exe, args.init_model, predicate=if_exist)\n\n    iter_id = 0\n    t_loss = 0.\n    sub4_loss = 0.\n    sub24_loss = 0.\n    sub124_loss = 0.\n    train_reader = cityscape.train(\n        args.batch_size, flip=args.random_mirror, scaling=args.random_scaling)\n    start_time = time.time()\n    while True:\n        # train a pass\n        for data in train_reader():\n            if iter_id > TOTAL_STEP:\n                end_time = time.time()\n                print(\"kpis\ttrain_duration\t%f\" % (end_time - start_time))\n                return\n            iter_id += 1\n            results = exe.run(\n                feed=get_feeder_data(data, place),\n                fetch_list=[reduced_loss, loss_sub4, loss_sub24, loss_sub124])\n            t_loss += results[0]\n            sub4_loss += results[1]\n            sub24_loss += results[2]\n            sub124_loss += results[3]\n            # training log\n            if iter_id % LOG_PERIOD == 0:\n                print(\n                    \"Iter[%d]; train loss: %.3f; sub4_loss: %.3f; sub24_loss: %.3f; sub124_loss: %.3f\"\n                    % (iter_id, t_loss / LOG_PERIOD, sub4_loss / LOG_PERIOD,\n                       sub24_loss / LOG_PERIOD, sub124_loss / LOG_PERIOD))\n                print(\"kpis\ttrain_cost\t%f\" % (t_loss / LOG_PERIOD))\n\n                t_loss = 0.\n                sub4_loss = 0.\n                sub24_loss = 0.\n                sub124_loss = 0.\n                sys.stdout.flush()\n\n            if iter_id % CHECKPOINT_PERIOD == 0 and args.checkpoint_path is not None:\n                dir_name = args.checkpoint_path + \"/\" + str(iter_id)\n                fluid.io.save_persistables(exe, dirname=dir_name)\n                print(\"Saved checkpoint: %s\" % (dir_name))\n\n\ndef main():\n    args = parser.parse_args()\n    print_arguments(args)\n    check_gpu(args.use_gpu)\n    train(args)\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "PaddleCV/icnet/train.py"}]}