Thoughts on option to store captions in file metadata in addition to/instead of paired file? Also image file hash in NTFS ADS option. #32
Replies: 2 comments
-
I really like the idea of having the captions embedded with the image file, it would be even better if Kohya could read them! I'm definitely interested. I've only really messed around with image metadata a couple times, so I don't know the potential problems that could come up. It may be smart to limit this feature to just several image filetypes (or just one!) to make things easier to manage (jpg, png), support for more could come later. I've looked over the code, and it may not be as big of an undertaking as I initially anticipated. Supporting and testing all the various tools and features will certainly take some more time. I understand the code is largely undocumented, so don't be shy if you need to pick my brain on why this-does-that, I'm all ears. Once you have a working proof of concept in the app, I can help add support for all the various functions if necessary. I’m not quite understanding why it’s necessary to store hash values with the image in an NTFS secondary data stream. Is this because adding captions to the metadata would change the image hash, and you want to preserve the original hash? If we're already modifying the metadata, why not store the hash in the metadata? Please use the v1.96_dev branch as the origin for your changes. I'd love to see what you come up with. |
Beta Was this translation helpful? Give feedback.
-
I'd suggested caching the hashes to speed up file deduplication, but after thinking about it a bit, it's probably not worth adding that complication for this. I do definitely recommend doing it for checkpoints and loras though if you ever need to access the file hashes even semi-frequently. Takes my 5950x like 10 seconds to hash a 7GB file. Have to use ADS for the hash thing because metadata is on the same stream as the rest of the file so can't store the hash there without then changing the hash. Writing to an alternate stream doesn't changethe default stream though :) As for the captions in metadata, I think it might be as simple as just sticking save_image_metadata everywhere the save_text_file function is called. But maybe not lol I haven't looked too closely at it yet. |
Beta Was this translation helpful? Give feedback.
-
Would be nice to have caption data directly attached to the image file. I currently do this for my generated works. (I would also want to look into patching kohya to check metadata for captions so I don't have to deal with managing paired files at all.)
Also, I currently store my lora/checkpoint hashes in alternate data streams. I really dislike managing paired files and while storing hashes in metadata is a no-go, ADS is very convenient for this as it doesn't affect the hash value of the primary data stream. Figured I'd suggest doing the same for image files. With how fast it is to hash images compared to full checkpoints, though, it might not even be worth it.
It'd be important that these changes be optional and backwards compatible with the current way of handling captions.
I'm happy to attempt working on this, I just wanted to ask your opinion before I start anything :)
Beta Was this translation helpful? Give feedback.
All reactions