MVIG-SJTU / AlphaPose

Real-Time and Accurate Full-Body Multi-Person Pose Estimation&Tracking System
http://mvig.org/research/alphapose.html
Other
7.96k stars 1.97k forks source link

TypeError("forward() got an unexpected keyword argument 'flip_test'") when using demo_3d_inference #1117

Open Schloool opened 1 year ago

Schloool commented 1 year ago

Using the demo_interference.py works fine for me.

However, when using the script demo_3d_interference.py the error TypeError("forward() got an unexpected keyword argument 'flip_test'") occurs.

Command: python scripts/demo_3d_inference.py --cfg configs/coco/resnet/256x192_res50_lr1e-3_1x.yaml --checkpoint pretrained_models/fast_res50_256x192.pth --indir examples/demo/ --save_img

Full log:

/root/miniconda3/envs/alphapose/lib/python3.7/site-packages/torchvision/models/_utils.py:209: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.
  f"The parameter '{pretrained_param}' is deprecated since 0.13 and may be removed in the future, "
/root/miniconda3/envs/alphapose/lib/python3.7/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing `weights=ResNet50_Weights.IMAGENET1K_V1`. You can also use `weights=ResNet50_Weights.DEFAULT` to get the most up-to-date weights.
  warnings.warn(msg)
Loading pose model from pretrained_models/fast_res50_256x192.pth...
Loading YOLO model..
  0%|                                                                                                                                              | 0/3 [00:01<?, ?it/s]
TypeError("forward() got an unexpected keyword argument 'flip_test'")
An error as above occurs when processing the images, please check it

The same error is issued when using dem demo_3d_inference-script in the official collab notebook.

txmxthy commented 1 year ago

Getting the same issue at the moment, commenting to track and will update if I make progress.

Update: I think it expect's us to use the smpl model rather than any of the other pretrained models? I can see that the forward() method in simple3dposesSMPLWithCam is the only model within the models folder to contain references to flip in its arguments.

Once you switch models you will probably need to locate the file "./model_files/basicModel_neutral_lbs_10_207_0_v1.0.0.pkl' refrenced in the smpl code, which can be downloaded from here: https://smpl.is.tue.mpg.de/ the docs say we want neutral 1.0.0 but I can only see neutral for 1.1.0 and M/F for 1.0.0 - I just put M in for my domain and renamed the file here, then had to install the dependency "chumpy"

Conclusion: Use the smpl model, make sure you have the pkl file downloaded and refrenced, install chumpy.

banzhuan37 commented 1 year ago

I‘m running into the same problem, have you fixed it yet

KiteA2022 commented 1 year ago

use demo_interference.py

RohaanA commented 1 year ago

Getting the same issue at the moment, commenting to track and will update if I make progress.

Update: I think it expect's us to use the smpl model rather than any of the other pretrained models? I can see that the forward() method in simple3dposesSMPLWithCam is the only model within the models folder to contain references to flip in its arguments.

Once you switch models you will probably need to locate the file "./model_files/basicModel_neutral_lbs_10_207_0_v1.0.0.pkl' refrenced in the smpl code, which can be downloaded from here: https://smpl.is.tue.mpg.de/ the docs say we want neutral 1.0.0 but I can only see neutral for 1.1.0 and M/F for 1.0.0 - I just put M in for my domain and renamed the file here, then had to install the dependency "chumpy"

Conclusion: Use the smpl model, make sure you have the pkl file downloaded and refrenced, install chumpy.

Hey, can you tell me which model do you mean here by 'smpl model' ? thanks

Martin-si-Daoishi commented 11 months ago

Getting the same issue at the moment, commenting to track and will update if I make progress. Update: I think it expect's us to use the smpl model rather than any of the other pretrained models? I can see that the forward() method in simple3dposesSMPLWithCam is the only model within the models folder to contain references to flip in its arguments. Once you switch models you will probably need to locate the file "./model_files/basicModel_neutral_lbs_10_207_0_v1.0.0.pkl' refrenced in the smpl code, which can be downloaded from here: https://smpl.is.tue.mpg.de/ the docs say we want neutral 1.0.0 but I can only see neutral for 1.1.0 and M/F for 1.0.0 - I just put M in for my domain and renamed the file here, then had to install the dependency "chumpy" Conclusion: Use the smpl model, make sure you have the pkl file downloaded and refrenced, install chumpy.

Hey, can you tell me which model do you mean here by 'smpl model' ? thanks

Hey, can you tell me how did you get over "TypeError("forward() got an unexpected keyword argument 'flip_test'") when using demo_3d_inference"? I have download the smpl and change the name to v1.0.0, put it in model_files, but it doesn't work. Thanks.

Tianyuan-Wang commented 4 months ago

Getting the same issue at the moment, commenting to track and will update if I make progress.

Update: I think it expect's us to use the smpl model rather than any of the other pretrained models? I can see that the forward() method in simple3dposesSMPLWithCam is the only model within the models folder to contain references to flip in its arguments.

Once you switch models you will probably need to locate the file "./model_files/basicModel_neutral_lbs_10_207_0_v1.0.0.pkl' refrenced in the smpl code, which can be downloaded from here: https://smpl.is.tue.mpg.de/ the docs say we want neutral 1.0.0 but I can only see neutral for 1.1.0 and M/F for 1.0.0 - I just put M in for my domain and renamed the file here, then had to install the dependency "chumpy"

Conclusion: Use the smpl model, make sure you have the pkl file downloaded and refrenced, install chumpy.

@Martin-si-Daoishi I think this is the correct answer. The SMPL config is: configs/smpl/256x192_adam_lr1e-3-res34_smpl_24_3d_base_2x_mix.yaml. You don't need to specify the path to the downloaded basicModel_neutral_lbs_10_207_0_v1.0.0.pkl as an argument when running the script but need to change the --cfg to point to the SMPL config file.