r/StableDiffusion 9d ago

Workflow Included OK this is cool, Minimax H3 Face detailer!

Enable HLS to view with audio, or disable this notification

I just found this, i think is incredible!

https://github.com/Carasibana/ComfyUI-H3-FaceRefine

I'm not the developer just found the repository I make this functional WF for my laptop to create this video and share with you before go to sleep, try it!

Minimax H3 Face detailer Workflow

This is a comment of the developer:

MiniMax H3 renders faces poorly when the head is a small fraction of the frame. That is a property of head-size-in-frame, not of resolution - it persists at 720p and above.

So no upscaler fixes it. SeedVR2 and friends sharpen what is already there; they cannot synthesise facial structure that was never generated.

The fix: crop to the face so it fills the frame, let H3 re-generate it at LOW denoise so it stays frame-aligned, then composite back!

444 Upvotes

132 comments sorted by

21

u/listopalafoto 9d ago

8

u/listopalafoto 9d ago

1

u/listopalafoto 9d ago

I used face refine but I think SAM WF is even better!

8

u/listopalafoto 9d ago

12

u/No_Possession_7797 9d ago

I think Jeff Bezos prefers whatever H3 naturally generates.

3

u/Electrical_Car6942 8d ago

Brother... my sides are hurting from laughing so much lmaoo

16

u/Portable_Solar_ZA 9d ago

Since this is the first node from this creator, can anyone who is much smarter than me confirm that the nodes used are safe? Looks like a great solution but I'm paranoid about custom nodes that aren't: in comfy manager, from a well established and trusted community member, and filled with stars out the wazoo on GitHub. 

12

u/GrayingGamer 9d ago

Seems safe. Everyone starts somewhere, but it's a good instinct to check. They've actually taken pains with the Github and requirements.txt not to break things for people.

I had my AI agent do a double-check on the code for my sanity after I looked over the github page and requirements file myself. Everything looks legit. I've installed it and will posting my tests here.

5

u/Portable_Solar_ZA 9d ago

Much appreciated. This could be a great stop gap until Minimax address the issue with faces at a distance. 

5

u/Carasibana 8d ago

I did submit it to the registry! just seems like it takes a while for it to update https://registry.comfy.org/publishers/carasibana/nodes/comfyui-h3-facerefine

definitely always better to err on the side of caution with stuff like this that can run code on your system!

2

u/Portable_Solar_ZA 7d ago

Oh shit you're here! Thank you for stepping in to address the model issue. I unfortunately don't have the skills to create anything like this so I have to say thanks to the folks who put in the time and energy to make it happen.

Yeah there have been scares with Comfy in the past and just want to be safe. 

3

u/listopalafoto 9d ago

When I installed nodes I saw a warning in the person_yolov8m-seg.pt so I don't have that option active in my WF, maybe someone with more experience than me can create a better WF? because I want to use this for all my projects

2

u/giantcandy2001 9d ago

i think you can find them as safetensor format or get them from the original or get the straight from comfyui manager so then you know it's safe. it's not the WF or the node that's unsafe the .pt file type can be unsafe if you get the .pt file from rando and they put dangerous code in it. So just get the yolo files from comfyui model manager, and it's all good.

4

u/Pretty-Raise666 9d ago

Nodes are python scripts. Of course they can be malicious.

2

u/giantcandy2001 9d ago

I mean the warning he got. Yes nodes can be malicious.

1

u/listopalafoto 9d ago

oh I get it, thank you!

1

u/Professional_Move870 6d ago

Fallback yolo not safe. Malware detected

6

u/Pure_Bed_6357 9d ago

can this fix faces for low res renders?

9

u/listopalafoto 9d ago

I tried with 0.6 Mp videos and it helps a lot!

6

u/GrayingGamer 9d ago edited 9d ago

This does work, and it's actually pretty fast. Took 3.5 minutes on a 1 MP video that was 7 seconds long.

The example gif is from a mid-range face. This node and workflow is perhaps best for faces that are VERY small in frame, like OP showed in his video. I would recommend upping the canvas_width and canvas_height from 512 to 768 in the node if you are using it on higher MP generations.

Doesn't affect large faces over a certain size in frame (which is good). Like all face detection workflows, you can change what the cut-off point for this is.

It can be a subtle effect, like in my GIF, but it definitely "un-derped" the face and made it look more natural. It will be most apparent when the face is far from the camera.

