PoinTr icon indicating copy to clipboard operation
PoinTr copied to clipboard

Hello, I encountered a problem during testing, as follows

Open huyanbi opened this issue 1 year ago • 8 comments

`(pointr) root@I1217f58864008015fe:/hy-tmp/PoinTr# bash ./scripts/test.sh 0 --ckpts ./PCN_models/example/ckpt-best.pth --config ./cfgs/PCN_models/PoinTr.yaml --exp_name example

  • GPUS=0
  • PY_ARGS='--ckpts ./PCN_models/example/ckpt-best.pth --config ./cfgs/PCN_models/PoinTr.yaml --exp_name example'
  • CUDA_VISIBLE_DEVICES=0
  • python main.py --test --ckpts ./PCN_models/example/ckpt-best.pth --config ./cfgs/PCN_models/PoinTr.yaml --exp_name example 2023-04-24 15:56:24,063 - PoinTr - INFO - Copy the Config file from ./cfgs/PCN_models/PoinTr.yaml to ./experiments/PoinTr/PCN_models/test_example/config.yaml 2023-04-24 15:56:24,063 - PoinTr - INFO - args.config : ./cfgs/PCN_models/PoinTr.yaml 2023-04-24 15:56:24,063 - PoinTr - INFO - args.launcher : none 2023-04-24 15:56:24,064 - PoinTr - INFO - args.local_rank : 0 2023-04-24 15:56:24,064 - PoinTr - INFO - args.num_workers : 4 2023-04-24 15:56:24,064 - PoinTr - INFO - args.seed : 0 2023-04-24 15:56:24,064 - PoinTr - INFO - args.deterministic : False 2023-04-24 15:56:24,064 - PoinTr - INFO - args.sync_bn : False 2023-04-24 15:56:24,064 - PoinTr - INFO - args.exp_name : test_example 2023-04-24 15:56:24,064 - PoinTr - INFO - args.start_ckpts : None 2023-04-24 15:56:24,064 - PoinTr - INFO - args.ckpts : ./PCN_models/example/ckpt-best.pth 2023-04-24 15:56:24,064 - PoinTr - INFO - args.val_freq : 1 2023-04-24 15:56:24,064 - PoinTr - INFO - args.resume : False 2023-04-24 15:56:24,064 - PoinTr - INFO - args.test : True 2023-04-24 15:56:24,064 - PoinTr - INFO - args.mode : None 2023-04-24 15:56:24,064 - PoinTr - INFO - args.experiment_path : ./experiments/PoinTr/PCN_models/test_example 2023-04-24 15:56:24,065 - PoinTr - INFO - args.tfboard_path : ./experiments/PoinTr/PCN_models/TFBoard/test_example 2023-04-24 15:56:24,065 - PoinTr - INFO - args.log_name : PoinTr 2023-04-24 15:56:24,065 - PoinTr - INFO - args.use_gpu : True 2023-04-24 15:56:24,065 - PoinTr - INFO - args.distributed : False 2023-04-24 15:56:24,065 - PoinTr - INFO - config.optimizer = edict() 2023-04-24 15:56:24,065 - PoinTr - INFO - config.optimizer.type : AdamW 2023-04-24 15:56:24,065 - PoinTr - INFO - config.optimizer.kwargs = edict() 2023-04-24 15:56:24,065 - PoinTr - INFO - config.optimizer.kwargs.lr : 0.0005 2023-04-24 15:56:24,065 - PoinTr - INFO - config.optimizer.kwargs.weight_decay : 0.0005 2023-04-24 15:56:24,066 - PoinTr - INFO - config.scheduler = edict() 2023-04-24 15:56:24,066 - PoinTr - INFO - config.scheduler.type : LambdaLR 2023-04-24 15:56:24,066 - PoinTr - INFO - config.scheduler.kwargs = edict() 2023-04-24 15:56:24,066 - PoinTr - INFO - config.scheduler.kwargs.decay_step : 21 2023-04-24 15:56:24,066 - PoinTr - INFO - config.scheduler.kwargs.lr_decay : 0.9 2023-04-24 15:56:24,066 - PoinTr - INFO - config.scheduler.kwargs.lowest_decay : 0.02 2023-04-24 15:56:24,066 - PoinTr - INFO - config.bnmscheduler = edict() 2023-04-24 15:56:24,066 - PoinTr - INFO - config.bnmscheduler.type : Lambda 2023-04-24 15:56:24,066 - PoinTr - INFO - config.bnmscheduler.kwargs = edict() 2023-04-24 15:56:24,066 - PoinTr - INFO - config.bnmscheduler.kwargs.decay_step : 21 2023-04-24 15:56:24,067 - PoinTr - INFO - config.bnmscheduler.kwargs.bn_decay : 0.5 2023-04-24 15:56:24,067 - PoinTr - INFO - config.bnmscheduler.kwargs.bn_momentum : 0.9 2023-04-24 15:56:24,067 - PoinTr - INFO - config.bnmscheduler.kwargs.lowest_decay : 0.01 2023-04-24 15:56:24,067 - PoinTr - INFO - config.dataset = edict() 2023-04-24 15:56:24,067 - PoinTr - INFO - config.dataset.train = edict() 2023-04-24 15:56:24,067 - PoinTr - INFO - config.dataset.train.base = edict() 2023-04-24 15:56:24,067 - PoinTr - INFO - config.dataset.train.base.NAME : PCN 2023-04-24 15:56:24,067 - PoinTr - INFO - config.dataset.train.base.CATEGORY_FILE_PATH : data/PCN/PCN.json 2023-04-24 15:56:24,068 - PoinTr - INFO - config.dataset.train.base.N_POINTS : 2048 2023-04-24 15:56:24,068 - PoinTr - INFO - config.dataset.train.base.N_RENDERINGS : 8 2023-04-24 15:56:24,068 - PoinTr - INFO - config.dataset.train.base.PARTIAL_POINTS_PATH : data/PCN/%s/partial/%s/%s/%02d.pcd 2023-04-24 15:56:24,068 - PoinTr - INFO - config.dataset.train.base.COMPLETE_POINTS_PATH : data/PCN/%s/complete/%s/%s.pcd 2023-04-24 15:56:24,068 - PoinTr - INFO - config.dataset.train.base.CARS : False 2023-04-24 15:56:24,068 - PoinTr - INFO - config.dataset.train.others = edict() 2023-04-24 15:56:24,068 - PoinTr - INFO - config.dataset.train.others.subset : train 2023-04-24 15:56:24,068 - PoinTr - INFO - config.dataset.train.others.bs : 48 2023-04-24 15:56:24,068 - PoinTr - INFO - config.dataset.val = edict() 2023-04-24 15:56:24,069 - PoinTr - INFO - config.dataset.val.base = edict() 2023-04-24 15:56:24,069 - PoinTr - INFO - config.dataset.val.base.NAME : PCN 2023-04-24 15:56:24,069 - PoinTr - INFO - config.dataset.val.base.CATEGORY_FILE_PATH : data/PCN/PCN.json 2023-04-24 15:56:24,069 - PoinTr - INFO - config.dataset.val.base.N_POINTS : 2048 2023-04-24 15:56:24,069 - PoinTr - INFO - config.dataset.val.base.N_RENDERINGS : 8 2023-04-24 15:56:24,069 - PoinTr - INFO - config.dataset.val.base.PARTIAL_POINTS_PATH : data/PCN/%s/partial/%s/%s/%02d.pcd 2023-04-24 15:56:24,069 - PoinTr - INFO - config.dataset.val.base.COMPLETE_POINTS_PATH : data/PCN/%s/complete/%s/%s.pcd 2023-04-24 15:56:24,070 - PoinTr - INFO - config.dataset.val.base.CARS : False 2023-04-24 15:56:24,070 - PoinTr - INFO - config.dataset.val.others = edict() 2023-04-24 15:56:24,070 - PoinTr - INFO - config.dataset.val.others.subset : test 2023-04-24 15:56:24,070 - PoinTr - INFO - config.dataset.test = edict() 2023-04-24 15:56:24,070 - PoinTr - INFO - config.dataset.test.base = edict() 2023-04-24 15:56:24,070 - PoinTr - INFO - config.dataset.test.base.NAME : PCN 2023-04-24 15:56:24,070 - PoinTr - INFO - config.dataset.test.base.CATEGORY_FILE_PATH : data/PCN/PCN.json 2023-04-24 15:56:24,070 - PoinTr - INFO - config.dataset.test.base.N_POINTS : 2048 2023-04-24 15:56:24,070 - PoinTr - INFO - config.dataset.test.base.N_RENDERINGS : 8 2023-04-24 15:56:24,070 - PoinTr - INFO - config.dataset.test.base.PARTIAL_POINTS_PATH : data/PCN/%s/partial/%s/%s/%02d.pcd 2023-04-24 15:56:24,071 - PoinTr - INFO - config.dataset.test.base.COMPLETE_POINTS_PATH : data/PCN/%s/complete/%s/%s.pcd 2023-04-24 15:56:24,071 - PoinTr - INFO - config.dataset.test.base.CARS : False 2023-04-24 15:56:24,071 - PoinTr - INFO - config.dataset.test.others = edict() 2023-04-24 15:56:24,071 - PoinTr - INFO - config.dataset.test.others.subset : test 2023-04-24 15:56:24,071 - PoinTr - INFO - config.model = edict() 2023-04-24 15:56:24,071 - PoinTr - INFO - config.model.NAME : PoinTr 2023-04-24 15:56:24,071 - PoinTr - INFO - config.model.num_pred : 2048 2023-04-24 15:56:24,071 - PoinTr - INFO - config.model.num_query : 224 2023-04-24 15:56:24,072 - PoinTr - INFO - config.model.knn_layer : 1 2023-04-24 15:56:24,072 - PoinTr - INFO - config.model.trans_dim : 384 2023-04-24 15:56:24,072 - PoinTr - INFO - config.total_bs : 48 2023-04-24 15:56:24,072 - PoinTr - INFO - config.step_per_update : 1 2023-04-24 15:56:24,072 - PoinTr - INFO - config.max_epoch : 300 2023-04-24 15:56:24,072 - PoinTr - INFO - config.consider_metric : CDL1 2023-04-24 15:56:24,072 - PoinTr - INFO - Distributed training: False 2023-04-24 15:56:24,072 - PoinTr - INFO - Set random seed to 0, deterministic: False 2023-04-24 15:56:24,074 - PoinTr - INFO - Tester start ... 2023-04-24 15:56:24,082 - PCNDATASET - INFO - Collecting files of Taxonomy [ID=02691156, Name=airplane] 2023-04-24 15:56:24,083 - PCNDATASET - INFO - Collecting files of Taxonomy [ID=02933112, Name=cabinet] 2023-04-24 15:56:24,083 - PCNDATASET - INFO - Collecting files of Taxonomy [ID=02958343, Name=car] 2023-04-24 15:56:24,084 - PCNDATASET - INFO - Collecting files of Taxonomy [ID=03001627, Name=chair] 2023-04-24 15:56:24,084 - PCNDATASET - INFO - Collecting files of Taxonomy [ID=03636649, Name=lamp] 2023-04-24 15:56:24,086 - PCNDATASET - INFO - Collecting files of Taxonomy [ID=04256520, Name=sofa] 2023-04-24 15:56:24,087 - PCNDATASET - INFO - Collecting files of Taxonomy [ID=04379243, Name=table] 2023-04-24 15:56:24,087 - PCNDATASET - INFO - Collecting files of Taxonomy [ID=04530566, Name=watercraft] 2023-04-24 15:56:24,087 - PCNDATASET - INFO - Complete collecting files of the dataset. Total files: 1200 2023-04-24 15:56:24,088 - MODEL - INFO - Transformer with knn_layer 1 2023-04-24 15:56:27,205 - PoinTr - INFO - Loading weights from ./PCN_models/example/ckpt-best.pth... 2023-04-24 15:56:28,094 - PoinTr - INFO - ckpts @ 296 epoch( performance = {'F-Score': 0.5812608525777857, 'CDL1': 9.672165468335152, 'CDL2': 0.3736594878990824, 'EMDistance': 0.0}) Traceback (most recent call last): File "main.py", line 68, in main() File "main.py", line 62, in main test_net(args, config) File "/hy-tmp/PoinTr/tools/runner.py", line 336, in test_net test(base_model, test_dataloader, ChamferDisL1, ChamferDisL2, args, config, logger=logger) File "/hy-tmp/PoinTr/tools/runner.py", line 348, in test for idx, (taxonomy_ids, model_ids, data) in enumerate(test_dataloader): File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1085, in _next_data return self._process_data(data) File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1111, in _process_data data.reraise() File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/_utils.py", line 428, in reraise raise self.exc_type(msg) AssertionError: Caught AssertionError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/hy-tmp/PoinTr/datasets/PCNDataset.py", line 103, in getitem assert data['gt'].shape[0] == self.npoints AssertionError` Could you please help me check where the problem is. Thank you.I retrained the model because I wanted to see the complete point cloud of 2048 points. But during testing, the above situation will occur

