Janus Pro Caption Images Under Directory ๐
Batch-caption a folder for LoRA training
- model
- log
This is the workhorse of the pack. Point it at a folder of images and it writes a caption for every one - saving each as a .txt file sitting right next to its image. That image.png + image.txt pairing is exactly the layout LoRA trainers (kohya, ai-toolkit, OneTrainer) expect, which tells you what this node is really for: preparing a training dataset without captioning a hundred images by hand.
Why this exists
Captioning is one of the highest-leverage steps in LoRA training, and doing it manually for a big set is soul-crushing. This node automates the boring part with Janus Pro's image-understanding model. For the LLM-encoder base models people train on today - Flux, Qwen-Image, Z-Image - the right caption style is natural language, and that's exactly what Janus produces. (If you're training an anime base in the Illustrious/Pony/NoobAI line, that world wants Danbooru-style comma tags from a WD14 tagger instead - Janus prose isn't the tool there.)
One rule from the training world worth burning in before you batch anything: describe what you want to stay adjustable, leave what should be permanent undescribed. For a character LoRA, caption the pose, expression and clothing (so the model treats them as variable) but don't caption the features that define the character. An auto-captioner describes everything it sees, so expect to skim the generated .txt files and prune - the machine gives you a strong first draft, not a finished dataset.
The inputs that matter
model- fromJanus Pro Model Loader.directory- the folder of images to caption. The default is a placeholder (X://path/to/files); replace it with a real path or nothing happens.question(multiline, default "Describe this image in detail.") - the same steering wheel as the single-image node, applied to every file. Tailor it to your subject: for a style LoRA you might ask it to describe composition and palette; for a character you might ask it to focus on pose and outfit.save_to_new_directory(off) andsave_directory(optional) - by default captions are written alongside the source images. Flipsave_to_new_directoryon and setsave_directoryto send the.txtfiles somewhere else instead, handy if you want to keep your originals untouched.
temperature (0.1), top_p (0.95), max_new_tokens (512), seed and keep_model_loaded behave just like the single-image node - low temperature for faithful, consistent captions across the set.
The output is log (a STRING) - a run report of what got captioned, not the captions themselves. The captions land in the .txt files. You can wire log into a ShowText node if you want to watch progress.
How to install it
Part of ComfyUI-CaptionThis:
- ComfyUI Manager (recommended): search CaptionThis, Install, restart.
- Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/MieMieeeee/ComfyUI-CaptionThis, then restart.
Janus weights pull from HuggingFace on first run (or set HF_ENDPOINT=https://hf-mirror.com for the mirror). Details on the Janus Pro Model Loader page.
Common issues & troubleshooting
It captions nothing / errors on the path. You left the X://path/to/files placeholder in, or the path is wrong. Give it a real directory of images.
Every caption over-describes the subject. That's the auto-captioner doing its job, and it's why you review the output. Prune the lines describing features you want the LoRA to bake in as fixed.
It's slow on a big folder. It's running a vision model per image - that's inherently not instant. Keep keep_model_loaded on so it isn't reloading between files, and use Janus-Pro-1B in the loader if 7B is too heavy for your card.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MIE_JANUS_MODEL | โ | |
| directory | STRING | X://path/to/files | โ |
| question | STRING | Describe this image in detail. | โ |
| seed | INT | 420โ18446744073709550000 | โ |
| temperature | FLOAT | 0.100โ1 | โ |
| top_p | FLOAT | 0.950โ1 | โ |
| max_new_tokens | INT | 5121โ2048 | โ |
| keep_model_loaded | BOOLEAN | true | โ |
| save_to_new_directory | BOOLEAN | false | โ |
| save_directoryopt | STRING | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| log | STRING | โ |