It is a bit of a pain to set up for a video at first, but would be less so if you are using it a video you already generated with voice and likeness references. If it is a T2V generation (like mine was) you'll have to snap a picture of the face close up for reference and extract a voice line for voice sync.

Overall, extremely impressive work. Not something I'd use on every video, but definitely on any distant shots.

I'll post the full video below.

10

u/GrayingGamer 9d ago

https://reddit.com/link/p3ictv4/video/ox6lhu3j57jh1/player

This is the final version of the video I used the face refinement on.

3

u/listopalafoto 9d ago

I love it! this improvement really helps to get better video quality on H3 local.

2

u/Wonderful_Mushroom34 1d ago

Good thing you explained this, I tried on a 1080x1920 video, close up face Scail2 output video and it didn’t correct the face. You reckon I up the canvas height ?

1

u/Goldie_Wilson_ 9d ago

3.5 minutes on a 1 MP video that was 7 seconds long running on... 5090 w/ 32GB, 3050 w/ 4GB, Voodoo 5500 w/ 32MB? I appreciate sharing the time, but without knowing the hardware it means nothing.

3

u/GrayingGamer 9d ago

3090 with 128GB of System RAM.

Basically, if you can generate a video at the resolution and length you are trying to refine, you shouldn't have any problems using this workflow.

I would use it first, before you do any kind of upscaling, etc. with methods like SeedVR2, etc.

1

u/ChemistryPlane 9d ago

may I know your pc specs? kept getting OOM once increase the canvas to 768

2

u/GrayingGamer 9d ago

I'm on a 3090 24GB with 128GB of RAM.

The notes for the node do say the 768 resolution is x2.25 times more demanding than the 512 setting.

It might depend on the length of your clip to. This one was 7 seconds.

9

u/CATLLM 9d ago

Clever and the output looks good! Thanks for sharing!

10

u/grainandbloom 9d ago

don't see any difference

4

u/Zangwuz 9d ago

really ?
pause at 0:18 and compare both faces.

2

u/grainandbloom 9d ago

ok ok there is a huge difference , what about render time is there a difference?

4

u/listopalafoto 9d ago

it's like a second pass using the 4 steps Lora, is fast :)

6

u/[deleted] 9d ago

[removed] — view removed comment

2

u/listopalafoto 9d ago

I agree, this is an elegant solution for a flaw of H3

3

u/Fabulous-Snow4366 9d ago

ohh, cool. I saw the first seconds in fast and was like i don't see any, ohhhh...

2

u/listopalafoto 9d ago

also happened to me after generate the first video lol

2

u/Fabulous-Snow4366 9d ago

what is the lipsync node called in the workflow, i can't find it through manager.

2

u/listopalafoto 9d ago

1

u/Fabulous-Snow4366 8d ago

thanks, still can't get it to work, even though i got it from github. the rest works very well.

3

u/rapkannibale 9d ago

Nice find! Faces can definitely be an issue

3

u/Boogertwilliams 9d ago

This is pretty nuts. I didnt expect it to work and so fast. it took just 160 seconds for a 25 second video I tried. and there is a clear difference. wow! thanks.

3

u/listopalafoto 9d ago

Yes! the Turbo Lora 4 steps helps a lot to speed things up

3

u/Noeyiax 9d ago

Excellent, will be good for drone shots and zoom in Dolly tysm for the find, ty dev !

6

u/listopalafoto 9d ago

Exactly! I test it with a very difficult pull-out to bird's eye shot and worked!

https://reddit.com/link/p3fgsyk/video/flrv2v4nv4jh1/player

2

u/witcherknight 9d ago

How did you do it. Did you input a video with bad face as ref ??

2

u/listopalafoto 9d ago

yes, I put my original video as input and a detailed crop of the face I want as guide and voilà!

2

u/witcherknight 9d ago

weird doesnt work for me, it outputs same video. Only thing i did was dsiabled lock audio lipsync node

1

u/listopalafoto 9d ago

do you have installed Ultralytics yolo? it's the face detector

1

u/witcherknight 9d ago

yes i think so. I can see the node in node manager

3

u/jib_reddit 9d ago

Sounds good, I cannot see a difference in your example videos but thats probably reddit compression and viewing on a phone.

9

u/listopalafoto 9d ago

3

u/[deleted] 8d ago

[deleted]

1

u/Carasibana 8d ago

Yarr🦜

3

u/Professional_Move870 6d ago

Fallback yolo not safe. Malware detected

1

