speech-driven-animation
speech-driven-animation copied to clipboard
System cannot find the file specified
After installing everything I run into an issue when running the following code:
CODE: import sda va = sda.VideoAnimator(gpu=0, model_path="grid")# Instantiate the animator vid, aud = va("example\image.bmp", "example\audio.wav") va.save_video(vid, aud, "generated.mp4")
ERROR:
File "Y:\SpeechDrivenAnimation\speech-driven-animation\code", line 4, in
I have confirmed the file paths exist and it is getting the correct file - I can only assume it's something internal?
I am getting the same issue, I can't help too much but I dont think its the models.
It could be that there is a problem with the library that opens the audio file. The call to the animator can be done with a numpy array instead of a file so you could try loading the audio file outside the call and providing the numpy array to the animator to see if it runs.
Specify full path in your vid, aud = va("example\image.bmp", "example\audio.wav")
line.
As in, vid, aud = va("C:\<folder name>\example\image.bmp", "C:\<folder name>\example\audio.wav")
Your scripts are searching for the files relative to the path of the script, which is why it cannot find them.
See accepted answer given here: https://stackoverflow.com/questions/31248197/python-pil-imaging-library-filenotfounderror
@spencer759 @Cryaniptic did you guys fix it somehow?
I am having the same issue, tried using the full path but it didn't fix it. So, @A-q-p-W, I don't think it's related to that. Also, before erroring out (either using relative or full paths) python takes up some CPU cycles... so it's clearly doing something that does not end well... but what is it?
@illtellyoulater What you are experiencing might be a different issue and maybe happening during the alignment process (this happens in CPU). You can try using the example and setting aligned=True so that the alignment is skipped to see if this works.
@DinoMan not sure about that, the error message I was receiving is exactly the same described at the top of this thread. Anyway, as a workaround I used this different approach and it worked:
import sda
import scipy.io.wavfile as wav
from PIL import Image
va = sda.VideoAnimator(gpu=0)# Instantiate the aminator
fs, audio_clip = wav.read("example/audio.wav")
frame = Image.open("example/image.bmp")
frame = "example/image.bmp"
vid, aud = va(frame, audio_clip, fs=fs)
va.save_video(vid, aud, "generated.mp4")
Ok good to know it works that way. I noticed that @spencer759 was running under windows so maybe it is related to this (the code was developed on Linux and I never tested on windows). Also unless you have a typo then some of the lines in your code are not necessary. You are loading the image into the frame variable but then replacing it with the filename. The code will handle it and load from file so that's probably why it works. In any case, it is probably safe to say that originally the issue is likely with reading the audio.
frame = Image.open("example/image.bmp") frame = "example/image.bmp"