Skip to content

TypeError: 'str' object is not callable #87

@Taymazakan

Description

@Taymazakan

I have faced with the following problem when I call inference_recognizer(model, video, lable)

Codes:

import torch
%cd /content/drive/MyDrive/SwinVideo/Video-Swin-Transformer/mmaction2/mmaction
from mmaction.apis import init_recognizer, inference_recognizer
from mmengine import Config

config_file = 'configs/recognition/tsn/tsn_r50_video_inference_1x1x3_100e_kinetics400_rgb.py'

device = 'cuda:0' # or 'cpu'
device = torch.device(device)
%cd /content/drive/My Drive/SwinVideo/Video-Swin-Transformer/
model = init_recognizer(config_file, device=device)
# inference the demo video
video = 'demo/demo.mp4'
lable = 'demo/label_map_k400.txt'
print(os.path.isfile(video))
print(os.path.isfile(lable))
print(os.path.isfile(config_file))
#print(model)
inference_recognizer(model, video, lable)

Error traceback

TypeError                                 Traceback (most recent call last)
[<ipython-input-35-0cf6c1062a3f>](https://localhost:8080/#) in <cell line: 19>()
     17 print(os.path.isfile(config_file))
     18 #print(model)
---> 19 inference_recognizer(model, video, lable)

[/content/drive/MyDrive/SwinVideo/Video-Swin-Transformer/mmaction2/mmaction/apis/inference.py](https://localhost:8080/#) in inference_recognizer(model, video, test_pipeline)
     90         data = dict(filename=video, label=-1, start_index=0, modality='RGB')
     91 
---> 92     data = test_pipeline(data)
     93     data = pseudo_collate([data])
     94 

TypeError: 'str' object is not callable```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions