kohya-ss / kohya-ss/sd-scripts

New format for dataset metadata

Open
#1,752 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

## Format
The file is in JSON format.

```
{
"format_version": "1.0",
"latent_cache_dir": "/path/to/latent_cache_dir", // optional, for all images in this .json
"images": {
"/full/path/to/image.png": { // image file
"caption": ["caption1 for the image", "another caption for the image", ... ],
"tags": ["tag1, tag2, tag3", "another tag1, ...", ...],
"caption_weights": [0.5, 0.1, ...], // optional, the sum does not have to be 1
"tags_weights": [0.2,1.5, ...]
"image_size": [1024, 768],
"latent_cache_dir": "/path/to/latent_cache_dir" // optional, for this image
},
"/full/path/to/archive.tar////inner/path/of/image.png": { // image in archive file
"caption": ["caption for the image"],
"tags": ["tag1, tag2, tag3"],
"image_size": [1024, 768],
"latent_cache_dir": "/path/to/latent_cache_dir" // optional, for this image
},
...
}
}
```

- Contains image files and image files in archives.
- When specifying a file within an archive, the archive filename and the innter path in the archive are separated by `////`. A key containing `////` indicates a file within an archive.
- `latent_cache_dir` is optional. If omitted, the image file directory will be used.
- `latent_cache_dir` cannot be omitted if an archive file is specified.
- Either `caption` or `tags` can be omitted.
- Multiple captions and tags can be specified in a list.
- Each image may have both `caption` and `tags`, but how they are handled depends on the specifications of the training script. Currently they are simply concatenated.

Initially, `.tar` is the only archive type expected, but support may expand in the future. EDIT: `.zip` is also supported.

Please feel free to share your thoughts and suggestions on this specification.

EDIT: Add `caption_weights` and `tags_weights` for the probabilities.

Contributor guide

No contributing guide indexed for this repository

Research direction

This issue proposes a JSON format for image and archive dataset metadata, including captions, tags, weights, image sizes, and latent-cache directories. It names no implementation files, tests, or entry points, so first locate the dataset metadata parsing and training entry points. Done would require an agreed specification and corresponding support for the format.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.