MuseTalk icon indicating copy to clipboard operation
MuseTalk copied to clipboard

训练预处理时,保存的人脸图片比原始帧数要少

Open miumiuc opened this issue 1 year ago • 7 comments

请问一下训练前进行数据预处理时,保存在images中人脸帧数比视频的原始帧数要少很多,是这里的代码会覆盖图片嘛,还是特地这样设计的?这样音频特征与图片是不是对应不上了 for i, (whisper_batch,crop_batch) in enumerate(tqdm(gen,total=int(np.ceil(float(video_num)/batch_size)))): crop_index=0 for image,audio in zip(crop_batch,whisper_batch): cv2.imwrite(f"data/images/{folder_name}/{str(i+crop_index+total_image_index+1)}.png",image) crop_index+=1 temp_image_index=i+crop_index+total_image_index+1

miumiuc avatar Aug 24 '24 15:08 miumiuc

我也遇到了 可能是总数没有对齐batch_size 导致最后一部分变少吧 我还没看代码 不知道有没有丢弃那部分

Embracex1998 avatar Aug 27 '24 05:08 Embracex1998

是这个索引的问题:str(i+crop_index+total_image_index+1)},会出现重复的索引,比如第一个batch索引是0,1,2,3,第二个batch索引是1,2,3,4,这样1,2,3就被覆盖掉了,关于训练还有一些问题,可以加个联系方式吗

miumiuc avatar Aug 27 '24 09:08 miumiuc

我们也遇到同样的问题,这样会导致人脸数量的音频特征对不上,不知道是bug还是场景这么做的

zhangyuzyy avatar Sep 09 '24 10:09 zhangyuzyy

Fix it by: crop_index=0 for i, (whisper_batch,crop_batch) in enumerate(tqdm(gen,total=int(np.ceil(float(video_num)/batch_size)))): for image,audio in zip(crop_batch,whisper_batch): cv2.imwrite(f"data/images/{folder_name}/{str+crop_index+total_image_index+1)}.png",image) crop_index+=1 temp_image_index=crop_index+total_image_index+1

ShowLo avatar Sep 14 '24 16:09 ShowLo

是这个索引的问题:str(i+crop_index+total_image_index+1)},会出现重复的索引,比如第一个batch索引是0,1,2,3,第二个batch索引是1,2,3,4,这样1,2,3就被覆盖掉了,关于训练还有一些问题,可以加个联系方式吗

感觉训练代码有很多坑,填坑需要不少时间,感觉@ShowLo 是正解

hnsywangxin avatar Sep 18 '24 14:09 hnsywangxin

Fix it by: crop_index=0 for i, (whisper_batch,crop_batch) in enumerate(tqdm(gen,total=int(np.ceil(float(video_num)/batch_size)))): for image,audio in zip(crop_batch,whisper_batch): cv2.imwrite(f"data/images/{folder_name}/{str+crop_index+total_image_index+1)}.png",image) crop_index+=1 temp_image_index=crop_index+total_image_index+1

Could you make a pull request for this so that we can review and fix this issue? Thanks!

czk32611 avatar Sep 19 '24 01:09 czk32611

楼上正解,是索引的问题。训练代码问题不少,而且还有一些可以优化的地方。

foreverhell avatar Sep 19 '24 06:09 foreverhell