Yzichen / FlashOCC

Apache License 2.0
296 stars 31 forks source link

AttributeError: 'Tensor' object has no attribute 'astype' #70

Open shaozheng777 opened 1 month ago

shaozheng777 commented 1 month ago
          > What is your test cmd

python tools/test.py /home/wh/code/FlashOCC/projects/configs/flashocc/flashocc-stbase-4d-stereo-512x1408_4x4_1e-2.py /home/wh/code/FlashOCC/ckpts/flashocc-stbase-4d-stereo-512x1408.pth --eval mAP

Originally posted by @shaozheng777 in https://github.com/Yzichen/FlashOCC/issues/66#issuecomment-2384702322

shaozheng777 commented 1 month ago

Hi, thank you for your great work! But when I tested another model, I encountered the following problems.

Starting Evaluation... 0%| | 0/162 [00:00<?, ?it/s] Traceback (most recent call last): File "tools/test.py", line 290, in main() File "tools/test.py", line 286, in main print(dataset.evaluate(outputs, *eval_kwargs)) File "/home/wh/code/FlashOCC/projects/mmdet3d_plugin/datasets/nuscenes_dataset_occ.py", line 140, in evaluate self.occ_eval_metrics.add_batch( File "/home/wh/code/FlashOCC/projects/mmdet3d_plugin/core/evaluation/occ_metrics.py", line 152, in addbatch , _hist = self.compute_mIoU(masked_semantics_pred, masked_semantics_gt, self.num_classes) File "/home/wh/code/FlashOCC/projects/mmdet3d_plugin/core/evaluation/occ_metrics.py", line 121, in compute_mIoU new_hist, correct, labeled = self.hist_info(n_classes, pred.flatten(), label.flatten()) File "/home/wh/code/FlashOCC/projects/mmdet3d_plugin/core/evaluation/occ_metrics.py", line 100, in hist_info n_cl gt[k].astype(int) + pred[k].astype(int), minlength=n_cl ** 2 AttributeError: 'Tensor' object has no attribute 'astype'

drilistbox commented 1 month ago

Have you pull the latest code?

xuanzhangyang commented 3 weeks ago

projects/mmdet3d_plugin/core/evaluation/occ_metrics.py:

n_cl * gt[k].astype(int) + pred[k].astype(int), minlength=n_cl * 2 to n_cl gt[k].astype(int) + pred[k].cpu().numpy().astype(int), minlength=n_cl ** 2