请问在预测时operator < conv2d_fusion > error解法。
跑的paddle3D的课程SMOKE代码
/home/aistudio/Paddle3D/deploy/smoke/python
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/init.py:107: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import MutableMapping
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/rcsetup.py:20: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import Iterable, Mapping
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/colors.py:53: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import Sized
2022-12-27 14:49:26,456 - WARNING - VoVNet exists already! It is now updated to <class 'paddle3d.models.backbones.vovnetcp.VoVNet'> !!!
W1227 14:49:27.991358 4514 analysis_predictor.cc:1391] The one-time configuration of analysis predictor failed, which may be due to native predictor called first and its configurations taken effect.
--- Running analysis [ir_graph_build_pass]
--- Running analysis [ir_graph_clean_pass]
--- Running analysis [ir_analysis_pass]
--- Running IR pass [is_test_pass]
--- Running IR pass [simplify_with_basic_ops_pass]
--- Running IR pass [conv_bn_fuse_pass]
I1227 14:49:31.269383 4514 fuse_pass_base.cc:59] --- detected 305 subgraphs
--- Running IR pass [conv_eltwiseadd_bn_fuse_pass]
--- Running IR pass [embedding_eltwise_layernorm_fuse_pass]
--- Running IR pass [multihead_matmul_fuse_pass_v2]
--- Running IR pass [fused_multi_transformer_encoder_pass]
--- Running IR pass [fused_multi_transformer_decoder_pass]
--- Running IR pass [fused_multi_transformer_encoder_fuse_qkv_pass]
--- Running IR pass [fused_multi_transformer_decoder_fuse_qkv_pass]
--- Running IR pass [multi_devices_fused_multi_transformer_encoder_fuse_qkv_pass]
--- Running IR pass [multi_devices_fused_multi_transformer_decoder_fuse_qkv_pass]
--- Running IR pass [fuse_multi_transformer_layer_pass]
--- Running IR pass [gpu_cpu_squeeze2_matmul_fuse_pass]
--- Running IR pass [gpu_cpu_reshape2_matmul_fuse_pass]
--- Running IR pass [gpu_cpu_flatten2_matmul_fuse_pass]
--- Running IR pass [gpu_cpu_map_matmul_v2_to_mul_pass]
--- Running IR pass [gpu_cpu_map_matmul_v2_to_matmul_pass]
I1227 14:49:35.848932 4514 fuse_pass_base.cc:59] --- detected 1 subgraphs
--- Running IR pass [matmul_scale_fuse_pass]
--- Running IR pass [multihead_matmul_fuse_pass_v3]
--- Running IR pass [gpu_cpu_map_matmul_to_mul_pass]
--- Running IR pass [fc_fuse_pass]
--- Running IR pass [fc_elementwise_layernorm_fuse_pass]
--- Running IR pass [conv_elementwise_add_act_fuse_pass]
--- Running IR pass [conv_elementwise_add2_act_fuse_pass]
--- Running IR pass [conv_elementwise_add_fuse_pass]
I1227 14:49:38.291522 4514 fuse_pass_base.cc:59] --- detected 165 subgraphs
--- Running IR pass [transpose_flatten_concat_fuse_pass]
--- Running IR pass [constant_folding_pass]
--- Running IR pass [runtime_context_cache_pass]
--- Running analysis [ir_params_sync_among_devices_pass]
I1227 14:49:38.658762 4514 ir_params_sync_among_devices_pass.cc:89] Sync params from CPU to GPU
--- Running analysis [adjust_cudnn_workspace_size_pass]
--- Running analysis [inference_op_replace_pass]
--- Running analysis [memory_optimize_pass]
I1227 14:49:38.768163 4514 memory_optimize_pass.cc:219] Cluster name : samples_2_slice_1 size: 8
I1227 14:49:38.768214 4514 memory_optimize_pass.cc:219] Cluster name : samples_0 size: 12
I1227 14:49:38.768218 4514 memory_optimize_pass.cc:219] Cluster name : samples_1 size: 36
I1227 14:49:38.768227 4514 memory_optimize_pass.cc:219] Cluster name : atan_1.tmp_0 size: 200
I1227 14:49:38.768230 4514 memory_optimize_pass.cc:219] Cluster name : relu_268.tmp_0 size: 1024
I1227 14:49:38.768240 4514 memory_optimize_pass.cc:219] Cluster name : reshape2_10.tmp_0 size: 2000
I1227 14:49:38.768251 4514 memory_optimize_pass.cc:219] Cluster name : concat_5.tmp_0 size: 400
I1227 14:49:38.768258 4514 memory_optimize_pass.cc:219] Cluster name : gather_nd_3.tmp_0 size: 2000
I1227 14:49:38.768266 4514 memory_optimize_pass.cc:219] Cluster name : top_k_v2_1.tmp_1 size: 400
I1227 14:49:38.768273 4514 memory_optimize_pass.cc:219] Cluster name : samples_2 size: 8
I1227 14:49:38.768280 4514 memory_optimize_pass.cc:219] Cluster name : tmp_71 size: 600
I1227 14:49:38.768287 4514 memory_optimize_pass.cc:219] Cluster name : reshape2_10.tmp_0_slice_3 size: 400
I1227 14:49:38.768294 4514 memory_optimize_pass.cc:219] Cluster name : top_k_v2_1.tmp_0 size: 200
I1227 14:49:38.768301 4514 memory_optimize_pass.cc:219] Cluster name : tmp_96 size: 200
I1227 14:49:38.768307 4514 memory_optimize_pass.cc:219] Cluster name : conv2d_616.tmp_1 size: 1024
I1227 14:49:38.768314 4514 memory_optimize_pass.cc:219] Cluster name : tmp_74 size: 200
--- Running analysis [ir_graph_to_program_pass]
I1227 14:49:39.018453 4514 analysis_predictor.cc:1314] ======= optimize end =======
I1227 14:49:39.033661 4514 naive_executor.cc:110] --- skip [feed], feed -> samples_2
I1227 14:49:39.033720 4514 naive_executor.cc:110] --- skip [feed], feed -> samples_1
I1227 14:49:39.033723 4514 naive_executor.cc:110] --- skip [feed], feed -> samples_0
I1227 14:49:39.041489 4514 naive_executor.cc:110] --- skip [concat_8.tmp_0], fetch -> fetch
W1227 14:49:39.072836 4514 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.2, Runtime API Version: 11.2
W1227 14:49:39.076715 4514 gpu_resources.cc:91] device: 0, cuDNN Version: 8.2.
Traceback (most recent call last):
File "vis.py", line 122, in Input contains uninitialized Tensor.
[Hint: Expected t->IsInitialized() == true, but received t->IsInitialized():0 != true:1.] (at /paddle/paddle/fluid/framework/operator.cc:2411)
[operator < conv2d_fusion > error]
@David-dotcom666 你运行的预测命令麻烦给下
@David-dotcom666 你运行的预测命令麻烦给下 ! python vis.py --model_file /home/aistudio/Paddle3D/demo/smoke_hrnet18_no_dcn_kitti_model/inference.pdmodel
--params_file /home/aistudio/Paddle3D/demo/smoke_hrnet18_no_dcn_kitti_model/inference.pdiparams
--image /home/aistudio/Paddle3D/demo/000248.png
--use_gpu 感谢
@David-dotcom666 我这边用自己的环境试了下是可以正常运行的,看你的路径应该是aistudio上的项目,是否方便公开下你的教程我试试看呢?
@nepeplwu https://aistudio.baidu.com/aistudio/projectdetail/5322780?contributionType=1&sUid=328397&shared=1&ts=1672823591342 谢谢
我也遇到了这个问题,我尝试了各个版本的paddle都失败了,请问你这个问题解决了吗
@David-dotcom666 @peanutpaste 这个问题的原因是因为教程中所用的模型的输入名字和推理脚本对不上,导致推理时没有正确喂入数据从而报错,按照 @David-dotcom666 给的教程,需要将Paddle3D/deploy/smoke/python/infer.py进行以下修改即可跑通
def run(predictor, image, K, down_ratio):
# copy img data to input tensor
input_names = predictor.get_input_names()
for i, name in enumerate(input_names):
input_tensor = predictor.get_input_handle(name)
if name == "samples_0":
input_tensor.reshape(image.shape)
input_tensor.copy_from_cpu(image.copy())
elif name == "samples_1":
input_tensor.reshape(K.shape)
input_tensor.copy_from_cpu(K.copy())
elif name == "samples_2":
input_tensor.reshape(down_ratio.shape)
input_tensor.copy_from_cpu(down_ratio.copy())
# do the inference
predictor.run()
results = []
# get out data from output tensor
output_names = predictor.get_output_names()
for i, name in enumerate(output_names):
output_tensor = predictor.get_output_handle(name)
output_data = output_tensor.copy_to_cpu()
results.append(output_data)
return results