LayerMask: Object Detector Gemini V2(Advance)
The same Gemini object detector, ported to Google's newer SDK
- image
- bboxes
- preview
Functionally, this is the same node as ObjectDetectorGemini - text prompt in, bounding boxes out, via Gemini's vision API, no local model weights required. What changed under the hood is the dependency: V2 moved off the older google-generativeai package onto Google's newer google-genai SDK, specifically so it could support Gemini models the original node's dependency didn't know about yet. If you don't care which SDK is doing the talking, the practical difference that matters is just which models show up in the dropdown.
The inputs and outputs that matter
image/prompt(default"subject") - identical to the original node.model- two choices here instead of four:gemini-2.5-pro-exp-03-25andgemini-1.5-pro. Notably narrower than V1's list, but it's the one that actually has the newer 2.5-generation model available.
Outputs, same as V1: bboxes (BBOXES) and preview (IMAGE) for a visual sanity check before you trust the detection downstream.
Which one should you actually use
If you're starting fresh, use V2 - it's the one with access to Gemini's newer model generation, and there's no real downside to the different SDK from a usage standpoint. The only reason to specifically want V1 (the plain ObjectDetectorGemini) is if you're reproducing a workflow that was built and shared using it, or you specifically want one of the Flash variants for speed/cost that V1 offers and V2 doesn't currently list.
Installing it
ComfyUI Manager: search "ComfyUI Layer Style Advance" - this installs the whole pack, both V1 and V2 detectors included. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle_Advance.git
Run install_requirements.bat (portable) or install requirements.txt yourself - this pulls in google-genai alongside whatever the older Gemini nodes need - then restart.
Same API key setup as every Gemini node in this pack: get a free key from Google AI Studio, rename the plugin's api_key.ini.example to api_key.ini, and fill in google_api_key=. One key, shared across V1 and V2 both.
Common issues
Works in V1 but errors in V2 (or vice versa). Since they run on different Google SDKs (google-generativeai vs google-genai), it's possible for one to have a version conflict in your environment while the other works fine - if you hit an import or dependency error specific to one of these two nodes, check which SDK it depends on and whether that package installed cleanly.
api_key.ini missing. Same root cause as every other Gemini-backed node here - check the file exists with your key filled in, not just the .example template.
Wanted a Flash-tier model for speed, only see pro-tier options. V2's list is gemini-2.5-pro-exp-03-25 and gemini-1.5-pro - no Flash variant currently listed. If speed/cost matters more than the newer model generation, drop back to V1's gemini-1.5-flash or gemini-1.5-flash-8b.
Detection quality differs noticeably between V1 and V2 on the same image. Expected - you're calling genuinely different model generations (1.5-series vs the newer 2.5 experimental model), not just a code refactor. Compare on your actual use case rather than assuming "V2" automatically means "better result" for every prompt.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model | COMBO | 2 options: gemini-2.5-pro-exp-03-25, gemini-1.5-pro | |
| prompt | STRING | subject | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| bboxes | BBOXES | — |
| preview | IMAGE | — |