CXH_IC_Lora_Florence2Run
Captioning image pairs for IC-LoRA clothing datasets
- florence2_model
- caption
CXH_IC_Lora_Florence2Run exists for one very specific job: building training captions for IC-LoRA datasets - the image-conditioned LoRA setup popular in the Chinese community for clothing, where every training sample is a pair: the product/garment photo and a photo of it being worn. Both images are concatenated into one frame, Florence 2 captions the pair, and the node writes out a caption that references both halves.
This is the "IC" workflow the pack's README workflow images are built around, and the default template shows the intent plainly: Realistic style, [cloth-on], the image pair highlights a transformation from a clothing sample photo to the effect of actually wearing it. [image1] {caption} [image2] a female model is wearing the cloth from [image1] with {caption}.
How it works
For each image in dir1, it looks up the same-named file in dir2 (paired by filename - both folders need matching names), stitches the two images into a single frame in the direction you pick (right/down/left/up), and runs Florence 2 to caption the composite. Then it does string surgery on template:
{caption}→ the model's caption{text1}/{text2}→ whatever you typed in those two multiline boxes
The result is written as a .txt next to a saved copy of the pair in saveDir. match_image_size (default on) resizes the second image to match the first before stitching, so pairs stay aligned.
Inputs and outputs
florence2_model- fromCXH_DownloadAndLoadFlorence2Model.tip_pipe- a string input that the source only prints. It's effectively a leftover; leave it empty.dir1,dir2,saveDir- source folders and output folder.format(png/jpg),max_new_tokens(default 512),text1,text2,template,direction,match_image_size.- Output:
caption(STRING) - the last generated caption. The real per-image results are the.txtfiles on disk.
Installing
Standard pack install - ComfyUI Manager (search "Comfyui_CXH_joy_caption") or:
cd ComfyUI/custom_nodes
git clone https://github.com/StartHua/Comfyui_CXH_joy_caption
cd Comfyui_CXH_joy_caption
python -m pip install -r requirements.txt
Then load a Florence 2 model (the loader node) - the model download happens there.
Gotchas
- Filenames must match across
dir1anddir2. No fuzzy matching; a missing pair just gets skipped with a print you might miss. - Empty
dir1raises an error (FileNotFoundErroron the folder or "No files in directory"). match_image_sizeoff means the stitch can look ragged, which degrades the caption. Keep it on unless you're deliberately captioning mixed-size pairs.- The
captionoutput is only the last one - if you need per-image captions, read the.txtfiles out ofsaveDir. - For a JoyCaption-based version of the same job, use
CXH_Ic_lora_Joy_batch; it's the same idea with the stronger caption model and no Florence-2 loader needed.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| tip_pipe | STRING | — | |
| florence2_model | FL2MODEL | — | |
| format | COMBO | 2 options: png, jpg | |
| max_new_tokens | INT | 51210–4096 | — |
| dir1 | STRING | — | |
| dir2 | STRING | — | |
| saveDir | STRING | — | |
| text1 | STRING | — | |
| text2 | STRING | — | |
| template | STRING | Realistic style, [cloth-on], the image pair highlights a transformation from a clothing sample photo to the effect of actually wearing it. [image1] {caption} [image2] a female model is wearing the cloth from [image1] with {caption} | — |
| direction | COMBO | right | 4 options: right, down, left, up |
| match_image_size | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| caption | STRING | — |