csbhr / FFHQ-UV

The official repository of our CVPR2023 paper "FFHQ-UV: Normalized Facial UV-Texture Dataset for 3D Face Reconstruction".
MIT License
466 stars 46 forks source link

Generate 3D head obj ? #32

Closed MilesTheProwler closed 1 year ago

MilesTheProwler commented 1 year ago

Hello, In your code, Is there any process for generating 3D head obj ? Or you just download the 3D head.obj as datasets from others ?

SlimeVRX commented 1 year ago

Yes, you can export 3D head obj. See my demo

MilesTheProwler commented 1 year ago

Thank you for your reply. To export 3D head obj which .py should I run ?

Also, Is it possible to run in window Anaconda ? I have problem to run .sh file in window even though I install bash.

SlimeVRX commented 1 year ago

Also, Is it possible to run in Windows Anaconda ?

the environment can be installed on Windows with Anaconda.

I have problem to run .sh file in window even though I install bash.

I don't use .sh. I read Python code in .sh and run

Example: run_ffhq_uv_dataset.sh

#!/bin/bash
set -e

######################### Configuration #########################
# proj_data_dir: the directory of the dataset project, which contains a "images" sub-folder
# checkpoints_dir: the directory of the used checkpoints
# topo_assets_dir: the directory of the topo assets, e.g., 3DMM, masks, etc.
#################################################################
proj_data_dir=../examples/dataset_examples
checkpoints_dir=../checkpoints
topo_assets_dir=../topo_assets

####################### Step 1. Inversion #######################
# Read the original images in "images" sub-folder
# Save the inverted latents in "latents" sub-folder
# Save the inverted images in "inversions" sub-folder
#################################################################
cd ./DataSet_Step1_Inversion
python run_e4e_inversion.py \
    --proj_data_dir ${proj_data_dir} \
    --e4e_model_path ${checkpoints_dir}/e4e_model/e4e_ffhq_encode.pt \
    --shape_predictor_model_path ${checkpoints_dir}/dlib_model/shape_predictor_68_face_landmarks.dat

You can run python

python run_e4e_inversion.py \
    --proj_data_dir ${proj_data_dir} \
    --e4e_model_path ${checkpoints_dir}/e4e_model/e4e_ffhq_encode.pt \
    --shape_predictor_model_path ${checkpoints_dir}/dlib_model/shape_predictor_68_face_landmarks.dat

with value ${proj_data_dir} get from proj_data_dir=../examples/dataset_examples

MilesTheProwler commented 1 year ago

Thank you @SlimeVRX . This will help me a lot !

MilesTheProwler commented 1 year ago

Sorry when I run run_e4e_inversion.py, I got this error. Do you got that error ? image

This is what I run image

SlimeVRX commented 1 year ago

This error is very family. Please copy entire error message!

``

study uses "`" to show code

MilesTheProwler commented 1 year ago

Here is full error Python= 3.8 I use torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0. Cannot install pytorch3d with error. The command that I run : python run_e4e_inversion.py --proj_data_dir --e4e_model_path --shape_predictor_model_path

May I also know which image format you use it ? When I run in colab with my own input image png it say" RuntimeError: Unknown image file format: Unable to load image in file ../examples/dataset_examples/images/.ipynb_checkpoints "

