尝试matting中的pp-mattingv2模型测试以及训练报错
yuqilol opened this issue · 5 comments
问题确认 Search before asking
- 我已经搜索过问题,但是没有找到解答。I have searched the question and found no related answer.
请提出你的问题 Please ask your question
问题一:我尝试直接使用demo却没有出现结果
问题二:我尝试训练出现trans_info为负值的错误
使用环境:linux 3090 python 3.9
配置环境:Package Version
anyio 4.4.0
astor 0.8.1
Babel 2.15.0
bce-python-sdk 0.9.17
blinker 1.8.2
certifi 2024.7.4
charset-normalizer 3.3.2
click 8.1.7
contourpy 1.2.1
cycler 0.12.1
decorator 5.1.1
exceptiongroup 1.2.1
filelock 3.15.4
Flask 3.0.3
flask-babel 4.0.0
fonttools 4.53.0
future 1.0.0
h11 0.14.0
httpcore 1.0.5
httpx 0.27.0
idna 3.7
imageio 2.34.2
importlib_metadata 8.0.0
importlib_resources 6.4.0
itsdangerous 2.2.0
Jinja2 3.1.4
joblib 1.4.2
kiwisolver 1.4.5
lazy_loader 0.4
llvmlite 0.43.0
MarkupSafe 2.1.5
matplotlib 3.9.0
networkx 3.2.1
numba 0.60.0
numpy 2.0.0
opencv-python 4.10.0.84
opt-einsum 3.3.0
packaging 24.1
paddlepaddle 2.6.1
paddleseg 2.8.0
pandas 2.2.2
pillow 10.4.0
pip 24.0
prettytable 3.10.0
protobuf 5.27.2
psutil 6.0.0
pycryptodome 3.20.0
PyMatting 1.1.12
pyparsing 3.1.2
python-dateutil 2.9.0.post0
pytz 2024.1
PyYAML 6.0.1
rarfile 4.2
requests 2.32.3
scikit-image 0.24.0
scikit-learn 1.5.0
scipy 1.13.1
setuptools 69.5.1
six 1.16.0
sniffio 1.3.1
threadpoolctl 3.5.0
tifffile 2024.7.2
tqdm 4.66.4
typing_extensions 4.12.2
tzdata 2024.1
urllib3 2.2.2
visualdl 2.5.3
wcwidth 0.2.13
Werkzeug 3.0.3
wheel 0.43.0
zipp 3.19.2
————————————
问题二报错:
Traceback (most recent call last):
File "/data1/home/pengyuling/paddle-seg/PaddleSeg-release-2.9/Matting/tools/train.py", line 220, in
main(args)
File "/data1/home/pengyuling/paddle-seg/PaddleSeg-release-2.9/Matting/tools/train.py", line 198, in main
train(
File "/data1/home/pengyuling/paddle-seg/PaddleSeg-release-2.9/Matting/tools/../ppmatting/core/train.py", line 307, in train
metrics_data = evaluate(
File "/data1/home/pengyuling/paddle-seg/PaddleSeg-release-2.9/Matting/tools/../ppmatting/core/val.py", line 120, in evaluate
alpha_pred = reverse_transform(alpha_pred, data['trans_info'])
File "/data1/home/pengyuling/paddle-seg/PaddleSeg-release-2.9/Matting/tools/../ppmatting/core/val.py", line 46, in reverse_transform
alpha = F.interpolate(alpha, [h, w], mode='bilinear')
File "/data1/home/pengyuling/.conda/envs/paddle_seg/lib/python3.9/site-packages/paddle/nn/functional/common.py", line 520, in interpolate
assert (
AssertionError: Each dimension size given in out_shape must be greater than 0.
问题一
指令:python tools/predict.py --config configs/ppmattingv2/ppmattingv2-stdc1-human_512.yml --model_path checkpoint/ppmattingv2-stdc1-human_512.pdparams --image_path demo/human.jpg --save_dir ./output/results --fg_estimate True
输出结果:2024-07-10 15:03:57 [INFO] Set device: cpu
2024-07-10 15:03:57 [INFO] Use the following config to build model
model:
backbone:
pretrained: https://bj.bcebos.com/paddleseg/dygraph/PP_STDCNet1.tar.gz
type: STDC1
decoder_channels:
- 128
- 96
- 64
- 32
- 16
dpp_merge_type: add
dpp_output_channel: 256
head_channel: 8
type: PPMattingV2
2024-07-10 15:03:57 [INFO] Loading pretrained model from https://bj.bcebos.com/paddleseg/dygraph/PP_STDCNet1.tar.gz
2024-07-10 15:03:57 [INFO] There are 145/145 variables loaded into STDCNet.
2024-07-10 15:03:57 [INFO] Number of predict images = 1
2024-07-10 15:03:57 [INFO] Loading pretrained model from checkpoint/ppmattingv2-stdc1-human_512.pdparams
2024-07-10 15:03:57 [INFO] There are 485/485 variables loaded into PPMattingV2.
2024-07-10 15:03:57 [INFO] Start to predict...
size : [128, 248]
size : [256, 496]
1/1 [==============================] - 1s 1s/step - preprocess_cost: 0.0193 - infer_cost cost: 1.1970 - postprocess_cost: 0.1122
输出结果如上
问题二新的报错内存泄漏:
Traceback (most recent call last):
File "/data1/home/pengyuling/paddle-seg/PaddleSeg-release-2.9/Matting/tools/train.py", line 220, in
main(args)
File "/data1/home/pengyuling/paddle-seg/PaddleSeg-release-2.9/Matting/tools/train.py", line 198, in main
train(
File "/data1/home/pengyuling/paddle-seg/PaddleSeg-release-2.9/Matting/tools/../ppmatting/core/train.py", line 307, in train
metrics_data = evaluate(
File "/data1/home/pengyuling/paddle-seg/PaddleSeg-release-2.9/Matting/tools/../ppmatting/core/val.py", line 120, in evaluate
alpha_pred = reverse_transform(alpha_pred, data['trans_info'])
File "/data1/home/pengyuling/paddle-seg/PaddleSeg-release-2.9/Matting/tools/../ppmatting/core/val.py", line 46, in reverse_transform
alpha = F.interpolate(alpha, [h, w], mode='bilinear')
File "/data1/home/pengyuling/.conda/envs/paddle_seg/lib/python3.9/site-packages/paddle/nn/functional/common.py", line 642, in interpolate
out = _C_ops.bilinear_interp(
MemoryError: (ResourceExhausted) Fail to alloc memory of 273663081118172160 size, error code is 12.
[Hint: Expected error == 0, but received error:12 != 0:0.] (at /paddle/paddle/fluid/memory/allocation/cpu_allocator.cc:50)
怀疑是这两行的原因
2024-07-10 17:12:01 [INFO] Set device: cpu
2024-07-10 17:12:01 [INFO] Use the following config to build model