[WIP] Initiate animation component#400
[WIP] Initiate animation component#400ctao456 wants to merge 120 commits intoopea-project:mainfrom ctao456:ctao/animation
Conversation
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: ZhangJianyu <[email protected]>
Signed-off-by: ZhangJianyu <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
for more information, see https://pre-commit.ci
Signed-off-by: Chun Tao <[email protected]>
…into ctao/animation Signed-off-by: Chun Tao <[email protected]>
for more information, see https://pre-commit.ci
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
for more information, see https://pre-commit.ci
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
for more information, see https://pre-commit.ci
Signed-off-by: Chun Tao <[email protected]>
…into ctao/animation
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
Signed-off-by: Chun Tao <[email protected]>
for more information, see https://pre-commit.ci
louie-tsai
left a comment
There was a problem hiding this comment.
looks good. still need more time to look into annimation.py.
| full_frames = [cv2.imread(args.face)] | ||
| fps = args.fps | ||
| else: | ||
| video_stream = cv2.VideoCapture(args.face) |
There was a problem hiding this comment.
do you know where CV2 runs on? do they leverage Gaudi?
Could we leverage Gaudi media pipeline?
https://docs.habana.ai/en/latest/Media_Pipeline/Media_Pipeline.html?highlight=media
There was a problem hiding this comment.
CV2 runs on cpu by default. If we want gpu support, we need to build CV2 from source. I don't see CV2 on Gaudi in the documentation.
Media pipeline is possible. Added as a TO-DO.
| if args.resize_factor > 1: | ||
| frame = cv2.resize(frame, (frame.shape[1] // args.resize_factor, frame.shape[0] // args.resize_factor)) | ||
| if args.rotate: | ||
| frame = cv2.rotate(frame, cv2.ROTATE_90_CLOCKWISE()) |
There was a problem hiding this comment.
good to have an estimation how long CV2 tasks take.
| # one single video frame corresponds to 80/25*0.01 = 0.032 seconds (or 32 milliseconds) of audio | ||
| # 30 fps video will match closer to audio, than 25 fps | ||
| mel_chunks = [] | ||
| mel_idx_multiplier = 80.0 / fps |
There was a problem hiding this comment.
what does 80 mean here? good to give it a variable or definition instead of magic number
There was a problem hiding this comment.
80 is the batch size of mel chunks during training, to be fused with 1 second video.

Paper here: https://arxiv.org/pdf/2008.10010
So 80/fps is how many mel chunks are used to select to associate one image frame.
|
|
||
| frame_h, frame_w = full_frames[0].shape[:-1] | ||
| if args.inference_mode == "wav2clip_only": | ||
| out = cv2.VideoWriter("temp/result.avi", cv2.VideoWriter_fourcc(*"DIVX"), fps, (frame_w, frame_h)) |
There was a problem hiding this comment.
also good to understand the time taken by cv2 here.
Description
Add a new component called "Animation", first PR includes Wav2Lip+GFPGAN model
Issues
opea-project/docs#59
Type of change
List the type of change like below. Please delete options that are not relevant.
Dependencies
Wav2Lip-GFPGAN
opea-project/GenAIExamples#523
Tests
Once microservice starts, user can use below script to validate the running microservice.
or
cd comps/animation python3 test_animation_server.pyThe expected output is a message prompting
"Video generated successfully, check $OUTFILE for the result."Please find "outputs/result.mp4" in the current directory as a reference generated video.