I am trying to evaluate a pretranined model created by EpicKitchens. But I stuck at an error when I create my own data.
Link of pretrained model is indicated below.

  
      
      GitHub
  
  
    

epic-kitchens/action-models

EPIC-Kitchens baselines for Action Recognition. Contribute to epic-kitchens/action-models development by creating an account on GitHub.


  
  
    
    
  
  


class OwnDataset(Dataset):
    running_loss = 0.0
    running_corrects = 0
    
    def __init__(self, image_paths,transform, length):
        self.image_paths = image_paths
        self.transform = transform
        self.length = length
        
    def __getitem__(self, index):
        dimensions =[]
        image_path_at_index = self.image_paths[index]

        video_name = image_path_at_index.split('/')[-2] # P01_01
        frame_name = image_path_at_index.split('/')[-1] # frame_0000000001.jpg
        frame_number = int(frame_name.split('_')[-1][:-4]) # 1
#         print(frame_number)
        #frame_number = 9

        selected_row = df_train_action_labels.query(f"video_id == \"{video_name}\" and {frame_number}>= start_frame and {frame_number}<=stop_frame")
        selected_row = selected_row.drop(columns=['uid','participant_id','start_timestamp', 'stop_timestamp', 'start_frame', 'stop_frame', 'all_nouns', 'all_noun_classes'])
        row_list = []			
        for index, rows in selected_row.iterrows(): 
          my_list =[rows.video_id ,rows.verb, rows.verb_class, rows.noun, rows.noun_class] 
          row_list.append(my_list)

#         print(row_list)

        # print("image_path_at_index: ", image_path_at_index) image_path_at_index:  /content/drive/My Drive/Videos/train/P01_01/frame_0000000001.jpg
        image = Image.open(image_path_at_index) 
        
        if self.transform:
          image = self.transform(image)
       
        # train_video_names
        # df_train_action_labels[df_train_action_labels.video_id == "P01_01"]

        x = image
        y = row_list


        return x, y
    
    
    def __len__(self):
        return self.length
      
      

df_train_action_labels = pd.read_csv(annotations_dir +'/EPIC_train_action_labels.csv')


class_paths_train = [d.path for d in os.scandir(train_dir) if d.is_dir]
whole_train_image_paths = []

train_video_names = [path.split('/')[-1] for path in class_paths_train]


for c, class_path in enumerate(class_paths_train):
        paths = sorted(glob.glob(os.path.join(class_path, '*.jpg')))  
        whole_train_image_paths.extend(paths)

# print(whole_train_image_paths)  ['/content/drive/My Drive/Videos/test/P01_12/0000000001.jpg', '/content/drive/My Drive/Videos/test/P01_12/0000000031.jpg', '/....]


transform = transforms.Compose([
    transforms.Resize(size=(224, 224)),
    transforms.ToTensor(),
    transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])
])
dataset_train = OwnDataset(
    image_paths = whole_train_image_paths,
    transform = transform,
    length = len(whole_train_image_paths)
)
loader_train = DataLoader(
    dataset_train,
    batch_size=1,
    num_workers=1
)

for i, data in enumerate(loader_train):

  inputs,labels = data
  output = tsn.features(inputs)
  verb_logits, noun_logits = tsn.logits(features)
  
  if isinstance(output, tuple):
      print(f"Outputsssss shape: {[o.shape for o in output]}")
  else:
      print(f"Output shape: {output.shape}")


And I get an error
RuntimeError: shape '[-1, 8, 125]' is invalid for input of size 125
I can’t find its solution what should I do?
Here is an example of correct input shape
batch_size = 1
segment_count = 8
snippet_length = 1  # Number of frames composing the snippet, 1 for RGB, 5 for optical flow
snippet_channels = 3  # Number of channels in a frame, 3 for RGB, 2 for optical flow
height, width = 224, 224

inputs = torch.randn(
    [batch_size, segment_count, snippet_length, snippet_channels, height, width]
)
# The segment and snippet length and channel dimensions are collapsed into the channel
# dimension
# Input shape: N x TC x H x W
print("b1" , inputs.shape  #[1, 8, 1, 3 224, 224]
inputs = inputs.reshape((batch_size, -1, height, width))
print( inputs.shape)  #[1, 24, 224, 224]
for model in [tsn]:
    # You can get features out of the models
    features = model.features(inputs)
    # and then classify those features
    verb_logits, noun_logits = model.logits(features)
    
    # or just call the object to classify inputs in a single forward pass
    verb_logits, noun_logits = model(inputs)
    print(verb_logits.shape, noun_logits.shape)