PaddlePaddle / PaddleRS

Awesome Remote Sensing Toolkit based on PaddlePaddle.
Apache License 2.0
365 stars 88 forks source link

[General Issue] #165

Closed kidcad1412 closed 9 months ago

kidcad1412 commented 11 months ago

Thanks for your issue. To help us better solve the issue, please provide the following information:

  1. PaddleRS version: (please specify the branch as well,e.g. PaddleRS release/1.0)
  2. PaddlePaddle version: (e.g. PaddlePaddle 2.3.0)
  3. Operation system: (e.g. Linux/Windows/MacOS)
  4. Python version: (e.g. Python3.7/8)
  5. CUDA/cuDNN version: (e.g. CUDA10.2/cuDNN 7.6.5)
  6. Additional context: (add any other context about the problem)

欢迎您的提问。辛苦您提供以下信息,以方便我们快速定位和解决问题:

  1. PaddleRS版本:paddlers =0.0.0.dev0
  2. PaddlePaddle版本:paddlepaddle-gpu= 2.4.2.post112
  3. 操作系统信息:Linux
  4. Python版本号:Python3.10
  5. CUDA/cuDNN版本:CUDA11.3
  6. 在进行export 模型的时候: python myexport_models.py --model_dir /home/app/changedetect/PaddleRS-develop/tutorials/train/change_detection/output/bit_resnet18/epoch_150 --save_dir exportouttest --fixed_input_shape [-1,3,256,256]

    Traceback (most recent call last): File "/home/app/changedetect/PaddleRS-develop/myexport_models.py", line 77, in model._export_inference_model(args.save_dir, fixed_input_shape) File "/home/app/changedetect/PaddleRS-develop/paddlers/tasks/base.py", line 647, in _export_inference_model paddle.jit.save(static_net, osp.join(save_dir, 'model')) File "/disk1/anaconda3/envs/paddlepy310/lib/python3.10/site-packages/decorator.py", line 232, in fun return caller(func, *(extras + args), kw) File "/disk1/anaconda3/envs/paddlepy310/lib/python3.10/site-packages/paddle/fluid/wrapped_decorator.py", line 26, in impl return wrapped_func(args, kwargs) File "/disk1/anaconda3/envs/paddlepy310/lib/python3.10/site-packages/paddle/fluid/dygraph/jit.py", line 649, in wrapper func(layer, path, input_spec, configs) File "/disk1/anaconda3/envs/paddlepy310/lib/python3.10/site-packages/decorator.py", line 232, in fun return caller(func, (extras + args), kw) File "/disk1/anaconda3/envs/paddlepy310/lib/python3.10/site-packages/paddle/fluid/wrapped_decorator.py", line 26, in impl return wrapped_func(*args, *kwargs) File "/disk1/anaconda3/envs/paddlepy310/lib/python3.10/site-packages/paddle/fluid/dygraph/base.py", line 67, in impl return func(args, **kwargs) File "/disk1/anaconda3/envs/paddlepy310/lib/python3.10/site-packages/paddle/fluid/dygraph/jit.py", line 927, in save concrete_program = static_func.concrete_program_specify_input_spec( File "/disk1/anaconda3/envs/paddlepy310/lib/python3.10/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 577, in concrete_program_specify_input_spec concreteprogram, = self.get_concrete_program( File "/disk1/anaconda3/envs/paddlepy310/lib/python3.10/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 470, in get_concrete_program args, kwargs = self._function_spec.unified_args_and_kwargs( File "/disk1/anaconda3/envs/paddlepy310/lib/python3.10/site-packages/paddle/fluid/dygraph/dygraph_to_static/function_spec.py", line 82, in unified_args_and_kwargs raise ValueError(error_msg) ValueError: The decorated function forward requires 1 arguments: ['x'], but received 2 with (InputSpec(shape=(-1, 3, 256, 256), dtype=paddle.float32, name=image), InputSpec(shape=(-1, 3, 256, 256), dtype=paddle.float32, name=image2)).

kidcad1412 commented 11 months ago

change_detector.py(103)_get_test_inputs():

    def _get_test_inputs(self, image_shape):
        if image_shape is not None:
            if len(image_shape) == 2:
                image_shape = [1, 3] + image_shape
            self._fix_transforms_shape(image_shape[-2:])
        else:
            image_shape = [None, 3, -1, -1]
        self.fixed_input_shape = image_shape
        return [
            InputSpec(
                shape=image_shape, name='image', dtype='float32'), InputSpec(
                    shape=image_shape, name='image2', dtype='float32')
        ]

这里返回的一个list,export模型时:

ValueError(error_msg) ValueError: The decorated function forwardrequires 1 arguments: ['x'], but received 2 with (InputSpec(shape=(-1, 3, 256, 256), dtype=paddle.float32, name=image), InputSpec(shape=(-1, 3, 256, 256), dtype=paddle.float32, name=image2))

kidcad1412 commented 11 months ago

已解决,paddlers 版本的问题

github-actions[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.