OpenTalker / SadTalker

[CVPR 2023] SadTalker:Learning Realistic 3D Motion Coefficients for Stylized Audio-Driven Single Image Talking Face Animation
https://sadtalker.github.io/
Other
11.61k stars 2.16k forks source link

Wrong Numpy Version - error #839

Open SirDuffy opened 5 months ago

SirDuffy commented 5 months ago

Hi, my sad talker version does not run anymore. The error message says that the numpy version is wrong. How can i repair this?

image

oisilener1982 commented 5 months ago

same problem if i use 1.8

Zhjhp2020 commented 5 months ago

微信图片_20240321114541 me too

oisilener1982 commented 5 months ago

IF the devs are only active this would have been an easy job to fix

dthcle commented 5 months ago

try use "cfloat"?

Nate82 commented 5 months ago

try use "cfloat"?

Can you go into more detail? Should we change the code somewhere?

ayoubachak commented 5 months ago

Hi, my sad talker version does not run anymore. The error message says that the numpy version is wrong. How can i repair this?

image

I have the same issue, it comes from the following section of code :

def calculate_points(heatmaps):
    # change heatmaps to landmarks
    B, N, H, W = heatmaps.shape
    HW = H * W
    BN_range = np.arange(B * N)

    heatline = heatmaps.reshape(B, N, HW)
    indexes = np.argmax(heatline, axis=2)

    preds = np.stack((indexes % W, indexes // W), axis=2)
    preds = preds.astype(np.float, copy=False) <--- this line

    inr = indexes.ravel()

in the file src/face3d/util/my_awing_arch.py

I tried to convert it to normal python float and it went away, but now I still have this error : File "C:\Users\stable-diffusion-webui/extensions/SadTalker\src\face3d\util\preprocess.py", line 101, in align_img trans_params = np.array([w0, h0, s, t[0], t[1]]) ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5,) + inhomogeneous part.

Here is my config : image

NOTE : I had a similar issue before with the librosa library, but it was with the np.comlex, it was similar to this one with np.float, so I changed it from the source code of the librosa library ( from np.complex to complex ).

fnabbo commented 5 months ago

Hi, my sad talker version does not run anymore. The error message says that the numpy version is wrong. How can i repair this? image

I have the same issue, it comes from the following section of code :

def calculate_points(heatmaps):
    # change heatmaps to landmarks
    B, N, H, W = heatmaps.shape
    HW = H * W
    BN_range = np.arange(B * N)

    heatline = heatmaps.reshape(B, N, HW)
    indexes = np.argmax(heatline, axis=2)

    preds = np.stack((indexes % W, indexes // W), axis=2)
    preds = preds.astype(np.float, copy=False) <--- this line

    inr = indexes.ravel()

in the file src/face3d/util/my_awing_arch.py

I tried to convert it to normal python float and it went away, but now I still have this error : File "C:\Users\stable-diffusion-webui/extensions/SadTalker\src\face3d\util\preprocess.py", line 101, in align_img trans_params = np.array([w0, h0, s, t[0], t[1]]) ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5,) + inhomogeneous part.

Here is my config : image

NOTE : I had a similar issue before with the librosa library, but it was with the np.comlex, it was similar to this one with np.float, so I changed it from the source code of the librosa library ( from np.complex to complex ).

I had the exact same issue and was stuck at the same error. After a little research i figured its because the array contains int and float and therefor throws that error. Explcitly specifying that it can take an object fixed it:

In file src\face3d\util\preprocessor.py line 101 I replaced trans_params = np.array([w0, h0, s, t[0], t[1]]) with trans_params = np.array([w0, h0, s, t[0], t[1]], dtype=object)

(I also had to fix the np.complex and np.float issue before this)

ayoubachak commented 5 months ago

Hi, my sad talker version does not run anymore. The error message says that the numpy version is wrong. How can i repair this? image

I have the same issue, it comes from the following section of code :

def calculate_points(heatmaps):
    # change heatmaps to landmarks
    B, N, H, W = heatmaps.shape
    HW = H * W
    BN_range = np.arange(B * N)

    heatline = heatmaps.reshape(B, N, HW)
    indexes = np.argmax(heatline, axis=2)

    preds = np.stack((indexes % W, indexes // W), axis=2)
    preds = preds.astype(np.float, copy=False) <--- this line

    inr = indexes.ravel()

in the file src/face3d/util/my_awing_arch.py

I tried to convert it to normal python float and it went away, but now I still have this error : File "C:\Users\stable-diffusion-webui/extensions/SadTalker\src\face3d\util\preprocess.py", line 101, in align_img trans_params = np.array([w0, h0, s, t[0], t[1]]) ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5,) + inhomogeneous part.

Here is my config : image

NOTE : I had a similar issue before with the librosa library, but it was with the np.comlex, it was similar to this one with np.float, so I changed it from the source code of the librosa library ( from np.complex to complex ).

I had the exact same issue and was stuck at the same error. After a little research i figured its because the array contains int and float and therefor throws that error. Explcitly specifying that it can take an object fixed it:

In file src\face3d\util\preprocessor.py line 101 I replaced trans_params = np.array([w0, h0, s, t[0], t[1]]) with trans_params = np.array([w0, h0, s, t[0], t[1]], dtype=object)

(I also had to fix the np.complex and np.float issue before this)

It worked perfectly, thanks G.

AppStolz commented 5 months ago

Take a look here at a solution that works 100% https://github.com/OpenTalker/SadTalker/issues/822#issuecomment-2053857698