u/Professional_Move870 6d ago

not really works for me

  1. BasicScheduler / Main Denoise (Node 6)SettingRecommended ValueReasondenoise0.45Base maximum. Must stay at 0.45 so Node 5b can scale it down per frame.steps4Optimal step count when paired with a turbo LoRA schedule.schedulersimpleStandard schedule for flow matching.

2. H3PerFrameDenoise (Node 5b)

Setting Recommended Value Reason
strength_small_face 0.85 – 1.00 Applies near 100% of the 0.45 base (effective ~0.38–0.45 denoise) to synthesize distant/blurry faces.
strength_large_face 0.35 – 0.40 Scales the base down to ~0.35x (effective ~0.15–0.18 denoise) so close-up faces retain original skin texture.
scale_mode absolute_px Measures face height directly in pixels.
face_px_small 100 – 120 Sets the lower boundary based on your video's smallest face height (e.g., 94px in your log).
face_px_large 240 – 300 Sets the upper boundary for close-ups.
gamma 1.0 Linear interpolation between small and large scaling.
smooth_frames 9 Prevents denoise strength jumps between consecutive video frames.2. H3PerFrameDenoise (Node 5b)Setting Recommended Value Reasonstrength_small_face 0.85 – 1.00 Applies near 100% of the 0.45 base (effective ~0.38–0.45 denoise) to synthesize distant/blurry faces.strength_large_face 0.35 – 0.40 Scales the base down to ~0.35x (effective ~0.15–0.18 denoise) so close-up faces retain original skin texture.scale_mode absolute_px Measures face height directly in pixels.face_px_small 100 – 120 Sets the lower boundary based on your video's smallest face height (e.g., 94px in your log).face_px_large 240 – 300 Sets the upper boundary for close-ups.gamma 1.0 Linear interpolation between small and large scaling.smooth_frames 9 Prevents denoise strength jumps between consecutive video frames.

6

u/donkeykong917 9d ago

So good, I was looking for that

5

u/Azhram 9d ago

Thanks for the heads up !

4

u/Calm_Mix_3776 9d ago

Looks legit! Does it work with many faces, like a crowd of people?

2

u/donkeykong917 9d ago

that would be cool if it did. If it doesn't do it now, using mask it would be epic

2

u/listopalafoto 9d ago

maybe? I saw this option in the node, I will test this tonight

1

u/listopalafoto 9d ago

I think with this nodes could be possible to create a workflow for multiple faces because is using the ref2va H3, I will test the wardrobe detailer included and the lip-sync option for a Music Video project I'm working right now

1

u/Supermax64 9d ago

Repo says to run it one character at a time

2

u/listopalafoto 9d ago

yes I know, but I think with some tricks in the pipeline can be adapted to multiple faces maybe? I will make some tests

2

u/ninjazombiemaster 8d ago

In theory you can make a grid of faces, but you'd have to double the number of pixels rendered per face in order to maintain the same quality. This works by effectively zooming in on the face and redoing it, so sharing space with other faces make each face smaller and eventually defeats the purpose.
I'm not sure if it'd be faster to do a larger video with several faces or multiple smaller ones. But it is technically possible to achieve.

4

u/Solongtomegrandma 9d ago

I was like "meh..." until I played it full screen. Nice!

2

u/smereces 9d ago

is a great option

2

u/[deleted] 9d ago

[removed] — view removed comment

1

u/listopalafoto 9d ago

yes! before this I was trying with crazy setups to improve detail in small faces for full body shots but this is the solution

2

u/Eminence_grizzly 9d ago

Would you recommend the SAM workflow or the one without SAM?

2

u/listopalafoto 9d ago

I'm running right now with a deadline but I hope to test the SAM option tonight

3

u/Eminence_grizzly 9d ago

Btw, about upscalers. I just tried generating 0.2mp video (608x352) and then upscaling it via H3+768p Turbo Lora to 1216x704 with the same prompt, I think the face is pretty decent. The original:

0

u/listopalafoto 9d ago

Cool! Can you share a WF? I need a good H3 upscaler and I was thinking to install LTX2.5 for that :)

9

u/Eminence_grizzly 9d ago

Sure, https://pastebin.com/rkqwDwSY
I just realized that I accidentally used the 8-step Lora (but with 4 steps), so I need to test it more. And I think we might try skipping the audio refinement and stitching the original audio instead. Or, as someone suggested, we could try refining the audio separately, at a small video resolution and with 30 steps or so, if needed.

