本文主要是介绍Dimension out of range 等报错解决,可以加拼接后的深度特征提取了,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
报错
Extracting test features for class bagel: 0%| | 0/110 [00:00<?, ?it/s]
Traceback (most recent call last):File "/home/cszx/c1/zgp/3D-ADS-main/patchcore_runner.py", line 46, in evaluatemethod.predict(sample, mask, label)File "/home/cszx/c1/zgp/3D-ADS-main/feature_extractors/rgb_fpfh_sim_features.py", line 49, in predictconcat_patch_maps_resized = self.resize(self.average(concat_patch))File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_implreturn forward_call(*input, **kwargs)File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/torch/nn/modules/pooling.py", line 628, in forward
python-BaseExceptionself.padding, self.ceil_mode, self.count_include_pad, self.divisor_override)
IndexError: Dimension out of range (expected to be in range of [-2, 1], but got -3)
去掉self.average
报错
concat_patch_maps_resized = self.resize(concat_patch)File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_implreturn forward_call(*input, **kwargs)File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/torch/nn/modules/pooling.py", line 1184, in forwardreturn F.adaptive_avg_pool2d(input, self.output_size)File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/torch/nn/functional.py", line 1213, in adaptive_avg_pool2d_output_size = _list_with_default(output_size, input.size())File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/torch/nn/modules/utils.py", line 37, in _list_with_default"Input dimension should be at least {}".format(len(out_size) + 1)
ValueError: Input dimension should be at least 3
python-BaseException
去掉concat的resize
报错
Extracting test features for class bagel: 0%| | 0/110 [00:00<?, ?it/s]
Traceback (most recent call last):
File “/home/cszx/c1/zgp/3D-ADS-main/main.py”, line 69, in
run_3d_ads()
File “/home/cszx/c1/zgp/3D-ADS-main/main.py”, line 28, in run_3d_ads
image_rocaucs, pixel_rocaucs, au_pros = patchcore.evaluate(cls)
File “/home/cszx/c1/zgp/3D-ADS-main/patchcore_runner.py”, line 46, in evaluate
method.predict(sample, mask, label)
File “/home/cszx/c1/zgp/3D-ADS-main/feature_extractors/rgb_fpfh_sim_features.py”, line 53, in predict
self.compute_s_s_map(concat_patch, concat_feature_maps.shape[-2:], mask, label)
File “/home/cszx/c1/zgp/3D-ADS-main/feature_extractors/features.py”, line 92, in compute_s_s_map
s_map = min_val.view(1, 1, *feature_map_dims)
RuntimeError: shape ‘[1, 1, 28, 28]’ is invalid for input of size 1569
需要由784变成1,1,28,28而不是1569
rgb_fpfh_sim_features两处交换784和1569,转置 concat_patch = self.network(concat_patch).T
这篇关于Dimension out of range 等报错解决,可以加拼接后的深度特征提取了的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!