Folder Scores
Rank whole folders instead of single images
- results
- folderstats
- filterstring
Folder Scores is the zoom-out node: it takes the per-image scores from a search and rolls them up to the folder level, answering "which folder in my collection is my query most like?" Instead of "these 500 images are similar," you get "these 5 folders are similar, and here's how each one scored." For anyone organizing a large reference library by subject, this is the report card at the end of a search.
It works on the folder structure of your database's stored paths. Every result contributes a weighted score to each ancestor folder it lives under (down to a configurable depth), each folder gets a representative score computed as the most common score bin in its distribution, and the folders are sorted like any other result set.
The inputs that matter
- results - a
SRESULTSoutput from Image Searcher. - folder_count - how many folders to report. Default 1.
- offset_index - where to start in the ranked folder list, so you can page through "top 5, next 5…" by bumping it.
- match -
firstranks highest-scoring folders first,lastreverses it. - weighted_threshold - a similarity floor (default -1 = off) used in the per-image weighting,
(1 + score − threshold) * score. Raise it to penalize low-similarity images more harshly inside a folder's score. - min_folder_level / max_folder_level - the folder-depth window to include.
min 0includes the top level; raisemin_folder_levelto ignore shallow folders and only score deeper subfolders.
The outputs
Two strings, and the second one is the sneaky good part:
- folderstats - formatted text listing each folder and its representative score, ready for a text/console display node.
- filterstring - a list of
foldername*wildcard patterns for exactly those folders. Paste it into EditResults or EditDB with method "filter" and your search results collapse down to just the top folders. That's the natural end of this node: rank folders, then filter to the winners.
Installing it
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/MoonMoon82/ClipVision_Tools
cd ClipVision_Tools
python -m pip install -r requirements.txt
Or ComfyUI Manager → "ClipVision_Tools" → restart. Deps: orjson, pillow-heif.
Gotchas
- It's as good as your folder structure. If your collection is one flat dump, every image lands in the same folder and the report is one line. Folder Scores is built for organized trees.
- The representative score is a mode, not an average (the code bins scores into 512 buckets and takes the most common one). That's deliberate - it resists a couple of outliers - but it means the number can differ from your intuition about "average similarity."
- folderstats and filterstring must be displayed or consumed by something - they're plain strings and the node won't show them itself.
- Output is text, not a graph: to act on the ranking you go through EditResults, which is a manual step but a clean one.
If your mental model of the collection is "folders of concepts," this node is the fastest way to find the right folder for a given query. It's the quiet workhorse of the pack and it's far more useful than its zero-impressions listing suggests.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| results | SRESULTS | — | |
| offset_index | INT | 00–18446744073709550000 | first result to show |
| folder_count | INT | 11–18446744073709550000 | Maximum amount of folders to show |
| match | COMBO | first | Sort order of folders to show |
| weighted_threshold | FLOAT | -1.000-1–1 | Similarity threshold for weighted scoring each image |
| min_folder_level | INT | 00–18446744073709550000 | minimum folder depth to include in scoring |
| max_folder_level | INT | 1000–18446744073709550000 | maximum folder depth to include in scoring |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| folderstats | STRING | — |
| filterstring | STRING | — |