huyanbi avatar Apr 24 '23 08:04 huyanbi

hi, i see that you modify N_POINTS in the base config and get an error when checking the number of points in point cloud raw data. So, add a fps operation when you initialize data['gt'] to contains 'N_POINTS' points

yuxumin avatar Apr 24 '23 08:04 yuxumin

@yuxumin ,Thank you for your answer, but I still don't quite understand. Could you please help me explain how to operate it specifically

huyanbi avatar Apr 24 '23 08:04 huyanbi

https://github.com/yuxumin/PoinTr/blob/master/datasets/PCNDataset.py#L101 Here, add a FPS to downsample the gt point cloud from 16384 points to 2048 points

yuxumin avatar Apr 24 '23 08:04 yuxumin

Okay, can I do this? First add the class for fps, then add on line 101 gt = farthest_point_sample(gt, 2048).def farthest_point_sample(point, npoint): N, D = point.shape xyz = point[:,:3] centroids = np.zeros((npoint,)) distance = np.ones((N,)) * 1e10 farthest = np.random.randint(0, N) for i in range(npoint): centroids[i] = farthest centroid = xyz[farthest, :] dist = np.sum((xyz - centroid) ** 2, -1) mask = dist < distance distance[mask] = dist[mask] farthest = np.argmax(distance, -1) point = point[centroids.astype(np.int32)] return point

