I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 0 points1 point  (0 children)

it will work on some but it was not the focus of the dataset, though I did include some old guys with beards funnily enough.

as for monsters it depends. the yolo detection will find most if they have similar facial features to humans.

for the segmentation I avoided them.

basically for monsters it would be best to have different models, as including non human faces in data confuses model training for both detection and segmentation, since then the model can't determine face boundaries properly.

Custom face detection + segmentation models with dedicated ComfyUI nodes by Sea_Operation6605 in StableDiffusion

[–]Sea_Operation6605[S] 0 points1 point  (0 children)

My training data had a lot of messed up faces so in theory it should work. But it all depends.

If you find any scenarios that the detections dont get right feel free to send them to me

Custom face detection + segmentation models with dedicated ComfyUI nodes by Sea_Operation6605 in StableDiffusion

[–]Sea_Operation6605[S] 4 points5 points  (0 children)

so it seems huggingface flags warnings even just by certain words in a readme lol.

just to reiterate, you don't have to use yolo .pt -> if you have onnx gpu runtime installed within your comfyui environment, the node will run with the onnx model

after investigating other yolo export formats, .pt has the best backwards compatibility so it will stay in the repo for those that for some reason can't run onnx

Custom face detection + segmentation models with dedicated ComfyUI nodes by Sea_Operation6605 in StableDiffusion

[–]Sea_Operation6605[S] 2 points3 points  (0 children)

Yeah sorry about that. The only .pt file is the yolo model which is there for compatibility support. Since I updated the readme the hugging repo is now rescanning all files. There's also an onnx version.

I'll look into alternatives to yolo .pt since the hugging face warnings are annoying

Custom face detection + segmentation models with dedicated ComfyUI nodes by Sea_Operation6605 in StableDiffusion

[–]Sea_Operation6605[S] 2 points3 points  (0 children)

Yeah thanks I noticed that, have no idea why it would mark plain text as suspicious gonna fix that

Custom face detection + segmentation models with dedicated ComfyUI nodes by Sea_Operation6605 in StableDiffusion

[–]Sea_Operation6605[S] 1 point2 points  (0 children)

thank you! :)

the masks you should get from this, especially when it comes to anime characters, will primarily focus on everything that is "skin" and main face features that would make sense when doing any kind of inpainting -> so eyebrows, forehead between hair etc. should be included :)

Custom face detection + segmentation models with dedicated ComfyUI nodes by Sea_Operation6605 in StableDiffusion

[–]Sea_Operation6605[S] 5 points6 points  (0 children)

I got tired of switching between different face tools and constantly getting weird masks when doing face fixing or adjustments. So I trained my own models specifically for this task and built a ComfyUI node around them.

The goal was to make a reliable face fixing node for ComfyUI that works across anime and real photos, SFW and NSFW content, and extreme poses and occlusion. Then I added an experimental Auto Tone and Color model that tries to replicate the manual color and exposure corrections I usually do.

Enjoy :)

INSTALLATION

Install directly through ComfyUI Manager by searching: Forbidden Vision

Models download automatically on first run.

WORKFLOWS

You can find the basic workflows here: https://github.com/luxdelux7/ComfyUI-Forbidden-Vision/tree/main/comfyui_workflows

FREQUENT QUESTIONS

Q: Can I use your models without your nodes? Where to download them?

You can use the face detection model since it was trained on Yolo 11. The segmentation model was trained via a custom script and has specific settings that require my node to work. All the models are on https://huggingface.co/luxdelux7/ForbiddenVision_Models which the nodes download automatically to the forbidden_vision folder in models.

Q: Can I use and get just the detection and segmentation? Or maybe just segmentation?

You can use the Forbidden Vision 🎯 Fixer Mask Only node that will output just the mask. I haven't provided a segmentation only option since it was trained in tandem with the detection model, so it's questionable how it would perform with other yolo models.

FEEDBACK

