报错
Traceback (most recent call last):
File "/home/cszx/c1/zgp/3D-ADS-main/main.py", line 68, in <module>
run_3d_ads()
File "/home/cszx/c1/zgp/3D-ADS-main/main.py", line 27, 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 44, in predict
concat_patch = self.network(concat_patch)
File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/cszx/c1/zgp/3D-ADS-main/feature_extractors/features.py", line 24, in forward
x = self.fc1(x)
File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 114, in forward
return F.linear(input, self.weight, self.bias)
RuntimeError: mat1 and mat2 must have the same dtype
concat_patch = concat_patch.float() # 确保输入数据是float32类型
output = self.network(concat_patch)
报错
RuntimeError: mat1 and mat2 shapes cannot be multiplied (784x1569 and 784x128)
.T转置
报错
File "/home/cszx/c1/zgp/3D-ADS-main/main.py", line 26, in run_3d_ads
patchcore.fit(cls)
File "/home/cszx/c1/zgp/3D-ADS-main/patchcore_runner.py", line 36, in fit
method.run_coreset()
File "/home/cszx/c1/zgp/3D-ADS-main/feature_extractors/features.py", line 117, in run_coreset
eps=self.coreset_eps, )
File "/home/cszx/c1/zgp/3D-ADS-main/feature_extractors/features.py", line 137, in get_coreset_idx_randomp
z_lib = torch.tensor(transformer.fit_transform(z_lib))
File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/sklearn/base.py", line 852, in fit_transform
return self.fit(X, **fit_params).transform(X)
File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/sklearn/random_projection.py", line 347, in fit
X = self._validate_data(X, accept_sparse=["csr", "csc"])
File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/sklearn/base.py", line 566, in _validate_data
X = check_array(X, **check_params)
File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/sklearn/utils/validation.py", line 746, in check_array
array = np.asarray(array, order=order, dtype=dtype)
File "/home/cszx/miniconda3/envs/zgp_3dads/lib/python3.7/site-packages/torch/_tensor.py", line 956, in __array__
return self.numpy()
RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.
z_lib = torch.tensor(transformer.fit_transform(z_lib.detach()))
可以了
running coreset for RGB + FPFH+simplenet on class bagel…
Fitting random projections. Start dim = torch.Size([382836, 784]).
DONE. Transformed dim = torch.Size([382836, 317]).