Code Monkey home page Code Monkey logo

Comments (5)

HarryXD2018 avatar HarryXD2018 commented on June 23, 2024

If someone is trying to reproduce the video above, here is my render code.

from matplotlib import pyplot as plt
import cv2
import numpy as np
from tqdm import tqdm
import os

def plot_3d(scatters, frame_id):
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    # set the ax border
    ax.set_xlim(border[0], border[1])
    ax.set_ylim(border[2], border[3])
    ax.set_zlim(border[4], border[5])
    ax.set_box_aspect([1, 1, 1])

    ax.scatter(scatters[0], scatters[1], scatters[2])
    # save the plot as image
    plt.savefig('./rendered/lips_{:06d}.png'.format(frame_id))
    plt.close()


if __name__ == '__main__':
    npy_file_name = 'lips_vertice_causal.npy'
    save_name = 'lips_causal.avi'

    if os.path.exists('./rendered'):
        os.system('rm -r ./rendered')
    os.makedirs('./rendered')

    data = np.load(npy_file_name).reshape(-1, 338, 3)
    # print(data.shape)
    x, y, z = data[..., 0], data[..., 1], data[..., 2]
    # print(x.shape, y.shape, z.shape)
    border = [x.min(), x.max(), y.min(), y.max(), z.min(), z.max()]
    # print(border)
    for idx in tqdm(range(x.shape[0]), desc='plotting'):
        plot_3d([x[idx, :], y[idx, :], z[idx, :]], idx)

    # save as video
    img = cv2.imread('./rendered/lips_000000.png')
    h, w, _ = img.shape
    fourcc = cv2.VideoWriter_fourcc(*'XVID')
    video = cv2.VideoWriter(save_name, fourcc, 30, (w, h))
    for i in tqdm(range(x.shape[0]), desc='writing video'):
        video.write(cv2.imread('./rendered/lips_{:06d}.png'.format(i)))
    video.release()
    cv2.destroyAllWindows()

from audio2photoreal.

alexanderrichard avatar alexanderrichard commented on June 23, 2024

Hi and thanks for your interest in our work! To your questions:

  1. Yeah, it's not really an encoder-decoder structure, it's really just a single straight-through network. As you can see, the transformer decoder does not receive informative input, only zeros:

    x = torch.zeros(B, T, 512, device=audio.device)

    So, in other words, the audio-to-lip module is just a regressor that goes from wav2vec to vertex space with a few transformer-style operations. The architecture looks a bit confusing, which is an artifact of other experiments to make the module not a regressor but an actual diffusion model. You can just ignore this :)

  2. No attention mask. Correct. Our whole framework is an acausal model, so there is no need to induce causality in the audio encodings or in the lip regressor.

  3. Lip vertex visualization. The model doesn't predict the vertices in its original vertex space, but in a z-normalized space (so each vertex has zero mean and unit variance). If you'd want to see the actual lip vertices, you'd have to revert that transformation. Is this something you need? In that case I could see to dig it up for you.

from audio2photoreal.

HarryXD2018 avatar HarryXD2018 commented on June 23, 2024

Thank you so much for replying. I guess transforming to z-normed space will benefit training, is that correct?

If convenient, I would appreciate it if you could show me how to revert to the original vertex space.

Many thanks :)

from audio2photoreal.

alexanderrichard avatar alexanderrichard commented on June 23, 2024

Hey! The version of the lip regressor used in here actually uses a more complex decoding from the lip vertex space that you plotted which we unfortunately can't provide publicly since you would be able to render lip-information of participants that are not approved for public release. Sorry :(

from audio2photoreal.

HarryXD2018 avatar HarryXD2018 commented on June 23, 2024

Thanks for replying! Closing the issue as the lips regressor is making a reasonable prediction.

from audio2photoreal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.