okankop / Efficient-3DCNNs

PyTorch Implementation of "Resource Efficient 3D Convolutional Neural Networks", codes and pretrained models.
MIT License
777 stars 151 forks source link

i need your help #5

Closed world2025 closed 4 years ago

world2025 commented 5 years ago

hello ,thanks for your code ,i meet a error when i train the jester dataset, invalid argument 0: sizes of tensors must match except in dimension 0 ,got 16 and 7 in dimension 2 ,can you give me some advice ? thank you

ahmetgunduz commented 5 years ago

Can you please share your parameters configuration?

world2025 commented 5 years ago

sorry,i will give you tommorrow------------------ 原始邮件 ------------------ 发件人: "Ahmet Gündüz"notifications@github.com 发送时间: 2019年8月27日(星期二) 晚上9:41 收件人: "okankop/Efficient-3DCNNs"Efficient-3DCNNs@noreply.github.com; 抄送: "tkone2018"843783062@qq.com;"Author"author@noreply.github.com; 主题: Re: [okankop/Efficient-3DCNNs] i need your help (#5)

Can you please share your parameters configuration?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

world2025 commented 5 years ago

Namespace(annotation_path='D:/gesture recognition/Efficient-3DCNNs-master/annotation_Jester/jester.json', arch='resnet', batch_size=19, begin_epoch=1, checkpoint=1, crop_position_in_test='c', dampening=0.9, dataset='jester', downsample=1, ft_portion='complete', groups=3, initial_scale=1.0, learning_rate=0.04, lr_patience=10, lr_steps=[40, 55, 65, 70, 200, 250], manual_seed=1, mean=[114.7748, 107.7354, 99.475], mean_dataset='activitynet', modality='RGB', model='resnet', model_depth=101, momentum=0.9, n_classes=27, n_epochs=120, n_finetune_classes=27, n_scales=5, n_threads=0, n_val_samples=3, nesterov=False, no_cuda=False, no_hflip=False, no_mean_norm=False, no_softmax_in_test=False, no_train=False, no_val=False, norm_value=1, optimizer='sgd', pretrain_path='', resnet_shortcut='B', resnext_cardinality=32, result_path='D:/gesture recognition/Efficient-3DCNNs-master/results', resume_path='', root_path='D:/gesture recognition/Efficient-3DCNNs-master/', sample_duration=16, sample_size=112, scale_in_test=1.0, scale_step=0.84089641525, scales=[1.0, 0.84089641525, 0.7071067811803005, 0.5946035574934808, 0.4999999999911653], std=[38.7568578, 37.88248729, 40.02898126], std_norm=False, store_name='jester_resnet_1.0x_RGB_16', test=False, test_subset='val', train_crop='corner', version=1.1, video_path='D:/gesture recognition/Efficient-3DCNNs-master/jester/20bn-jester-v1/', weight_decay=0.001, wide_resnet_k=2, width_mult=1.0) D:\gesture recognition\Efficient-3DCNNs-master\models\resnet.py:145: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaimingnormal. m.weight = nn.init.kaiming_normal(m.weight, mode='fan_out')

world2025 commented 5 years ago

i do not know how to solve it

okankop commented 5 years ago

On which line are you getting this error?

world2025 commented 5 years ago

@okankop the error arose in the middle of the first epoch, in train data loader line

okankop commented 5 years ago

So you successfully started the training and this error occurred in the middle. Then I suspect there is a problem regarding dataloader or the dataset itself. It seems that for one training video, dataloader could not read 16 images and read 7 images instead, which created this error. Could you please check your dataset & dataloader and let us know if that was the issue?

world2025 commented 5 years ago

you say the batchsize?

okankop commented 5 years ago

No, it is not related to batch_size. The error says there is a mismatch of dimension, 16 and 7 in dimension 7. So if you are successfully training till the middle of epoch, most probably there is a problematic video sample and when dataloader tries to laod it, this error happens.

Solution: Download the Jester dataset again.

world2025 commented 5 years ago

ok ,i try it

world2025 commented 5 years ago

File "", line 1, in runfile('D:/gesture recognition/Efficient-3DCNNs-master/main.py', wdir='D:/gesture recognition/Efficient-3DCNNs-master')

File "C:\Users\78245\Anaconda3\envs\Gesture\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile execfile(filename, namespace)

File "C:\Users\78245\Anaconda3\envs\Gesture\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/gesture recognition/Efficient-3DCNNs-master/main.py", line 153, in train_logger, train_batch_logger)

File "D:\gesture recognition\Efficient-3DCNNs-master\train.py", line 23, in train_epoch for i, (inputs, targets) in enumerate(data_loader):

File "C:\Users\78245\Anaconda3\envs\Gesture\lib\site-packages\torch\utils\data\dataloader.py", line 560, in next batch = self.collate_fn([self.dataset[i] for i in indices])

File "C:\Users\78245\Anaconda3\envs\Gesture\lib\site-packages\torch\utils\data_utils\collate.py", line 68, in default_collate return [default_collate(samples) for samples in transposed]

File "C:\Users\78245\Anaconda3\envs\Gesture\lib\site-packages\torch\utils\data_utils\collate.py", line 68, in return [default_collate(samples) for samples in transposed]

File "C:\Users\78245\Anaconda3\envs\Gesture\lib\site-packages\torch\utils\data_utils\collate.py", line 43, in default_collate return torch.stack(batch, 0, out=out)

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 16 and 3 in dimension 2 at ..\aten\src\TH/generic/THTensor.cpp:711

world2025 commented 5 years ago

I find a probably reason is that the data sets have different image sizes. Resize and Crop were used when loading the training set, but they were forgotten during the test.

okankop commented 4 years ago

I believe the issue is resolved.

sandyflute commented 4 years ago

I face the same issue when trying to train with jestor.

sandyflute commented 4 years ago

@okankop can you please check ?