C:\Users\ADMIN\anaconda3\envs\FFHQ\lib\site-packages\numpy\_distributor_init.py:30: UserWarning: loaded more than 1 DLL from .libs:
C:\Users\ADMIN\anaconda3\envs\FFHQ\lib\site-packages\numpy\.libs\libopenblas.FB5AE2TYXYH2IJRDKGDGQ3XBKLKTF43H.gfortran-win_amd64.dll
C:\Users\ADMIN\anaconda3\envs\FFHQ\lib\site-packages\numpy\.libs\libopenblas64__v0.3.21-gcc_10_3_0.dll
  warnings.warn("loaded more than 1 DLL from .libs:"
C:\Users\ADMIN\anaconda3\envs\FFHQ\lib\site-packages\torch\utils\cpp_extension.py:305: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified
  warnings.warn(f'Error checking compiler version for {compiler}: {error}')
INFO: Could not find files for the given pattern(s).
Traceback (most recent call last):
  File "run_e4e_inversion.py", line 10, in <module>
    from models.psp import pSp  # we use the pSp framework to load the e4e encoder.
  File "C:\Users\ADMIN\Desktop\FFHQ-UV\DataSet_Step1_Inversion\models\psp.py", line 6, in <module>
    from models.encoders import psp_encoders
  File "C:\Users\ADMIN\Desktop\FFHQ-UV\DataSet_Step1_Inversion\models\encoders\psp_encoders.py", line 9, in <module>
    from models.stylegan2.model import EqualLinear
  File "C:\Users\ADMIN\Desktop\FFHQ-UV\DataSet_Step1_Inversion\models\stylegan2\model.py", line 7, in <module>
    from models.stylegan2.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d
  File "C:\Users\ADMIN\Desktop\FFHQ-UV\DataSet_Step1_Inversion\models\stylegan2\op\__init__.py", line 1, in <module>
    from .fused_act import FusedLeakyReLU, fused_leaky_relu
  File "C:\Users\ADMIN\Desktop\FFHQ-UV\DataSet_Step1_Inversion\models\stylegan2\op\fused_act.py", line 9, in <module>
    fused = load(
  File "C:\Users\ADMIN\anaconda3\envs\FFHQ\lib\site-packages\torch\utils\cpp_extension.py", line 1080, in load
    return _jit_compile(
  File "C:\Users\ADMIN\anaconda3\envs\FFHQ\lib\site-packages\torch\utils\cpp_extension.py", line 1293, in _jit_compile
    _write_ninja_file_and_build_library(
  File "C:\Users\ADMIN\anaconda3\envs\FFHQ\lib\site-packages\torch\utils\cpp_extension.py", line 1392, in _write_ninja_file_and_build_library
    _write_ninja_file_to_build_library(
  File "C:\Users\ADMIN\anaconda3\envs\FFHQ\lib\site-packages\torch\utils\cpp_extension.py", line 1824, in _write_ninja_file_to_build_library
    _write_ninja_file(
  File "C:\Users\ADMIN\anaconda3\envs\FFHQ\lib\site-packages\torch\utils\cpp_extension.py", line 1949, in _write_ninja_file
    cl_paths = subprocess.check_output(['where',
  File "C:\Users\ADMIN\anaconda3\envs\FFHQ\lib\subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Users\ADMIN\anaconda3\envs\FFHQ\lib\subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['where', 'cl']' returned non-zero exit status 1.
SlimeVRX commented 1 year ago

Do you install ninja library?

pip install ninja

MilesTheProwler commented 1 year ago

yes ninja 1.11.1 pypi_0 pypi

Can I get your whatsapp account ? Could you please help me?

MilesTheProwler commented 1 year ago

@SlimeVRX I figure it out to solve that error. But got another error in python run_ms_api_attr.py --proj_data_dir ../examples/dataset_examples. It lead to MS API error.

SlimeVRX commented 1 year ago

Hi,

I dont have MS API, I read sample MS API and reuse these values

MilesTheProwler commented 1 year ago

Do you have discord or any social media ? Can you please help me ? I am still stuck at step 2 and step 3

SlimeVRX commented 1 year ago

Please my Wechat!

MilesTheProwler commented 1 year ago

I already add you can you please accept ?

pyh007 commented 1 year ago

你好,请问下是在哪里加的微信

SlimeVRX commented 1 year ago

Hi everyone,

I said I would assist everyone with the issues over the weekend. Now that I have time, create issues and tag me, I will help everyone

Sorry my WeChat is not available at the moment (I left my phone at the office)

MilesTheProwler commented 1 year ago

Hi @SlimeVRX Do you know how to add eye ball automatically on head mesh ? The add_eye_ball code in ffhq is just create eye ball and its texture not apply on the mesh.

SlimeVRX commented 1 year ago

Hi @SlimeVRX Do you know how to add eye ball automatically on head mesh ? The add_eye_ball code in ffhq is just create eye ball and its texture not apply on the mesh.

Hi, I think you need someone who specializes in 3D software like Blender, Maya to help you