jfzhang95 / pytorch-video-recognition

PyTorch implemented C3D, R3D, R2Plus1D models for video activity recognition.
MIT License
1.18k stars 250 forks source link

Inference.py question for frame process #42

Open Magsun opened 4 years ago

Magsun commented 4 years ago

Hello @jfzhang95 , thanks for your share of c3d implement.

When I inference with trained c3d model, I notice that you did some process to central croped frame.

listed here: image

tmp = tmp_ - np.array([[[90.0, 98.0, 102.0]]])

Kindly help to explain that what purpose of doing this operation.

Thanks again.

marsna commented 4 years ago

Can you run inference.py with pretrained model? I run inference.py and see error: Traceback (most recent call last): File "inference.py", line 78, in main() File "inference.py", line 32, in main model.load_state_dict(checkpoint['state_dict']) KeyError: 'state_dict'

Magsun commented 4 years ago

Can you run inference.py with pretrained model? I run inference.py and see error: Traceback (most recent call last): File "inference.py", line 78, in main() File "inference.py", line 32, in main model.load_state_dict(checkpoint['state_dict']) KeyError: 'state_dict'

I didn't see this error. My code is here:

# init model
model = C3D_model.C3D(num_classes=2)
checkpoint = torch.load('/workspace/pytorch-video-recognition/run/run_4/models/C3D-ucf101_epoch-3.pth.tar',
                        map_location=lambda storage, loc: storage)
model.load_state_dict(checkpoint['state_dict'])
marsna commented 4 years ago

Thank you very much.I'll try to train my dataset.

------------------ 原始邮件 ------------------ 发件人: "Magsun"<notifications@github.com>; 发送时间: 2020年5月19日(星期二) 上午10:52 收件人: "jfzhang95/pytorch-video-recognition"<pytorch-video-recognition@noreply.github.com>; 抄送: "Mars.Nan"<1664682465@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [jfzhang95/pytorch-video-recognition] Inference.py question for frame process (#42)

Can you run inference.py with pretrained model? I run inference.py and see error: Traceback (most recent call last): File "inference.py", line 78, in main() File "inference.py", line 32, in main model.load_state_dict(checkpoint['state_dict']) KeyError: 'state_dict'

I didn't see this error. My code is here:

init model model = C3D_model.C3D(num_classes=2) checkpoint = torch.load('/workspace/pytorch-video-recognition/run/run_4/models/C3D-ucf101_epoch-3.pth.tar', map_location=lambda storage, loc: storage) model.load_state_dict(checkpoint['state_dict'])

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.