huyanbi avatar Apr 24 '23 09:04 huyanbi

@yuxumin .Boss, it seems that it's not possible. I made a mistake here.Traceback (most recent call last): File "main.py", line 68, in <module> main() File "main.py", line 62, in main test_net(args, config) File "/hy-tmp/PoinTr/tools/runner.py", line 336, in test_net test(base_model, test_dataloader, ChamferDisL1, ChamferDisL2, args, config, logger=logger) File "/hy-tmp/PoinTr/tools/runner.py", line 348, in test for idx, (taxonomy_ids, model_ids, data) in enumerate(test_dataloader): File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 435, in __next__ data = self._next_data() File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1085, in _next_data return self._process_data(data) File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1111, in _process_data data.reraise() File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/_utils.py", line 428, in reraise raise self.exc_type(msg) UnboundLocalError: Caught UnboundLocalError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/miniconda3/envs/pointr/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/hy-tmp/PoinTr/datasets/PCNDataset.py", line 102, in __getitem__ gt = farthest_point_sample(gt, 2048) UnboundLocalError: local variable 'gt' referenced before assignment

huyanbi avatar Apr 24 '23 10:04 huyanbi

What should I do?thank you

huyanbi avatar Apr 24 '23 10:04 huyanbi

orfps_idx = farthest_point_sample(16384, 2048, points[:, :3]) new_points = points[fps_idx]

huyanbi avatar Apr 24 '23 13:04 huyanbi

您好 我在训练过程中也遇到同样的问题,请问您最后怎么解决这个问题的呢?

NWFUWangChong avatar Jul 14 '23 09:07 NWFUWangChong