oawiles / X2Face

Pytorch code for ECCV 2018 paper
MIT License
246 stars 58 forks source link

Weird results. #15

Closed thrillerist closed 5 years ago

thrillerist commented 5 years ago

Hi Olivia, I have run the notebooks, and get following output. The result here is not as good as your demo video. Any idea? Thanks.

00 01 02

oawiles commented 5 years ago

I assume you are just naively running the notebooks.

The problem here is probably a different version of pytorch. In the readme I have listed the version the models were trained in. It is important to use this exact version -- some defaults changed between versions of pytorch meaning that even pretrained models give different results.

As a way to debug, the output should match the images that you see when you first downloaded this github repo (or you can view online on the github repo).

Hope this helps.

thrillerist commented 5 years ago

thanks, it works.

ghost commented 5 years ago

@oawiles seems !pip install torch==0.2.0 is no longer available Could not find a version that satisfies the requirement torch==0.2.0 (from versions: 0.1.2, 0.1.2.post1, 0.3.1, 0.4.0, 0.4.1, 1.0.0, 1.0.1, 1.0.1.post2, 1.1.0) No matching distribution found for torch==0.2.0 is there a alternative?

oawiles commented 5 years ago

I think you're probably safest trying distributions near that (e.g. 0.3.1, 0.1.2). Then try running the notebook and see if you get the same results as the preloaded results. If you do then great! if not, then that version is not compatible.

oawiles commented 5 years ago

Something you could also try (which I haven't) is to change the upsampling (I think the defaults changed with align_corners at some point) which may have been why the pre-computed models don't work properly anymore.

ghost commented 5 years ago

@oawiles with torch==0.3.1 I get this error AttributeError: module 'torch' has no attribute 'device' and with 0.1.2 ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-x3n_q9sj/torch/

oawiles commented 5 years ago

I'm not sure of installation errors. For the no attribute device : is this in the code? -- you could just edit it.

ghost commented 5 years ago

@oawiles I get these results with torch==0.4.1 Screen Shot 2019-05-11 at 5 08 58 AM

oawiles commented 5 years ago

Yes this is wrong and I think this is the reason why. So you can try to update the code for upsampling to the old way -- align_corners=True.

oawiles commented 5 years ago

(I have not tested this so am not sure but basically you should be able to replicate the defaults in the notebook)

ghost commented 5 years ago

@oawiles im still unclear of how I could go about testing this

oawiles commented 5 years ago

When you view the notebook on github you should see some default results. When you load in new modules (+ additional changes) you should get the same results.

mrgloom commented 5 years ago

For macos and python2, after manually fixing code to run models on cpu I was able to reproduce results in https://github.com/oawiles/X2Face/blob/master/UnwrapMosaic/Pose2Face.ipynb

Python2:
    virtualenv -p /usr/local/bin/python2 x2face_env_py2
    python2 --version
    Python 2.7.15
    pip install https://download.pytorch.org/whl/torch-0.2.0.post3-cp27-none-macosx_10_7_x86_64.whl
    python2 -c "import torch; print(torch.__version__)"
    0.2.0_3
    pip install torchvision==0.2.0 --no-deps --no-cache-dir
    python2 -c "import torchvision; print(torchvision.__version__)"
    0.2.0
    python2 -m pip install ipykernel
    python2 -m ipykernel install --user --name=x2face_env_py2
tlatlbtle commented 5 years ago

Same issue. I fixed it by install following packages with specific versions: python=2.7

pip2 install https://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl
pip2 install torchvision==0.2.0