internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: PaddlePaddle/models

Issue:
cycle_gan模型易用性问题
1、cycle_gan示例数据中缺少test数据
2、建议infer中init_model和input的路径与train中设定保持一致，分别设为output_0/checkpoints/1和data/horse2zebra/testA/*
<img width="643" alt="cycle_gan" src="https://user-images.githubusercontent.com/46314656/53951585-c1983680-4109-11e9-9796-2058d8be92dd.png">
3、运行中有告警：
infer.py:63: DeprecationWarning: `imsave` is deprecated!
`imsave` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.
Use ``imageio.imwrite`` instead.
  (fake_temp + 1) * 127.5).astype(np.uint8))




Discussion:
另外 ，infer时有个报错
<img width="801" alt="39e7b0f6b1c9c5a2a2231ee7254273c1" src="https://user-images.githubusercontent.com/46314656/54405239-e9425c80-4710-11e9-8b4a-cc0d4a116a28.png">


Resolving patch:
diff --git a/PaddleCV/gan/cycle_gan/infer.py b/PaddleCV/gan/cycle_gan/infer.py
--- a/PaddleCV/gan/cycle_gan/infer.py
+++ b/PaddleCV/gan/cycle_gan/infer.py
@@ -44,7 +44,6 @@ def infer(args):
     if not os.path.exists(args.output):
         os.makedirs(args.output)
     for file in glob.glob(args.input):
-        print "read %s" % file
         image_name = os.path.basename(file)
         image = Image.open(file)
         image = image.resize((256, 256))
diff --git a/PaddleCV/gan/cycle_gan/train.py b/PaddleCV/gan/cycle_gan/train.py
--- a/PaddleCV/gan/cycle_gan/train.py
+++ b/PaddleCV/gan/cycle_gan/train.py
@@ -22,7 +22,7 @@
 # yapf: disable
 add_arg('batch_size',        int,   1,          "Minibatch size.")
 add_arg('epoch',             int,   2,        "The number of epoched to be trained.")
-add_arg('output',            str,   "./output_0", "The directory the model and the test result to be saved to.")
+add_arg('output',            str,   "./output", "The directory the model and the test result to be saved to.")
 add_arg('init_model',        str,   None,       "The init model file of directory.")
 add_arg('save_checkpoints',  bool,  True,       "Whether to save checkpoints.")
 add_arg('run_test',          bool,  True,       "Whether to run test.")


Test patch:
Repository: PaddlePaddle/models

Issue:
图像分类报错
1.训练时
<img width="785" alt="94bd932cd5ab389f472129e083de5e1c" src="https://user-images.githubusercontent.com/46314656/55553960-33b56880-5714-11e9-83b2-9d3a592125cf.png">
2.评估和预测时，在python3下报错
<img width="898" alt="2dd3c9f40a6658fba9341901fba256ce" src="https://user-images.githubusercontent.com/46314656/55554055-6bbcab80-5714-11e9-833f-3d15e2e427c0.png">



Discussion:

Resolving patch:
diff --git a/PaddleCV/image_classification/train.py b/PaddleCV/image_classification/train.py
--- a/PaddleCV/image_classification/train.py
+++ b/PaddleCV/image_classification/train.py
@@ -74,7 +74,7 @@ def optimizer_setting(params):
         batch_size = ls["batch_size"]
         l2_decay = params["l2_decay"]
         momentum_rate = params["momentum_rate"]
-	step = int(math.ceil(float(total_images) / batch_size))
+        step = int(math.ceil(float(total_images) / batch_size))
         lr = params["lr"]
         num_epochs = params["num_epochs"]
 
@@ -92,7 +92,7 @@ def optimizer_setting(params):
         batch_size = ls["batch_size"]
         l2_decay = params["l2_decay"]
         momentum_rate = params["momentum_rate"]
-	step = int(math.ceil(float(total_images) / batch_size))
+        step = int(math.ceil(float(total_images) / batch_size))
         lr = params["lr"]
         num_epochs = params["num_epochs"]
 


Test patch:
Repository: PaddlePaddle/models

Issue:
图像分类报错
1.训练时
<img width="785" alt="94bd932cd5ab389f472129e083de5e1c" src="https://user-images.githubusercontent.com/46314656/55553960-33b56880-5714-11e9-83b2-9d3a592125cf.png">
2.评估和预测时，在python3下报错
<img width="898" alt="2dd3c9f40a6658fba9341901fba256ce" src="https://user-images.githubusercontent.com/46314656/55554055-6bbcab80-5714-11e9-833f-3d15e2e427c0.png">



Discussion:
Thx, will fix FastImagnet later in py3 later.


Resolving patch:
diff --git a/PaddleCV/image_classification/fast_imagenet/train.py b/PaddleCV/image_classification/fast_imagenet/train.py
--- a/PaddleCV/image_classification/fast_imagenet/train.py
+++ b/PaddleCV/image_classification/fast_imagenet/train.py
@@ -335,7 +335,7 @@ def print_paddle_envs():
     print("DEVICE_NUM: %d" % DEVICE_NUM)
     for k in os.environ:
         if "PADDLE_" in k:
-            print "ENV %s:%s" % (k, os.environ[k])
+            print("ENV %s:%s" % (k, os.environ[k]))
     print('------------------------------------------------')
 
 
diff --git a/PaddleCV/image_classification/models/fast_imagenet.py b/PaddleCV/image_classification/models/fast_imagenet.py
--- a/PaddleCV/image_classification/models/fast_imagenet.py
+++ b/PaddleCV/image_classification/models/fast_imagenet.py
@@ -22,8 +22,6 @@
 import os
 import math
 
-import cProfile, pstats, StringIO
-
 import paddle
 import paddle.fluid as fluid
 import paddle.fluid.core as core
@@ -135,7 +133,7 @@ def lr_decay(lrs, epochs, bs, total_image):
             step += 1
         ratio = (lrs[idx][1] - lrs[idx][0])*1.0 / (epoch[1] - epoch[0])
         lr_base = lrs[idx][0]
-        for s in xrange(epoch[0], epoch[1]):
+        for s in range(epoch[0], epoch[1]):
             if boundaries:
                 boundaries.append(boundaries[-1] + step + 1)
             else:
diff --git a/PaddleCV/image_classification/utils/learning_rate.py b/PaddleCV/image_classification/utils/learning_rate.py
--- a/PaddleCV/image_classification/utils/learning_rate.py
+++ b/PaddleCV/image_classification/utils/learning_rate.py
@@ -38,7 +38,7 @@ def cosine_decay_with_warmup(learning_rate, step_each_epoch, epochs=120):
         shape=[1], dtype='float32', value=float(5), force_cpu=True)
 
     with init_on_cpu():
-	epoch = ops.floor(global_step / step_each_epoch)
+        epoch = ops.floor(global_step / step_each_epoch)
         with control_flow.Switch() as switch:
             with switch.case(epoch < warmup_epoch):
                 decayed_lr = learning_rate * (global_step / (step_each_epoch * warmup_epoch))


Test patch:
Repository: PaddlePaddle/models

Issue:
ocr_recognition 评估、预测错误
1、ocr_recognition CTC model eval.py有函数缺少参数：
<img width="909" alt="e8ec154b99d031a872f8f222e1088e92" src="https://user-images.githubusercontent.com/46314656/53880163-453f1e00-404b-11e9-85c7-8dd84fe81020.png">
2、预测时CTC和attention模型的报错：
<img width="987" alt="93b4cc1a5a0309688355e42a33bddad7" src="https://user-images.githubusercontent.com/46314656/53880294-9e0eb680-404b-11e9-9619-47c6bdaff889.png">



Discussion:
https://github.com/PaddlePaddle/models/commit/c765794e0d8bd9e2f93a29962de89560ca1506be#diff-366b354acb1f3c3a449809e462657458R209
下载的是最新版本的models，运行python eval.py 报错信息如下：
![image](https://user-images.githubusercontent.com/37854899/54268250-c2bbde80-45b5-11e9-9c32-133e75759c99.png)
使用文档中提供的ocr_attention_params进行infer报错信息如下：
![image](https://user-images.githubusercontent.com/37854899/54268332-ee3ec900-45b5-11e9-8240-0083a142806c.png)
使用ocr_ctc_params进行infer正确。

Resolving patch:
diff --git a/PaddleCV/ocr_recognition/attention_model.py b/PaddleCV/ocr_recognition/attention_model.py
--- a/PaddleCV/ocr_recognition/attention_model.py
+++ b/PaddleCV/ocr_recognition/attention_model.py
@@ -339,7 +339,7 @@ def attention_infer(images, num_classes, use_cudnn=True):
     return ids
 
 
-def attention_eval(data_shape, num_classes):
+def attention_eval(data_shape, num_classes, use_cudnn=True):
     images = fluid.layers.data(name='pixel', shape=data_shape, dtype='float32')
     label_in = fluid.layers.data(
         name='label_in', shape=[1], dtype='int32', lod_level=1)
@@ -349,7 +349,7 @@ def attention_eval(data_shape, num_classes):
     label_in = fluid.layers.cast(x=label_in, dtype='int64')
 
     gru_backward, encoded_vector, encoded_proj = encoder_net(
-        images, is_test=True)
+        images, is_test=True, use_cudnn=use_cudnn)
 
     backward_first = fluid.layers.sequence_pool(
         input=gru_backward, pool_type='first')
diff --git a/PaddleCV/ocr_recognition/crnn_ctc_model.py b/PaddleCV/ocr_recognition/crnn_ctc_model.py
--- a/PaddleCV/ocr_recognition/crnn_ctc_model.py
+++ b/PaddleCV/ocr_recognition/crnn_ctc_model.py
@@ -213,12 +213,12 @@ def ctc_train_net(args, data_shape, num_classes):
     return sum_cost, error_evaluator, inference_program, model_average
 
 
-def ctc_infer(images, num_classes, use_cudnn):
+def ctc_infer(images, num_classes, use_cudnn=True):
     fc_out = encoder_net(images, num_classes, is_test=True, use_cudnn=use_cudnn)
     return fluid.layers.ctc_greedy_decoder(input=fc_out, blank=num_classes)
 
 
-def ctc_eval(data_shape, num_classes, use_cudnn):
+def ctc_eval(data_shape, num_classes, use_cudnn=True):
     images = fluid.layers.data(name='pixel', shape=data_shape, dtype='float32')
     label = fluid.layers.data(
         name='label', shape=[1], dtype='int32', lod_level=1)


Test patch:
Repository: PaddlePaddle/models

Issue:
object detection eval&infer报错
对object detection训练出的模型进行eval&infer报错信息如下：
![3](https://user-images.githubusercontent.com/37854899/57436444-43275480-7272-11e9-9536-c99ab5ec00ba.PNG)
mobilenet_ssd.py文件中并没有eval和infer中需要的mobile_net函数，可能需将eval.py&infer.py中的mobile_net修改为build_mobilenet_ssd


Discussion:

Resolving patch:
diff --git a/PaddleCV/object_detection/eval.py b/PaddleCV/object_detection/eval.py
--- a/PaddleCV/object_detection/eval.py
+++ b/PaddleCV/object_detection/eval.py
@@ -8,7 +8,7 @@
 import paddle
 import paddle.fluid as fluid
 import reader
-from mobilenet_ssd import mobile_net
+from mobilenet_ssd import build_mobilenet_ssd
 from utility import add_arguments, print_arguments
 
 parser = argparse.ArgumentParser(description=__doc__)
@@ -47,8 +47,8 @@ def build_program(main_prog, startup_prog, args, data_args):
         with fluid.unique_name.guard():
             image, gt_box, gt_label, difficult = fluid.layers.read_file(
                 py_reader)
-            locs, confs, box, box_var = mobile_net(num_classes, image,
-                                                   image_shape)
+            locs, confs, box, box_var = build_mobilenet_ssd(image, num_classes,
+                                                            image_shape)
             nmsed_out = fluid.layers.detection_output(
                 locs, confs, box, box_var, nms_threshold=args.nms_threshold)
             with fluid.program_guard(main_prog):
@@ -67,7 +67,6 @@ def build_program(main_prog, startup_prog, args, data_args):
 def eval(args, data_args, test_list, batch_size, model_dir=None):
     startup_prog = fluid.Program()
     test_prog = fluid.Program()
-
     test_py_reader, map_eval = build_program(
         main_prog=test_prog,
         startup_prog=startup_prog,
diff --git a/PaddleCV/object_detection/infer.py b/PaddleCV/object_detection/infer.py
--- a/PaddleCV/object_detection/infer.py
+++ b/PaddleCV/object_detection/infer.py
@@ -10,7 +10,7 @@
 import paddle
 import paddle.fluid as fluid
 import reader
-from mobilenet_ssd import mobile_net
+from mobilenet_ssd import build_mobilenet_ssd
 from utility import add_arguments, print_arguments
 
 parser = argparse.ArgumentParser(description=__doc__)
@@ -50,7 +50,8 @@ def infer(args, data_args, image_path, model_dir):
         label_list = data_args.label_list
 
     image = fluid.layers.data(name='image', shape=image_shape, dtype='float32')
-    locs, confs, box, box_var = mobile_net(num_classes, image, image_shape)
+    locs, confs, box, box_var = build_mobilenet_ssd(image, num_classes,
+                                                    image_shape)
     nmsed_out = fluid.layers.detection_output(
         locs, confs, box, box_var, nms_threshold=args.nms_threshold)
 


Test patch:
Repository: PaddlePaddle/models

Issue:
deeplabv3+反复报warning
在paddle1.4.1下，由于deeplabv3+打开了显存优化，导致反复报如下的warning：
<img width="956" alt="db83046567521a831348d8eea6f2e46a" src="https://user-images.githubusercontent.com/46314656/57190981-398cac80-6f53-11e9-9ffc-3a3c7b379d82.png">



Discussion:

Resolving patch:
diff --git a/PaddleCV/deeplabv3+/train.py b/PaddleCV/deeplabv3+/train.py
--- a/PaddleCV/deeplabv3+/train.py
+++ b/PaddleCV/deeplabv3+/train.py
@@ -145,6 +145,7 @@ def loss(logit, label):
         fluid.layers.assign(np.array(
             [0.1], dtype=np.float32)))
     loss_mean = fluid.layers.reduce_mean(loss) / area
+    loss_mean.persistable = True
 
     opt = fluid.optimizer.Momentum(
         lr,


Test patch:
Repository: PaddlePaddle/models

Issue:
There is a small error in face_detection reader
https://github.com/PaddlePaddle/models/blob/55138a40a219975bcbbeb6c1edef5284de721f72/PaddleCV/face_detection/reader.py#L312

the code should be 
```
 img = img.convert('RGB')
```



Discussion:

Resolving patch:
diff --git a/PaddleCV/face_detection/reader.py b/PaddleCV/face_detection/reader.py
--- a/PaddleCV/face_detection/reader.py
+++ b/PaddleCV/face_detection/reader.py
@@ -309,7 +309,7 @@ def infer(settings, image_path):
     def batch_reader():
         img = Image.open(image_path)
         if img.mode == 'L':
-            img = im.convert('RGB')
+            img = img.convert('RGB')
         im_width, im_height = img.size
         if settings.resize_width and settings.resize_height:
             img = img.resize((settings.resize_width, settings.resize_height),


Test patch:
Repository: PaddlePaddle/models

Issue:
deeplabv3+ eval 报维度错误
在paddle1.5分支下，deeplabv3+ 的评估有如下报错：
Traceback (most recent call last):
  File "./eval.py", line 131, in <module>
    fetch_list=[pred, miou, out_wrong, out_correct])
  File "/opt/_internal/cpython-3.6.0/lib/python3.6/site-packages/paddle/fluid/executor.py", line 650, in run
    use_program_cache=use_program_cache)
  File "/opt/_internal/cpython-3.6.0/lib/python3.6/site-packages/paddle/fluid/executor.py", line 748, in _run
    exe.run(program.desc, scope, 0, True, True, fetch_var_name)
paddle.fluid.core_avx.EnforceNotMet: Invoke operator bilinear_interp error.
Python Callstacks:
  File "/opt/_internal/cpython-3.6.0/lib/python3.6/site-packages/paddle/fluid/framework.py", line 1699, in append_op
    attrs=kwargs.get("attrs", None))
  File "/opt/_internal/cpython-3.6.0/lib/python3.6/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op
    return self.main_program.current_block().append_op(*args, **kwargs)
  File "/opt/_internal/cpython-3.6.0/lib/python3.6/site-packages/paddle/fluid/layers/nn.py", line 7637, in image_resize
    attrs=attrs)
  File "/opt/_internal/cpython-3.6.0/lib/python3.6/site-packages/paddle/fluid/layers/nn.py", line 7742, in resize_bilinear
    align_corners, align_mode)
  File "./eval.py", line 84, in <module>
    img = fluid.layers.resize_bilinear(img, image_shape)
C++ Callstacks:
Enforce failed. Expected dim_x.size() == 4, but received dim_x.size():3 != 4:4.
X's dimension must be 4 at [/ssd1/xiege/paddle_ce/Paddle/paddle/fluid/operators/interpolate_op.cc:40]


Discussion:

Resolving patch:
diff --git a/PaddleCV/deeplabv3+/eval.py b/PaddleCV/deeplabv3+/eval.py
--- a/PaddleCV/deeplabv3+/eval.py
+++ b/PaddleCV/deeplabv3+/eval.py
@@ -112,7 +112,7 @@ def load_model():
 
 batches = dataset.get_batch_generator(batch_size, total_step)
 if args.use_py_reader:
-    py_reader.decorate_tensor_provider(lambda :[ (yield b[1],b[2]) for b in batches])
+    py_reader.decorate_tensor_provider(lambda :[ (yield b[0],b[1]) for b in batches])
     py_reader.start()
 
 sum_iou = 0
@@ -137,3 +137,5 @@ def load_model():
     mp = (wrong + right) != 0
     miou2 = np.mean((right[mp] * 1.0 / (right[mp] + wrong[mp])))
     print('step: %s, mIoU: %s' % (i + 1, miou2))
+
+print('eval done!')


Test patch:
Repository: PaddlePaddle/models

Issue:
PaddleGAN中attgan保存模型报错
在在PaddleCV/PaddleGAN目录中，执行bash scripts/run_attgan.sh，对attgan模型进行训练，在保存模型时报错，报错信息如下:
![image](https://user-images.githubusercontent.com/37854899/60489578-415c9900-9cd7-11e9-8d29-e66c13b6d143.png)



Discussion:

Resolving patch:
diff --git a/PaddleCV/PaddleGAN/util/utility.py b/PaddleCV/PaddleGAN/util/utility.py
--- a/PaddleCV/PaddleGAN/util/utility.py
+++ b/PaddleCV/PaddleGAN/util/utility.py
@@ -133,7 +133,7 @@ def save_test_image(epoch,
     elif cfg.model_net == 'AttGAN' or cfg.model_net == 'STGAN':
         for data in zip(A_test_reader()):
             real_img, label_org, name = data[0]
-            attr_names = args.selected_attrs.split(',')
+            attr_names = cfg.selected_attrs.split(',')
             label_trg = copy.deepcopy(label_org)
             tensor_img = fluid.LoDTensor()
             tensor_label_org = fluid.LoDTensor()


Test patch:
Repository: PaddlePaddle/models

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模型吗？


Discussion:

Resolving patch:
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 = []
 


Test patch:
Repository: PaddlePaddle/models

Issue:
SSD Inconsistent function call 
In your `eval_coco_map.py` file, you imported one function [`mobile_net `](https://github.com/PaddlePaddle/models/blob/8d7328017dc50c4b82d25733cc7a4cd14ad4469f/PaddleCV/ssd/eval_coco_map.py#L10) that do not exist in the `mobilenet_ssd.py` file.  And the function call [below](https://github.com/PaddlePaddle/models/blob/8d7328017dc50c4b82d25733cc7a4cd14ad4469f/PaddleCV/ssd/eval_coco_map.py#L52) should be modified too.


Discussion:
Can I make some contributions?
@XFeiF Thanks! we will fix soon. You also can use https://github.com/PaddlePaddle/models/tree/develop/PaddleCV/PaddleDetection

Resolving patch:
diff --git a/PaddleCV/ssd/eval_coco_map.py b/PaddleCV/ssd/eval_coco_map.py
--- a/PaddleCV/ssd/eval_coco_map.py
+++ b/PaddleCV/ssd/eval_coco_map.py
@@ -7,7 +7,7 @@
 import paddle
 import paddle.fluid as fluid
 import reader
-from mobilenet_ssd import mobile_net
+from mobilenet_ssd import build_mobilenet_ssd
 from utility import add_arguments, print_arguments
 
 # A special mAP metric for COCO dataset, which averages AP in different IoUs.
@@ -49,7 +49,8 @@ def eval(args, data_args, test_list, batch_size, model_dir=None):
     gt_image_info = fluid.layers.data(
         name='gt_image_id', shape=[3], dtype='int32')
 
-    locs, confs, box, box_var = mobile_net(num_classes, image, image_shape)
+    locs, confs, box, box_var = build_mobilenet_ssd(image,
+                num_classes, image_shape)
     nmsed_out = fluid.layers.detection_output(
         locs, confs, box, box_var, nms_threshold=args.nms_threshold)
     loss = fluid.layers.ssd_loss(locs, confs, gt_box, gt_label, box, box_var)
@@ -130,7 +131,7 @@ def test():
 if __name__ == '__main__':
     args = parser.parse_args()
     print_arguments(args)
-
+    assert args.dataset in ['coco2014', 'coco2017']
     data_dir = './data/coco'
     if '2014' in args.dataset:
         test_list = 'annotations/instances_val2014.json'


Test patch:
Repository: PaddlePaddle/models

Issue:
PaddleCV/Research/astar2019/reader.py中的bug
[PaddleCV/Research/astar2019/reader.py](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/Research/astar2019/reader.py)中第74行有一处bug，代码如下

```
    @property
    def apply_distort(self):    # line 74: 按功能，此处应该是 def apply_expand(self):
        return self._apply_expand

    @property
    def apply_distort(self):
        return self._apply_distort
```


Discussion:

Resolving patch:
diff --git a/PaddleCV/Research/astar2019/reader.py b/PaddleCV/Research/astar2019/reader.py
--- a/PaddleCV/Research/astar2019/reader.py
+++ b/PaddleCV/Research/astar2019/reader.py
@@ -71,7 +71,7 @@ def ap_version(self):
         return self._ap_version
 
     @property
-    def apply_distort(self):
+    def apply_expand(self):
         return self._apply_expand
 
     @property


Test patch:
Repository: PaddlePaddle/models

Issue:
PaddleRL policy_gradient Typo
default_main_program误写为defaul_main_program
all_act_prob 未被声明为成员变量


Discussion:

Resolving patch:
diff --git a/legacy/PaddleRL/policy_gradient/brain.py b/legacy/PaddleRL/policy_gradient/brain.py
--- a/legacy/PaddleRL/policy_gradient/brain.py
+++ b/legacy/PaddleRL/policy_gradient/brain.py
@@ -31,10 +31,10 @@ def build_net(self):
         # fc1
         fc1 = fluid.layers.fc(input=obs, size=10, act="tanh")  # tanh activation
         # fc2
-        all_act_prob = fluid.layers.fc(input=fc1,
+        self.all_act_prob = fluid.layers.fc(input=fc1,
                                        size=self.n_actions,
                                        act="softmax")
-        self.inferece_program = fluid.defaul_main_program().clone()
+        self.inferece_program = fluid.default_main_program().clone()
         # to maximize total reward (log_p * R) is to minimize -(log_p * R)
         neg_log_prob = fluid.layers.cross_entropy(
             input=self.all_act_prob,


Test patch:
Repository: PaddlePaddle/models

Issue:
如果eos发生变化无法做infer的操作
[attention_model.py](https://github.com/PaddlePaddle/models/blob/develop/PaddleCV/ocr_recognition/attention_model.py)这个文件中如果eos发生变化无法做infer的操作（比如因为要识别有数字所以eos改成了其他值）
attention_infer的方法中
```xml
selected_ids, selected_scores = fluid.layers.beam_search(
            pre_ids,
            pre_score,
            topk_indices,
            accu_scores,
            beam_size,
            eos,  # 这里应该从1改成eos，否则eos如果发生变化会导致无法做infer操作
            #level=0
        )
```


Discussion:
感谢您的建议，我们尽快确认修改~

Resolving patch:
diff --git a/PaddleCV/ocr_recognition/attention_model.py b/PaddleCV/ocr_recognition/attention_model.py
--- a/PaddleCV/ocr_recognition/attention_model.py
+++ b/PaddleCV/ocr_recognition/attention_model.py
@@ -325,7 +325,7 @@ def attention_infer(images, num_classes, use_cudnn=True):
             topk_indices,
             accu_scores,
             beam_size,
-            1,  # end_id
+            eos,  # end_id
             #level=0
         )
 


Test patch:
Repository: PaddlePaddle/models

Issue:
PaddleCV/face_detection/widerface_eval.py
models/PaddleCV/face_detection/widerface_eval.py 
Line 307
    max_shrink = get_round(min(max_shrink_v1, max_shrink_v2), 2) - 0.3

This will generate a negative value when the image size is bigger and make the execution crashed.


Discussion:
I have told the relevant developers to follow up on this issue：@still-wait 
Thanks and waiting for your good news.

Resolving patch:
diff --git a/PaddleCV/face_detection/widerface_eval.py b/PaddleCV/face_detection/widerface_eval.py
--- a/PaddleCV/face_detection/widerface_eval.py
+++ b/PaddleCV/face_detection/widerface_eval.py
@@ -22,11 +22,13 @@
 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.
@@ -34,7 +36,6 @@ def set_paddle_flags(**kwargs):
     FLAGS_eager_delete_tensor_gb=0,  # enable GC to save memory
 )
 
-
 import paddle.fluid as fluid
 import reader
 from pyramidbox import PyramidBox
@@ -315,6 +316,8 @@ def get_round(x, loc):
         max_shrink = max_shrink - 0.4
     elif max_shrink >= 5:
         max_shrink = max_shrink - 0.5
+    elif max_shrink <= 0.1:
+        max_shrink = 0.1
 
     shrink = max_shrink if max_shrink < 1 else 1
     return shrink, max_shrink


Test patch: