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

TypeError: 'str' object is not callable #87

Open
tami64 opened this issue May 10, 2023 · 2 comments
Open

TypeError: 'str' object is not callable #87

tami64 opened this issue May 10, 2023 · 2 comments

Comments

@tami64
Copy link

tami64 commented May 10, 2023

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```
@sqs000
Copy link

sqs000 commented Jul 12, 2023

I think the inference way here is wrong (no the third var label), for the right way see here: https://mmaction2.readthedocs.io/en/latest/get_started/installation.html

@tami64
Copy link
Author

tami64 commented Jul 20, 2023

I think the inference way here is wrong (no the third var label), for the right way see here: https://mmaction2.readthedocs.io/en/latest/get_started/installation.html

Honestly, I do not remember.

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

2 participants