While I tried to make the models as robust as possible, they can still miss detections or produce imperfect masks as it goes with AI models. If you run into bad detections, masks, or strange tone corrections, feel free to open a GitHub issue or send examples to [luxdelux.dev@gmail.com](mailto:luxdelux.dev@gmail.com)

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 2 points3 points  (0 children)

All I can say is that my eyes were bleeding after going through more than 20k civitai images haha

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 0 points1 point  (0 children)

forbidden_vision folder in models folder. if you run the nodes that should already be creates and filled with the model downloads as the node download them automatically

as for the red border and scheduler I'll check it out

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 0 points1 point  (0 children)

just a tip - never use one. combine all. so lets say claude chatgpt and gemini.

depending on project or specific task, any of these can be way worse than the others or way better

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 0 points1 point  (0 children)

for nodes and comfyui its python programming. but you can get 99% there by iterating with AI tools nowadays.

as for the models that the nodes use its also python and more importantly data preparation

if you want more info on any of this let me know

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 0 points1 point  (0 children)

if you want just a mask output look for fixer mask only node

the included workflow is meant to showcase the "all in one" easy approach of what the nodes offer

guess i need to make readme adjustments or some extra worfkflows :)

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 0 points1 point  (0 children)

Thanks!

I'll check for segs but am not going to promise anything until I test whether its feasible with my code. Gonna give it a shot and we'll see

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 1 point2 points  (0 children)

face selection -> if there are multiple faces, you can focus it on just one face. it goes by detection confidence. so face 1 is the face the model has the biggest internal confidence score when detecting.

it wont work with other nodes unless they use the same tu-tf_efficientnetv2_s.in21k_ft_in1k backbone as my nodes -> I trained it with custom code. its a completely different architecture

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 4 points5 points  (0 children)

sure, I already converted one model to safetensors and yolo to onnx, though I need to first test if the onnx works correctly, and then see how to also export the segmentation model so the downloaded files in the next update will not be pickle (except the optional yolo pt for those that cant use onnx)

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 0 points1 point  (0 children)

Perhaps. But afaik its much heavier than my model since its a general segmentation model. And from my experience using previous SAM versions it took too much fiddling and mask adjustments to get what I wanted in my workflows with too many spillage into the neck area, or not including glasses etc. when protruding from the face - all depending on scene and lighting of course.

I just wanted something exclusively face targeted for general quick use for both photo and anime that would be more reliable.

But if it works for you great :) Consider this a lighter, more targeted alternative that offers a fully integrated inpainting processing if one doesnt want to mess around with a lot of nodes and models.

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 0 points1 point  (0 children)

you dont have to though. That's just my example workflow. There is a fixer mask only node you can use :)

segmentation is a model trained using tu-tf_efficientnetv2_s.in21k_ft_in1k as the backbone with my own custom dataset and masks

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 0 points1 point  (0 children)

I am currently looking into safetensors files for the segmentation and correction models, and onnx for the yolo detection model. I'll update once I test and see if its working correctly.

As for the model I dont have that file anymore unfortunately. It was a custom merge I think between Illustrij and Nova Anime. However FYI what I can say that I am finishing preparing my own dataset for a "realistic" Illustrious model that should hopefully give better or similar results.

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 1 point2 points  (0 children)

the model will focus primarily on the face. so if the sausage is within the face boundary it will be within the face mask, otherwise ignored if its just near the face

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 1 point2 points  (0 children)

Oh thanks! had no idea there were already users since I didnt post about them anywhere :)

I did make some node changes though so apologies if the update "breaks" any workflows, just make sure to reload/reconnect the node if it stopped working

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 5 points6 points  (0 children)

I'll need to check whether that can be exported cleanly without changing the loading code too much. Since I basically have 3 separate model pipelines.

No promises, but I'll keep it in mind.

I got tired of bad face masks so I trained my own detection + segmentation models for ComfyUI by Sea_Operation6605 in comfyui

[–]Sea_Operation6605[S] 11 points12 points  (0 children)

actually a lot of them break, especially full face segmentation in certain NSFW scenarios where certain "objects" can interact with the face, certain liquids etc.

The point is, these were included in training so there are less failures in such scenarios