You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Added
* Calculate CLIP token count for the current caption
* Add custom CSS by pressing `Alt + C`
### Changed
* Correct tag filtering with only excluding tags
* Fixed removal and detection of tags (do not include seperator in tag name, instead operate on tag list)
* Bumped package versions (both NodeJS and Rust)
Copy file name to clipboardExpand all lines: README.md
+77-3Lines changed: 77 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,16 @@
1
1
# image-set-tag-editor
2
2
3
-
This is a UI application which allows you to quickly edit a caption file for a image. You can open a folder, get a preview of the image and then can quickly skip through the images and edit the captions for each image.
3
+
This is a UI application which allows you to quickly edit a caption file for an image. You can open a folder, get a preview of the image and then can quickly skip through the images and edit the captions for each image.
4
4
Caption files can have any extension, but must have the same name as the image file.
5
5
If you have a folder with different types of captions (`.txt` and `.caption` for example), the extension which occurs most often will be chosen when saving the changes.
This application was mainly made to edit captions for images which are used in training Stable Diffusion fine-tunes.
10
11
If you need cropping, I suggest my other application [SpeedCrop](https://github.com/NetroScript/SpeedCrop).
11
12
Also it is not possible to bulk edit captions with this application. This is mostly for a final manual review step to check individual captions together with the image in a preview, and change them if necessary.
13
+
There is a rough estimate of token count being shown using CLIP, however as each diffusion model has its own tokenizer, this is not 100% accurate. It is just a rough estimate to see if the caption is too long or too short. ([Tokenizer used](https://github.com/instant-labs/instant-clip-tokenizer))
12
14
13
15
14
16
-[image-set-tag-editor](#image-set-tag-editor)
@@ -20,6 +22,9 @@ Also it is not possible to bulk edit captions with this application. This is mos
@@ -63,13 +68,82 @@ There are several ways you can move between images:
63
68
1. To edit an image caption, click on the caption field below the displayed image to bring it into focus.
64
69
2. Once selected, you can type in or modify the existing caption as needed.
65
70
71
+
On the left side there will be an overview with all tags in the current image data set. By checking or removing the checkmark, the corresponding tags will either be added or removed from the current image. Tags are prepended, however it does not matter where they are for removal.
72
+
73
+
The count of each tag only updates when you change to another image.
74
+
66
75
### 4. Saving Captions
67
76
68
77
To save your edited captions, click on the **Save** button located in the bottom left corner of the application. This will overwrite (or create) all captions with the current data. Ensure you've made all necessary changes before saving.
69
78
70
79
You can also see a video of the application in action here:
The left side with tags allows quickly adding and removing tags from the currently open image.
88
+
However, only the 50 most frequent tags are shown there. For this reason, it is to show a subset of tags, by using certain filtering options.
89
+
90
+
Writing any text will filter the tags using just a simple string search (case sensitive).
91
+
Entering `red` for example will only show all tags which contain the string `red` in them.
92
+
Should you want multiple tags, you can separate them with `|` (pipe).
93
+
So if you want to see for example all tags which contain tree, grass, building or sky, you can enter `tree|grass|building|sky`.
94
+
95
+
It is also possible to exclude tags from the results by prepending a `-` (minus) to the tag.
96
+
If you want to see all tags which contain tree, grass building or sky, but no tags which contain car, you can enter `tree|grass|building|sky|-car`.
97
+
98
+
The *"dataset"* I use for the screenshots for example is just the generated descriptions from Stable Diffusion images. So to not show any generation settings in the text, I can filter using the following string:
If you need even more complex filtering, it is possible to use regex. To do so, you can either prepend `^` (caret) to the search string, or append `$` (dollar sign) to it. This will then be parsed as regex instead of a simple string search.
103
+
104
+
So to exclude all tags which start with a `(` for example, you can enter `-^\(`. To take this apart:
105
+
106
+
*`-` will exclude the results
107
+
*`^` will tell the application to parse the search string as regex
108
+
*`\(` will match a literal `(`
109
+
110
+
111
+
### Custom CSS
112
+
113
+
It is possible to insert custom CSS into the application. This can be done by pressing `Alt + C`. This will open a dialog where you can enter your custom CSS. This CSS will be applied to the whole application, so you can change the background color for example. However the most useful use is to highlight certain tags which are used, this works, as each tag on the left side has a `data-tag` attribute, which contains the tag itself. So you can use this to highlight certain tags.
114
+
115
+
An example CSS would be the following:
116
+
117
+
```css
118
+
/* If the tag contains the keyword red, the tag font color will be red */
119
+
.tag-display[data-tag*='red'] {
120
+
color: rgb(255, 50, 5);
121
+
}
122
+
123
+
/* Every tag which has a ( has a light white background. */
124
+
.tag-display[data-tag*='('] {
125
+
background: rgba(255, 255, 255, 0.1);
126
+
}
127
+
128
+
/* Every tag starting with ( has a strong white background. */
0 commit comments