Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: expected a non-empty list of Tensors #56

Closed
hareeshdevarakonda opened this issue May 5, 2018 · 10 comments
Closed

RuntimeError: expected a non-empty list of Tensors #56

hareeshdevarakonda opened this issue May 5, 2018 · 10 comments

Comments

@hareeshdevarakonda
Copy link

Traceback (most recent call last):
File "main.py", line 129, in
train_logger, train_batch_logger)
File "/home/hareesh/Downloads/3D-ResNets-PyTorch-master/train.py", line 22, in train_epoch
for i, (inputs, targets) in enumerate(data_loader):
File "/home/hareesh/.local/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 286, in next
return self._process_next_batch(batch)
File "/home/hareesh/.local/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 307, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
RuntimeError: Traceback (most recent call last):
File "/home/hareesh/.local/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 57, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/hareesh/.local/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 57, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/hareesh/Downloads/3D-ResNets-PyTorch-master/datasets/ucf101.py", line 193, in getitem
clip = torch.stack(clip, 0).permute(1, 0, 2, 3)
RuntimeError: expected a non-empty list of Tensors

Please let me know cause of this error.

@kenshohara
Copy link
Owner

Did you correctly set video_path?

@hareeshdevarakonda
Copy link
Author

Yeah, Video path is fine added one function in code its running now

##Added Funtion

def loadImages(path, indecies):
# return array of images

loadedImages = []
#print ("path",path," indecies",indecies)
for image in indecies:
    if image < 10:
        img = PImage.open(path + '/' + 'frame00000' + str(image) + '.jpg')    
    elif image < 100:
        img = PImage.open(path + '/' + 'frame0000' + str(image) + '.jpg')
    elif image < 1000:
        img = PImage.open(path + '/' + 'frame000' + str(image) + '.jpg')
    elif image < 10000:
        img = PImage.open(path + '/' + 'frame00' + str(image) + '.jpg')
    else:
        img = PImage.open(path + '/' + 'frame0' + str(image) + '.jpg')

    loadedImages.append(img)

return loadedImages

@ll490187880
Copy link

Hello~Where to put your new function? @hareeshdevarakonda

@hareeshdevarakonda
Copy link
Author

@ll490187880 No need to keep any new function keep running the same code on pythorch 0.4 version n make sure of your annotation of the images i have annotations like "frame000000" according to this code annotations are like "image_000000". please make sure of these things

@gycka
Copy link

gycka commented Sep 3, 2019

@hareeshdevarakonda I tried with the original code and with the included function; however, I got the same error. My path to files is correct, the names are also correct (frame000000). Any suggestions for moving forward (I understand it has been a year since your comment).

@shadsakib
Copy link

Hi. Was the problem solved? Thank you.

@TitaniumOne
Copy link

I meet the same problem. How do you solve it? Thank you!

@liuzhaoo
Copy link

I meet the same problem. How do you solve it? Thank you!
Hi,buddy,Do you have any solution?

@TitaniumOne
Copy link

TitaniumOne commented Oct 15, 2020 via email

@liuzhaoo
Copy link

liuzhaoo commented Oct 15, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants