[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-72463":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":9,"pushedAt":9,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},72463,"Ultralight-Digital-Human","anliyuan\u002FUltralight-Digital-Human","anliyuan","一个超轻量级、可以在移动端实时运行的数字人模型",null,"Python",2532,373,38,118,0,9,15,42,27,86.42,false,"master",true,[],"2026-06-12 04:01:05","# Ultralight Digital Human\n\n\u003Cp align=\"center\">\n    \u003Ca href=\".\u002FLICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache%202-dfd.svg\">\u003C\u002Fa>\n    \u003Ca href=\"\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.10-aff.svg\">\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fanliyuan\u002FUltralight-Digital-Human\u002Fstargazers\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fanliyuan\u002FUltralight-Digital-Human?color=ccf\">\u003C\u002Fa>\n  \u003Cbr>\n    \u003Cbr>\n\u003C\u002Fp>\n\nA Ultralight Digital Human model can run on mobile devices in real time!!!\n\n一个能在移动设备上实时运行的数字人模型,据我所知，这应该是第一个开源的如此轻量级的数字人模型。\n\nLets see the demo.⬇️⬇️⬇️\n\n先来看个demo⬇️⬇️⬇️\n\n![DigitalHuman](https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F9d0b37ee-2076-4b4f-93ba-eb939a9fb427)\n\n## 如果你视频中声音质量比较差的话，效果大概率不会好。声音质量比较差指的是：1）存在难以忽略的噪声。2）在空旷的房间里录制的视频有回音。3）视频人声不清楚。建议录制视频时候使用外接麦克风，不用拍摄设备自带的麦克风。我自己尝试了声音清晰的情况，不论是wenet还是hubert，效果都非常棒。\n\n## 关于流式推理：\n\n使用流式推理时，建议把静音的图片和对应的关键点放在单独的目录里，img_inference和lms_inference里。\n\n### ！！！！！！建议大家拍摄训练视频的时候前面20秒不说话，但可以做一些小幅度的动作（模拟数字人说话时的动作），这20秒就可以作为流式推理时的素材。！！！！！！\n\n我在代码里加了一些注释，方便大家二次开发\n\n因为一般用到流式推理的场景一般对实时性要求比较高，所以这里我只写了wenet作为音频编码器的情况（实测在2080这样的机器上多个并发时每帧音频处理+视频处理耗时10ms以内，需要将模型转为onnx）。并且根据每个人的使用场景不同，重构代码是必须的，所以我没有做太多的代码优化，这里只提供一些思路给大家参考，如果需要用到hubert作为音频编码器，可以参考其他github的项目。至于C++的推理方法。我大致试了一下，当前方法在ios近两年的设备上实时跑是没什么问题的，大家可以根据dihuman_run.py里的逻辑做翻译，我这里现在有一种能让这个模型跑在更多设备上的方法（效率更高，略微牺牲效果），有人在商用，暂时不做开源。如果大家在使用过程中发现什么问题，请提issue，我会尽力维护这个项目。\n\n## Train\n\nIt's so easy to train your own digital human.I will show you step by step.\n\n训练一个你自己的数字人非常简单，我将一步步向你展示。\n\n### install pytorch and other libs\n\n``` bash\nconda create -n dh python=3.10\nconda activate dh\nconda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia\nconda install mkl=2024.0\npip install opencv-python\npip install transformers\npip install numpy==1.23.5\npip install soundfile\npip install librosa\npip install onnxruntime\n```\n\nI only ran on pytorch==1.13.1, Other versions should also work.\n\n我是在1.13.1版本的pytorch跑的，其他版本的pytorch应该也可以。\n\nDownload wenet encoder.onnx from https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1e4Z9zS053JEWl6Mj3W9Lbc9GDtzHIg6b\u002Fview?usp=drive_link \n\nand put it in data_utils\u002F\n\n### Data preprocessing\n\nPrepare your video, 3~5min is good. Make sure that every frame of the video has the person's full face exposed and the sound is clear without any noise, put it in a new folder.I will provide a demo video.\n\n准备好你的视频，3到5分钟的就可以，必须保证视频中每一帧都有整张脸露出来的人物，声音清晰没有杂音，把它放到一个新的文件夹里面。我会提供一个demo视频，来自康辉老师的口播，侵删。\n\nFirst of all, we need to extract audio feature.I'm using 2 different extractor from wenet and hubert, thank them for their great work.\n\nwenet的代码和与训练模型来自:https:\u002F\u002Fgithub.com\u002FTzenthin\u002Fwenet_mnn\n\n首先我们需要提取音频特征，我用了两个不同的特征提取起，分别是wenet和hubert，感谢他们。\n\nWhen you using wenet, you neet to ensure that your video frame rate is 20, and for hubert,your video frame rate should be 25.\n\n如果你选择使用wenet的话，你必须保证你视频的帧率是20fps，如果选择hubert，视频帧率必须是25fps。\n\nIn my experiments, hubert performs better, but wenet is faster and can run in real time on mobile devices.\n\n在我的实验中，hubert的效果更好，但是wenet速度更快，可以在移动端上实时运行\n\nAnd other steps are in data_utils\u002Fprocess.py, you just run it like this.\n\n其他步骤都写在data_utils\u002Fprocess.py里面了，没什么特别要注意的。\n\n``` bash\ncd data_utils\npython process.py YOUR_VIDEO_PATH --asr hubert\n```\n\nThen you wait.\n\n然后等它运行完就行了\n\n### train\n\nAfter the preprocessing step, you can start training the model.\n\n上面步骤结束后，就可以开始训练模型了。\n\nTrain a syncnet first for better results.\n\n先训练一个syncnet，效果会更好。\n\n``` bash\ncd ..\npython syncnet.py --save_dir .\u002Fsyncnet_ckpt\u002F --dataset_dir .\u002Fdata_dir\u002F --asr hubert\n```\n\nThen find a best one（low loss） to train digital human model.\n\n然后找一个loss最低的checkpoint来训练数字人模型。\n\n2025.6.4更新\n关于syncnet，看到很多issue里面大家提syncnet写的不对。因为这个项目也没有很明确的指标，在生产中，加不加syncnet对结果影响并不大，视觉上不会看出来什么差异的（在我的大量实验中是这样的）。或者说有没有同学可以提供一个更好的syncnet方法？欢迎PR。\n\n``` bash\ncd ..\npython train.py --dataset_dir .\u002Fdata_dir\u002F --save_dir .\u002Fcheckpoint\u002F --asr hubert --use_syncnet --syncnet_checkpoint syncnet_ckpt\n```\n\n## inference\n\nBefore run inference, you need to extract test audio feature(i will merge this step and inference step), run this\n\n在推理之前，需要先提取测试音频的特征（之后会把这步和推理合并到一起去），运行(音频采样率需要是16000)\n\n``` bash\npython data_utils\u002Fhubert.py --wav your_test_audio.wav  # when using hubert\n\nor\n\npython data_utils\u002Fpython wenet_infer.py your_test_audio.wav  # when using wenet\n```\n\nthen you get your_test_audio_hu.npy or your_test_audio_wenet.npy\n\nthen run\n``` bash\npython inference.py --asr hubert --dataset .\u002Fyour_data_dir\u002F --audio_feat your_test_audio_hu.npy --save_path xxx.mp4 --checkpoint your_trained_ckpt.pth\n```\n\nTo merge the audio and the video, run\n\n``` bash\nffmpeg -i xxx.mp4 -i your_audio.wav -c:v libx264 -c:a aac result_test.mp4\n```\n\n## Enjoy🎉🎉🎉\n\n这个模型是支持流式推理的，但是代码还没有完善，之后我会提上来。\n\n关于在移动端上运行也是没问题的，只需要把现在这个模型通道数改小一点，音频特征用wenet就没问题了。相关代码我也会在之后放上来。\n\nif you have some advice, open an issue or PR.\n\n如果你有改进的建议，可以提个issue或者PR。\n\nIf you think this repo is useful to you, please give me a star.\n\n如果你觉的这个repo对你有用的话，记得给我点个star\n\n微信群⬇️⬇️⬇️\n\u003Ctable>\n  \u003Ctr>\n    \u003Ctd>\u003Cimg src=\"demo\u002Fwechat.jpeg\" width=\"180\"\u002F>\u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\n","Ultralight Digital Human 是一个能够在移动设备上实时运行的超轻量级数字人模型。该项目利用 Python 开发，支持流式推理，并且针对移动端进行了优化，确保在保证一定效果的同时达到实时性能要求。用户可以通过简单的步骤训练自己的数字人，适用于需要快速生成和展示虚拟形象的场景，如在线教育、虚拟客服等。项目提供了详细的安装与训练指南，便于开发者快速上手并根据具体需求进行二次开发。",2,"2026-06-11 03:42:08","high_star"]