AttributeError: 'str' object has no attribute 'shape'

model.eval()
with torch.no_grad():
    step = 10
    for i in range(0, len(test), step):
        test_data = test.tolist()[i: i+step]
        
        # 推論
        outputs = model(test_data)
        # ソフトマックス関数を使って確率を出力
        preds = F.softmax(outputs, dim=1)[:, 1].tolist()
        
        image_paths.append(img)
        predictions.append(preds[0])
    
res = pd.DataFrame({
    'ImageID': test_data,
    'predictions': predictions})

res.sort_values(by='test_data', inplace=True)
res.reset_index(drop=True, inplace=True)

# CSV出力
res.to_csv('test_data/sample_submission.csv', index=False)

AttributeError Traceback (most recent call last)
Input In [15], in <cell line: 2>()
5 test_data = test.tolist()[i: i+step]
7 # 推論
----> 8 outputs = model(test_data)
9 # ソフトマックス関数を使って確率を出力
10 preds = F.softmax(outputs, dim=1)[:, 1].tolist()

File ~/opt/anaconda3/lib/python3.9/site-packages/torch/nn/modules/module.py:1110, in Module._call_impl(self, *input, **kwargs)
1106 # If we don’t have any hooks, we want to skip the rest of the logic in
1107 # this function, and just call forward.
1108 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1109 or _global_forward_hooks or _global_forward_pre_hooks):
→ 1110 return forward_call(*input, **kwargs)
1111 # Do not call functions when jit is used
1112 full_backward_hooks, non_full_backward_hooks = [], []

File ~/opt/anaconda3/lib/python3.9/site-packages/torchvision/models/detection/ssd.py:323, in SSD.forward(self, images, targets)
321 original_image_sizes: List[Tuple[int, int]] = []
322 for img in images:
→ 323 val = img.shape[-2:]
324 assert len(val) == 2
325 original_image_sizes.append((val[0], val[1]))

AttributeError: ‘str’ object has no attribute ‘shape’