3D-ResNets-PyTorch icon indicating copy to clipboard operation
3D-ResNets-PyTorch copied to clipboard

CPU issue

Open mariankyoussef opened this issue 6 years ago • 9 comments

I am trying to use resnet-34 (cpu version) for both classification and feature extraction. Here is the error: (tensorflow) mariankyoussef@elecsim:~/video-classification-3d-cnn-pytorch$ python main.py --input ./input --video_root ./home/mariankyoussef/UCF101_videos --output ./output.json --model ./models/resnet-34-kinetics-cpu.pth --mode score --no_cuda loading model ./models/resnet-34-kinetics-cpu.pth

Traceback (most recent call last): File "main.py", line 24, in model_data = torch.load(opt.model) File "/home/mariankyoussef/anaconda3/envs/tensorflow/lib/python3.6/site-packages/torch/serialization.py", line 267, in load return _load(f, map_location, pickle_module) File "/home/mariankyoussef/anaconda3/envs/tensorflow/lib/python3.6/site-packages/torch/serialization.py", line 410, in _load magic_number = pickle_module.load(f) _pickle.UnpicklingError: invalid load key, '<'.

I didn't try to fix the error yet, but I am wondering if the first couple of lines have the right settings?

mariankyoussef avatar Apr 16 '18 12:04 mariankyoussef

It seems to be a problem of your resnet-34-kinetics-cpu.pth. Please download the file and try it again.

kenshohara avatar Apr 17 '18 01:04 kenshohara

I downloaded it again. I also get the same error when I tried on GPU resnet-34 and also renext-101:

myo1@ws:~$ python main.py --input ./input --video_root /mnt/home/myo1/big/UCF-101 --output ./output.json --model /mnt/home/myo1/big/resnext-101-64f-kinetics-ucf101_split1.pth --mode score loading model /mnt/home/myo1/big/resnext-101-64f-kinetics-ucf101_split1.pth Traceback (most recent call last): File "main.py", line 24, in model_data = torch.load(opt.model) File "/mnt/home/myo1/anaconda3/lib/python3.6/site-packages/torch/serialization.py", line 267, in load return _load(f, map_location, pickle_module) File "/mnt/home/myo1/anaconda3/lib/python3.6/site-packages/torch/serialization.py", line 410, in _load magic_number = pickle_module.load(f) _pickle.UnpicklingError: invalid load key, '<'.

Also I got another error in resnet-50:

myo1@ws:~$ python main.py --input ./input --video_root /mnt/home/myo1/big/UCF-101 --output ./output.json --model /mnt/home/myo1/big/resnet-50-kinetics.pth --mode score loading model /mnt/home/myo1/big/resnet-50-kinetics.pth Traceback (most recent call last): File "main.py", line 25, in assert opt.arch == model_data['arch'] AssertionError

mariankyoussef avatar Apr 18 '18 12:04 mariankyoussef

I'm having the same issue both on GPU and CPU, let me know if you managed to solve it somehow. Thanks!

loading model ./resnet-101-kinetics.pth Traceback (most recent call last): File "main.py", line 25, in assert opt.arch == model_data['arch'] AssertionError

rlica avatar Jun 06 '18 07:06 rlica

I managed to solve it: apparently "resnet-34" was hardcoded somewhere when defining opt.arch and the code could only run using resnet-34-kinetics.pth.

rlica avatar Jun 06 '18 11:06 rlica

argument 'model_depth' in opts.py is set to have default value 34. You could change that or add an explicit argument when compile the code.

huylllooo avatar Jul 16 '18 09:07 huylllooo

@rlica So what if I need to train UCF101 dataset? Also using kinetics' finetuning model???

ArchieGu avatar Aug 09 '18 07:08 ArchieGu

@rlica it seems you solved the problem if you can help it will be amaizing I'm having the same issue both on GPU and CPU:

image

i tried to load the pre trained model ResNeXt-101 'resnext-101-kinetics.pth' did anyone succeed to load this model?

danielafrimi avatar Apr 20 '19 10:04 danielafrimi

@rlica it seems you solved the problem if you can help it will be amaizing I'm having the same issue both on GPU and CPU:

image

i tried to load the pre trained model ResNeXt-101 'resnext-101-kinetics.pth' did anyone succeed to load this model?

Did you succeed? I met the same AssertionError .

gitxdf avatar Nov 18 '19 03:11 gitxdf

@danielafrimi if you want to load the pre trained model ResNeXt-101 'resnext-101-kinetics.pth', you have to add additional command after the provided cmd. "--model_depth 101 --resnet_shortcut B". I grab these parameters from the original proposed GitHub.

The whole command will be like as follow: python main.py --input ./input --video_root ./videos --output ./output.json --model ./resnet-101-kinetics.pth --mode feature --model_depth 101 --resnet_shortcut B

I misrecognize it was other repository

Heng-xiu avatar Mar 22 '20 02:03 Heng-xiu