princeton-vl / pytorch_stacked_hourglass

Pytorch implementation of the ECCV 2016 paper "Stacked Hourglass Networks for Human Pose Estimation"
BSD 3-Clause "New" or "Revised" License
469 stars 94 forks source link

How to test one's own image #1

Closed EvenGu closed 4 years ago

EvenGu commented 4 years ago

Hi, there,

I want to run the model (checkpoint.pt) on my own images and make predictions. How should I do that? I see the test.py use the configuration of the train.py, which takes in the jpeg files in the data/MPII/images. Do I simply change the img_dir in the ref.py img_dir = 'data/MPII/images' to path_to_my_images?

Thank you for your help!

crockwell commented 4 years ago

Yes, you should be able to make predictions on other images by putting them in data/MPII/images. Keep in mind that the current pipeline loads filenames from the "train.h5"/"val.h5"/"test.h5" in data/MPII/annot. See line ~179 in test.py. Also, keep in mind there are a few other things being loaded from these files for cropping, e.g. center and scale. The model performs best when people are centered and at a scale consistent with MPII.