PaddlePaddle / PaddleRS

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

运行PaddleRS项目,报错 #178

Closed jiangming7301 closed 1 month ago

jiangming7301 commented 7 months ago

项目链接:https://aistudio.baidu.com/projectdetail/4967734?channelType=0&channel=0 fork项目后,运行到构建模型,报以下错误: Can not use conditional_random_field. Please install pydensecrf first. Can not import map_display. This is probably because GDAL is not properly installed. Warning: import ppdet from source directory without installing, run 'python setup.py install' to install ppdet firstly

ImportError Traceback (most recent call last) Cell In[7], line 2 1 # 导入PaddleRS库 ----> 2 import paddlers as pdrs 4 # 调用PaddleRS API一键构建模型 5 model = pdrs.tasks.cd.BIT( 6 # 模型输出类别数 7 num_classes=2, (...) 33 dec_head_dim=8 34 )

File ~/PaddleRS/paddlers/init.py:18 15 import os 17 from paddlers.utils.env import get_environ_info, init_parallel_env ---> 18 from . import tasks, datasets, transforms, utils, tools, models, deploy 20 init_parallel_env() 21 env_info = get_environ_info()

File ~/PaddleRS/paddlers/tasks/init.py:15 1 # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); (...) 12 # See the License for the specific language governing permissions and 13 # limitations under the License. ---> 15 import paddlers.tasks.object_detector as detector 16 import paddlers.tasks.segmenter as segmenter 17 import paddlers.tasks.change_detector as change_detector

File ~/PaddleRS/paddlers/tasks/object_detector.py:35 33 import paddlers.utils.logging as logging 34 from paddlers.utils.checkpoint import det_pretrain_weights_dict ---> 35 from .base import BaseModel 36 from .utils.det_metrics import VOCMetric, COCOMetric, RBoxMetric 38 all = [ 39 "YOLOv3", 40 "FasterRCNN", (...) 46 "PPYOLOE_R", 47 ]

File ~/PaddleRS/paddlers/tasks/base.py:27 25 import paddle 26 from paddle.io import DataLoader, DistributedBatchSampler ---> 27 from paddleslim import QAT 28 from paddleslim.analysis import flops 29 from paddleslim import L1NormFilterPruner, FPGMFilterPruner

File /opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddleslim/init.py:16 1 # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License" (...) 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 15 from future import absolute_import ---> 16 from paddleslim import models 17 from paddleslim import prune 18 from paddleslim import nas

File /opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddleslim/models/init.py:16 1 # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License" (...) 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 15 from future import absolute_import ---> 16 from .util import image_classification 17 from .slimfacenet import SlimFaceNet_A_x0_60, SlimFaceNet_B_x0_75, SlimFaceNet_C_x0_75 18 from .slim_mobilenet import SlimMobileNet_v1, SlimMobileNet_v2, SlimMobileNet_v3, SlimMobileNet_v4, SlimMobileNet_v5

File /opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddleslim/models/util.py:3 1 from future import absolute_import 2 import paddle.fluid as fluid ----> 3 from ..models import classification_models 5 all = ["image_classification"] 7 model_list = classification_models.model_list

File /opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddleslim/models/classification_models.py:2 1 from future import absolute_import ----> 2 from .mobilenet import MobileNet 3 from .resnet import ResNet34, ResNet50 4 from .mobilenet_v2 import MobileNetV2

File /opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddleslim/models/mobilenet.py:5 3 from future import print_function 4 import paddle.fluid as fluid ----> 5 from paddle.fluid.initializer import MSRA 6 from paddle.fluid.param_attr import ParamAttr 8 all = ['MobileNet']

ImportError: cannot import name 'MSRA' from 'paddle.fluid.initializer' (/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddle/fluid/initializer.py)

Bobholamovic commented 7 months ago

PaddleRS 1.0不兼容Paddle 2.5,需要安装PaddleRS develop版本以及PaddleSlim develop版本~

jiangming7301 commented 7 months ago

模型训练完,导出模型报错:信息如下:

Can not use conditional_random_field. Please install pydensecrf first. Can not import map_display. This is probably because GDAL is not properly installed. Warning: import ppdet from source directory without installing, run 'python setup.py install' to install ppdet firstly Traceback (most recent call last): File "/home/aistudio/PaddleRS/deploy/export/export_model.py", line 19, in from paddlers.tasks import load_model File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddlers/init.py", line 18, in from . import tasks, datasets, transforms, utils, tools, models, deploy File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddlers/tasks/init.py", line 15, in import paddlers.tasks.object_detector as detector File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddlers/tasks/object_detector.py", line 35, in from .base import BaseModel File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddlers/tasks/base.py", line 27, in from paddleslim import QAT File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddleslim/init.py", line 16, in from paddleslim import models File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddleslim/models/init.py", line 16, in from .util import image_classification File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddleslim/models/util.py", line 3, in from ..models import classification_models File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddleslim/models/classification_models.py", line 2, in from .mobilenet import MobileNet File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddleslim/models/mobilenet.py", line 5, in from paddle.fluid.initializer import MSRA ImportError: cannot import name 'MSRA' from 'paddle.fluid.initializer' (/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddle/fluid/initializer.py)

jiangming7301 commented 7 months ago

!python PaddleRS/deploy/export/export_model.py --model_dir=exp/best_model --save_dir=exp/best_model/static --fixed_input_shape [-1,3,256,256]模型导出命令

jiangming7301 commented 7 months ago

有没有解决方法

jiangming7301 commented 7 months ago

有没有人帮处理啊?

jiangming7301 commented 7 months ago

有没有人帮处理啊?

Bobholamovic commented 5 months ago

PaddleRS 1.0不兼容Paddle 2.5,需要安装PaddleRS develop版本以及PaddleSlim develop版本~

你好,是版本问题哈,参考我的这个回答

github-actions[bot] commented 2 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.