PaddleRS
PaddleRS copied to clipboard
[Bug] 'dict' object has no attribute 'net'
我在本地运行给的变化检测的例子时,在运行run_task.py进行训练的时候,报错如下:
...
use_vdl: True
2023-04-17 20:20:17 [INFO] 1024 samples in file ./data/levircd/val.txt
2023-04-17 20:20:20 [INFO] 7120 samples in file ./data/levircd/train.txt
Traceback (most recent call last):
File "run_task.py", line 108, in
我这边好像没办法复现这个问题。请问你修改了代码嘛?如果没有修改的话,请提供使用的PaddleRS版本~
是因为版本问题吗? (paddle_env) PS D:\Change-detection-using-deep-learning-in-remote-sensing\PyCharmProjects> conda list paddlers packages in environment at C:\Users\lx\anaconda3\envs\paddle_env: Name Version Build Channel paddlers 1.0b0 pypi_0 pypi
- 后来,我将paddlers clone 到了本地,使用脚本训练train_cd.py和预测predict_cd.py成功跑通。
- 但是,如您所见,使用run_task.py时报错AttributeError: 'dict' object has no attribute 'net'。
- 详细记录如下:
(paddle_env) PS D:\Change-detection-using-deep-learning-in-remote-sensing\PyCharmProjects> python run_task.py train cd --config "D:/Change-detection-using-deep-learning-in-remote-sensing
/PyCharmProjects/data/levircd/configs/levircd/levircd.yaml" 2>&1 | tee "D:/Change-detection-using-deep-learning-in-remote-sensing/PyCharmProjects/logs/try_logs.txt"
python : C:\Users\lx\anaconda3\envs\paddle_env\lib\site-packages\pkg_resources\__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
所在位置 行:1 字符: 1
+ python run_task.py train cd --config "D:/Change-detection-using-deep- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (C:\Users\lx\ana...cated as an API:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
C:\Users\lx\anaconda3\envs\paddle_env\lib\site-packages\pkg_resources\__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#k
eyword-namespace-packages
declare_namespace(pkg)
C:\Users\lx\anaconda3\envs\paddle_env\lib\site-packages\pkg_resources\__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google.cloud')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#k
eyword-namespace-packages
declare_namespace(pkg)
C:\Users\lx\anaconda3\envs\paddle_env\lib\site-packages\pkg_resources\__init__.py:2349: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#k
eyword-namespace-packages
declare_namespace(parent)
C:\Users\lx\anaconda3\envs\paddle_env\lib\site-packages\pkg_resources\__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google.logging')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#k
eyword-namespace-packages
declare_namespace(pkg)
C:\Users\lx\anaconda3\envs\paddle_env\lib\site-packages\pkg_resources\__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#k
eyword-namespace-packages
declare_namespace(pkg)
C:\Users\lx\anaconda3\envs\paddle_env\lib\site-packages\pkg_resources\__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('zope')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#k
eyword-namespace-packages
declare_namespace(pkg)
D:\Change-detection-using-deep-learning-in-remote-sensing\PyCharmProjects\paddlers\transforms\functions.py:57: DeprecationWarning: invalid escape sequence \
"""
D:\Change-detection-using-deep-learning-in-remote-sensing\PyCharmProjects\paddlers\transforms\functions.py:169: DeprecationWarning: invalid escape sequence \
"""
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: Unable to use OC-SORT, please install filterpy, for example: `pip install filterpy`, see https://github.com/rlabbe/filterpy
Warning: import ppdet from source directory without installing, run 'python setup.py install' to install ppdet firstly
2023-04-19 10:57:00,483-WARNING: post-quant-hpo is not support in system other than linux
cmd: train
config: D:/Change-detection-using-deep-learning-in-remote-sensing/PyCharmProjects/data/levircd/configs/levircd/levircd.yaml
datasets:
eval:
type: CDDataset
module:
args:
binarize_labels: True
data_dir: ./data/levircd/
file_list: ./data/levircd/val.txt
label_list: None
num_workers: 0
shuffle: False
with_seg_labels: False
train:
type: CDDataset
module:
args:
binarize_labels: True
data_dir: ./data/levircd/
file_list: ./data/levircd/train.txt
label_list: None
num_workers: 2
shuffle: True
with_seg_labels: False
download_on: False
download_path: ./
download_url:
early_stop: False
early_stop_patience: 5
inherit_off: False
learning_rate: 0.002
log_interval_steps: 50
losses:
model:
num_epochs: 50
optimizer:
type: Adam
module:
args:
learning_rate:
type: StepDecay
module: paddle.optimizer.lr
args:
gamma: 0.2
learning_rate: 0.002
step_size: 35000
resume_checkpoint:
save_dir: ./exp/levircd/
save_interval_epochs: 5
seed: None
task: cd
train:
train_batch_size: 8
transforms:
eval:
-
type: DecodeImg
module:
args:
-
type: Normalize
module:
args:
mean:
- 0.5
- 0.5
- 0.5
std:
- 0.5
- 0.5
- 0.5
train:
-
type: DecodeImg
module:
args:
-
type: RandomFlipOrRotate
module:
args:
probs:
- 0.35
- 0.35
probsf:
- 0.5
- 0.5
- 0
- 0
- 0
probsr:
- 0.33
- 0.34
- 0.33
-
type: Normalize
module:
args:
mean:
- 0.5
- 0.5
- 0.5
std:
- 0.5
- 0.5
- 0.5
use_vdl: True
2023-04-19 10:57:00 [INFO] 1024 samples in file ./data/levircd/val.txt
2023-04-19 10:57:02 [INFO] 7120 samples in file ./data/levircd/train.txt
Traceback (most recent call last):
File "run_task.py", line 108, in <module>
cfg['optimizer'].args['parameters'] = model.net.parameters()
AttributeError: 'dict' object has no attribute 'net'
看起来你用的是1.0-beta版本,examples/rs_research
仅支持1.0正式版以上的版本,请根据文档安装~