last-one / Pytorch_Realtime_Multi-Person_Pose_Estimation

Pytorch version of Realtime Multi-Person Pose Estimation project
MIT License
216 stars 70 forks source link

I think there are bugs in train_pose.py #10

Open ghost opened 6 years ago

ghost commented 6 years ago

Hi,

I ran train.sh, but I had some errors. I think there are bugs.

Should I add "input = input.cuda()" to around line 138 in train_pose.py and change line 63 "params_dict = dict(model.module.named_parameters())" in train_pose.py to "params_dict = dict(model.named_parameters())" .

last-one commented 6 years ago

If you use one gpu to train and change line 49 "model = torch.nn.DataParallel(model, device_ids=args.gpu).cuda()" to "model = model.cuda()", you're right. Because of torch.nn.DataParallel, it will change "model" to "model.module" and it's the reason that when run test, I will use k[7:] to get the key. If you use the one gpu, you also need to change the test script

ghost commented 6 years ago

Thank you for your replying.

Yes, I use one gpu to train. Should I change other codes ?

last-one commented 6 years ago

No, I think. If you find something error, please let me know. Thank you.

ghost commented 6 years ago

Thank you !

xdxuefei commented 6 years ago

@tugumi911 you are right! if one gpu is used, "input = input.cuda()" and "params_dict = dict(model.named_parameters())" should be modified! thanks

bandontseng commented 6 years ago

If we want to use only one GPU, there is another way can achieve it.

  1. Remove the line "os.environ['CUDA_VISIBLE_DEVICES'] = '2,3'" in the train_pose.py.
  2. Modify the value of --gpu in train.sh to 0.