Open joyzyyz opened 4 years ago
(base) D:\F\VideoCaption19>python videoCaption.py video10034.mp4 in_file: video10034.mp4 IMG_SIZE: (256, 192) --processing video... 18%|█████████████████████████████████▋ | 40%|████████████████████████████████████████████████████████████████████████▊ 62%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████ 84%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████ 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████ ████████████████████████████████████████████████████████████████████████| 527/527 [00:00<00:00, 1125.99it/s]
--processing key frames... 0%| | 0/15 [00:00<?, ?it/s]D :\F\VideoCaption19\img2txt.py:99: UserWarning: volatile was removed and now has no effect. Use
with torch.no_grad():
instead. img_feats = feat_extractor(Variable(img, volatile=True)) D:\F\VideoCaption19\model.py:60: UserWarning: volatile was removed and now has no effect. Usewith torch.no_grad():
instead. img = t.autograd.Variable(img.unsqueeze(0), volatile=True) D:\F\VideoCaption19\utils\beam_search.py:156: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument. logprobs = log_softmax(output) D:\F\VideoCaption19\utils\beam_search.py:180: UserWarning: volatile was removed and now has no effect. Usewith torch.no_grad():
instead. input_feed = Variable(input_feed, volatile=True) 0%| | 0/15 [00:00<?, ?it/s] Traceback (most recent call last): File "videoCaption.py", line 121, in video2txt(in_file) File "videoCaption.py", line 73, in video2txt txts += generate_txt(img, tr4s, resnet50, cap_model, opt.use_gpu) File "D:\F\VideoCaption19\img2txt.py", line 105, in generate_txt results = model.generate(img_feats.data[0]) File "D:\F\VideoCaption19\model.py", line 64, in generate for sent in sentences] File "D:\F\VideoCaption19\model.py", line 64, in for sent in sentences] File "D:\F\VideoCaption19\model.py", line 63, in sentences = [' '.join([self.ix2word[idx] for idx in sent]) KeyError: tensor(51)
@joyzyyz 改为: sentences = [' '.join([self.ix2word[idx.item()] for idx in sent])
(base) D:\F\VideoCaption19>python videoCaption.py video10034.mp4 in_file: video10034.mp4 IMG_SIZE: (256, 192) --processing video... 18%|█████████████████████████████████▋ | 40%|████████████████████████████████████████████████████████████████████████▊ 62%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████ 84%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████ 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████ ████████████████████████████████████████████████████████████████████████| 527/527 [00:00<00:00, 1125.99it/s]
--processing key frames... 0%| | 0/15 [00:00<?, ?it/s]D :\F\VideoCaption19\img2txt.py:99: UserWarning: volatile was removed and now has no effect. Use
video2txt(in_file)
File "videoCaption.py", line 73, in video2txt
txts += generate_txt(img, tr4s, resnet50, cap_model, opt.use_gpu)
File "D:\F\VideoCaption19\img2txt.py", line 105, in generate_txt
results = model.generate(img_feats.data[0])
File "D:\F\VideoCaption19\model.py", line 64, in generate
for sent in sentences]
File "D:\F\VideoCaption19\model.py", line 64, in
for sent in sentences]
File "D:\F\VideoCaption19\model.py", line 63, in
sentences = [' '.join([self.ix2word[idx] for idx in sent])
KeyError: tensor(51)
with torch.no_grad():
instead. img_feats = feat_extractor(Variable(img, volatile=True)) D:\F\VideoCaption19\model.py:60: UserWarning: volatile was removed and now has no effect. Usewith torch.no_grad():
instead. img = t.autograd.Variable(img.unsqueeze(0), volatile=True) D:\F\VideoCaption19\utils\beam_search.py:156: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument. logprobs = log_softmax(output) D:\F\VideoCaption19\utils\beam_search.py:180: UserWarning: volatile was removed and now has no effect. Usewith torch.no_grad():
instead. input_feed = Variable(input_feed, volatile=True) 0%| | 0/15 [00:00<?, ?it/s] Traceback (most recent call last): File "videoCaption.py", line 121, in