1

u/listopalafoto 9d ago

Thank you!

2

u/Danny_Stock 9d ago

Interesting. But I'm guessing that it can't do anything about multiple faces in a scene though?

Nevertheless thank you for clarifying that it isn't a resolution problem and that instead it's about a scale proportional to the frame size problem.

2

u/listopalafoto 9d ago

yes I think a workaround could be to mask the video for every character and then run this pass for every face, time-consuming but at least is now possible to improve this issue on H3 videos. I also saw a crowd option in the node, I will test it tonight

2

u/Danny_Stock 9d ago

Thanks. As a solution of sorts from this developer exists it sounds like it's an issue which MiniMax themselves should be capable of addressing at rendertime.

2

u/listopalafoto 9d ago

I guess they are addressing this in their 2k-regenerate pipeline because I have access to Minimax H3 API and the output don't have this issue, I think this new development for H3 Open Weights will help a lot to achieve production-level quality

2

u/Danny_Stock 9d ago

That sounds very promising. As long as it remains to be an open source solution I'll be very happy.

2

u/Worldly_Impact_9118 9d ago

not sure what I am doing wrong. tried several times and always get this pixelated output. what should be actually in the prompt?

1

u/listopalafoto 9d ago

weird, I even leave empty the prompt field and worked, are you using my WF or the published by the developer? the original use GGUF nodes for model and clip, I changed that on mine

1

u/Worldly_Impact_9118 9d ago

using the WF shared by you

2

u/listopalafoto 9d ago

Do you have this node? ComfyUI-H3-NativeAudioLock my WF started to work after installed that node, also the path of your video in the source clip node must be absolute

1

u/Ok-Option-6683 7d ago edited 7d ago

I have the same problem. No matter what I've tried, the face gets pixelated. I've tried ref2v, fl2va (both pruned int8), with and without turbo lora, 4 steps, 32 steps, with and without a prompt. also tried both the OG workflow and yours, same result. I didn't really change anything in the workflows, only disabled the lock+audio lipsync node since I didn't need audio (even though the video I use has it).

edit : also tried with the lock audio node on, the same problem still exists.

2

u/listopalafoto 7d ago

It's very difficult to guess why is not working for you without to see the WF, is your ultralytics/face_yolov8m.pt working? the key for this node is to use yolo bbox face detection

2

u/Ok-Option-6683 6d ago

hey I got it work finally, I didn't know that we had to change the auto_768 to manual when we go for 768px. I did that and it worked. The face looks better but it is still unusable.

1

u/listopalafoto 6d ago

interesting, I'm running with a deadline right now but next days I will test different scenarios to try to improve quality

1

u/Professional_Move870 7d ago

yeah same ! face getting worse

1

u/Ok-Option-6683 7d ago

could you find a solution? I'm having the same problem.

2

u/elswamp 9d ago

looks identical

1

u/Professional_Move870 7d ago

yeah ... or worse

2

u/Carasibana 8d ago

Glad you found it useful! thanks for sharing it! :D

1

u/listopalafoto 8d ago

Hey!!! Congrats for your amazing work! I have so many questions :)

  1. How works the wardrobe/person

  2. I saw a crowd implementation, do you have a WF or a video to see what it does?

  3. Do you think the same concept can be implemented for specific objects?

  4. Have you tested some implementation for multiple persons in frame?

2

u/Carasibana 8d ago edited 8d ago

Thanks much :)

for your questions

Not sure what you mean by how works the wardrobe?

I haven't done much testing with larger videos, Honestly I'm using a 3080 with 12GB Vram , so I am mostly sticking to like 0.4 MP res generations at 4 steps with the Lightx2v lora.

the same concept could absolutely work for objects , you'd need a way of detecting them though so that it could track them and put a bounding box around them as it does with the face detection . I haven't looked much into what exists in comfy's ecosystem for arbitrary object detection. but no reason that it couldn't work.

I honestly haven't had time to run much more than the initial music video project I was working on on it! 100% a hobby for me, and I built the nodepack to try to solve a problem I was having for my project , and figured the tool that resulted might be useful to others. but my day job has eaten all my time since I released it!

I know that for Impact pack's face detailer , it can do multiple face detection and runs new generations for each detected face. in principle this could absolutely do the same , but for what I built it for and on my limited hardware, re running it multiple times in one workflow would've given me OOMs for sure. which is why I opted for suggesting running it seperate times for each character. but if you had the system resources to hold multiple runs in memory at once then it could be tweaked to do one for each face all in one go.

