cha15yq / CUT

Segmentation assisted U-shaped multi-scale transformer for crowd counting
17 stars 2 forks source link

Code problem #5

Open YZGod666 opened 11 months ago

YZGod666 commented 11 months ago

Hello, I made the following error when I imported the Shanghai science and technology dataset partA. May I ask what caused it? 10-11 11:53:02, content:code_test 10-11 11:53:02, seed:15 10-11 11:53:02, crop_size:512 10-11 11:53:02, downsample_ratio:8 10-11 11:53:02, data_dir:./data/part_A 10-11 11:53:02, save_dir:history 10-11 11:53:02, pretrained:pretrained/pcpvt_large.pth 10-11 11:53:02, drop:0.0 10-11 11:53:02, drop_path:0.45 10-11 11:53:02, max_num:1 10-11 11:53:02, device:0 10-11 11:53:02, resume: 10-11 11:53:02, batch_size:8 10-11 11:53:02, num_workers:0 10-11 11:53:02, gamma:2 10-11 11:53:02, opt:adamw 10-11 11:53:02, opt_eps:1e-08 10-11 11:53:02, opt_betas:None 10-11 11:53:02, momentum:0.9 10-11 11:53:02, weight_decay:0.0001 10-11 11:53:02, lr:0.0001 10-11 11:53:02, start_epoch:0 10-11 11:53:02, epochs:1000 10-11 11:53:02, start_val:200 10-11 11:53:02, val_epoch:1 10-11 11:53:02, Using 1 gpus Pre-trained model loaded! 10-11 11:53:03, ----------------------------------------Epoch:0/999---------------------------------------- Traceback (most recent call last): File "train.py", line 75, in trainer.train() File "C:\Users\82776\Desktop\Segmentation assisted u-shaped multi-scale transformer for crowd counting\CUT-main\utils\regression_trainer.py", line 88, in train self.train_epoch() File "C:\Users\82776\Desktop\Segmentation assisted u-shaped multi-scale transformer for crowd counting\CUT-main\utils\regression_trainer.py", line 111, in train_epoch self.dataloaders['train']): File "D:\app\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 681, in next data = self._next_data() File "D:\app\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 721, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "D:\app\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "D:\app\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\82776\Desktop\Segmentation assisted u-shaped multi-scale transformer for crowd counting\CUT-main\dataset\dataset.py", line 51, in getitem return self.train_transform(img, den_map) File "C:\Users\82776\Desktop\Segmentation assisted u-shaped multi-scale transformer for crowd counting\CUT-main\dataset\dataset.py", line 75, in train_transform d_map = d_map.reshape([down_h, self.d_ratio, down_w, self.d_ratio]).sum(axis=(1, 3)) ValueError: cannot reshape array of size 245760 into shape (64,8,64,8)

cha15yq commented 11 months ago

Please check the crop size and use 256, sha is a small dataset and some images are not that big.

On Wed, 11 Oct 2023 at 04:55, YZGod666 @.***> wrote:

Hello, I made the following error when I imported the Shanghai science and technology dataset partA. May I ask what caused it? 10-11 11:53:02, content:code_test 10-11 11:53:02, seed:15 10-11 11:53:02, crop_size:512 10-11 11:53:02, downsample_ratio:8 10-11 11:53:02, data_dir:./data/part_A 10-11 11:53:02, save_dir:history 10-11 11:53:02, pretrained:pretrained/pcpvt_large.pth 10-11 11:53:02, drop:0.0 10-11 11:53:02, drop_path:0.45 10-11 11:53:02, max_num:1 10-11 11:53:02, device:0 10-11 11:53:02, resume: 10-11 11:53:02, batch_size:8 10-11 11:53:02, num_workers:0 10-11 11:53:02, gamma:2 10-11 11:53:02, opt:adamw 10-11 11:53:02, opt_eps:1e-08 10-11 11:53:02, opt_betas:None 10-11 11:53:02, momentum:0.9 10-11 11:53:02, weight_decay:0.0001 10-11 11:53:02, lr:0.0001 10-11 11:53:02, start_epoch:0 10-11 11:53:02, epochs:1000 10-11 11:53:02, start_val:200 10-11 11:53:02, val_epoch:1 10-11 11:53:02, Using 1 gpus Pre-trained model loaded! 10-11 11:53:03, ----------------------------------------Epoch:0/999---------------------------------------- Traceback (most recent call last): File "train.py", line 75, in trainer.train() File "C:\Users\82776\Desktop\Segmentation assisted u-shaped multi-scale transformer for crowd counting\CUT-main\utils\regression_trainer.py", line 88, in train self.train_epoch() File "C:\Users\82776\Desktop\Segmentation assisted u-shaped multi-scale transformer for crowd counting\CUT-main\utils\regression_trainer.py", line 111, in train_epoch self.dataloaders['train']): File "D:\app\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 681, in next data = self._next_data() File "D:\app\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 721, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "D:\app\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "D:\app\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\82776\Desktop\Segmentation assisted u-shaped multi-scale transformer for crowd counting\CUT-main\dataset\dataset.py", line 51, in getitem return self.train_transform(img, den_map) File "C:\Users\82776\Desktop\Segmentation assisted u-shaped multi-scale transformer for crowd counting\CUT-main\dataset\dataset.py", line 75, in train_transform d_map = d_map.reshape([down_h, self.d_ratio, down_w, self.d_ratio]).sum(axis=(1, 3)) ValueError: cannot reshape array of size 245760 into shape (64,8,64,8)

— Reply to this email directly, view it on GitHub https://github.com/cha15yq/CUT/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANGLTWLJOCOS3NZPEOR6SD3X6YKBPAVCNFSM6AAAAAA53KCSV6VHI2DSMVQWIX3LMV43ASLTON2WKOZRHEZTMNZUGUYTQMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>