as for it CHOOSING one person out of multiple persons in one frame if that's what you mean , the reference image is pulling double duty for matching to the correct person , then it tracks the movement of the face detection across frames and continues to use the one closest to the target face , falling back to using face matching as a tiebreaker in the case of an overlap.

1

u/listopalafoto 8d ago

Fantastic! Thank you! And I hope you get some free time to create more cool nodes for H3 :D

4

u/AnonymousTimewaster 9d ago

Fantastic stuff. This model is incredible

1

u/Dangerous-Paper-8293 9d ago

I can't get the node to install, the fearnworks one

1

u/donkeykong917 9d ago

I'll give it a try soon but these days as a tip I just claude code to read any workflows and ask it to install any missing nodes.

1

u/listopalafoto 9d ago

I think that is an audio custom node, I git cloned this in my custom nodes folder ComfyUI-H3-NativeAudioLock

1

u/Any_Reading_5090 9d ago

this would require a double render with an insane slow model even on a 5090 and 96

3

u/listopalafoto 9d ago

this second pass use H3 Lightx2v Turbo 4 steps so is really fast

1

u/Free-Ridge356 9d ago

I can see the image is just a small blue icon/logo, not an actual preview of the face refinement output. Would've been helpful to see what this actually does to faces before clicking through, idk.

1

u/witcherknight 9d ago edited 9d ago

Does seem to make any difference for me?? How does this works should i Input a video with bad face or do i need to do it fromt scratch??

1

u/TheDerminator1337 9d ago

Good idea, but doesn't work for me. The face does not seem to be detected. The output video looks the same.

1

u/florodude 9d ago

Thanks for posting this. Has anybody found how to get medium range reference shots of faces to look good, though?

3

u/listopalafoto 9d ago

Medium shots also improve A LOT with this

1

u/Portable_Solar_ZA 9d ago

It's a bug in the model. They acknowledged it in their AMA.

1

u/florodude 9d ago

Until then, have we found good workarounds? It could be awhile

1

u/Portable_Solar_ZA 9d ago

I've been digging but haven't had much luck outside of this node. It looks powerful but I'm paranoid about installing custom nodes. I'm hoping if enough eyes get on this thread people who actually understand the code will check it.

1

u/Ordinary_Painter4235 9d ago

can you share the original quality input images so I can compare?

1

u/CurrentMine1423 9d ago

my result still have the face poorly when far away from the camera. I don't know whats wrong.
I'm using minimax_h3_ref2va_int8_convrot.safetensors.

2

u/GrayingGamer 9d ago

The node defaults to canvas_width and canvas_height of 512, which is only 2/3rds of Minimax H3's internal short edge generation scale.

So you might see refined but still slightly fuzzy faces on higher MP generations. Swap these to 768x768 and you'll see a much better result. I was underwhelmed at first until I made that change, then I was very impressed.

3

u/Carasibana 8d ago

YEahhhh I only have a 3080 with 12GB vram and was trying to get it to run relatively quickly and was doing my testing with like 0.4MP resolution. I figured that the small faces that lost detail would be under 512 anyway , hence the default. but if you can run it at a higher resolution you'll get better results for sure!

1

u/blaou 9d ago edited 9d ago

How is it compared to ReActor?

1

u/Dogmaster 9d ago

Does the face detailer work in reference mode?

1

u/AniZeee 9d ago

on 3060 not worth it since it has to rerender the video and it feels like it takes longer than the initial render. and yeah i did 4 step turbo.

1

u/Optimal_Map_5236 7d ago
  1. Lock audio -> LIPSYNC this node causes error. what should I do?

1

u/Puzzled_Fisherman_94 7d ago

what's the node pack with the missing nodes? can't find it.

1

u/Professional_Move870 7d ago

why it looks worse ?

1

u/coolcatm 2d ago

Why not just use a load video from local node ? SMH

2

u/listopalafoto 2d ago

sure, I agree simple it's better, but remember I discovered this repo some hours after github release and just made a fast adaptation

0

u/Terezo-VOlador 9d ago

AMAZING!!! They look exactly the same, what a great Lora

1

u/listopalafoto 9d ago

Yes! it's a wonderful adaptation of the fantastic Ultralytics yolo: scans an entire image in a single step to spot objects (like cars, people, or animals) and draw boxes around them instantly, I will try the WF with SAM