From 776edcf9d93c74fe0db9490aeeb3275a1fcfb45a Mon Sep 17 00:00:00 2001 From: Victor Hall Date: Wed, 13 Mar 2024 18:31:52 -0400 Subject: [PATCH] update cog doc --- doc/CAPTION_COG.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/CAPTION_COG.md b/doc/CAPTION_COG.md index 0c17cde..cfc9480 100644 --- a/doc/CAPTION_COG.md +++ b/doc/CAPTION_COG.md @@ -87,7 +87,7 @@ Write a description. ``` This is very useful if you can organize your data into folders that are meaningful to the captioning task, either manually, or with a classifier. -* `title_and_tags_from_metadata_json` Adds the title and tags from a metadata.json file in the same folder as the image to the prompt. This is useful if you have a metadata.json file in each folder with the images. The metadata.json file should look like this: +* `title_and_tags_from_metadata_json` Adds the title and tags from a metadata.json file in the same folder as the image to the prompt. This is useful if you have a metadata.json file in each folder with the images that applies to all the images in that folder. The metadata.json file should look like this: ```json { "title": "A photograph of John Smith", @@ -96,10 +96,13 @@ This is very useful if you can organize your data into folders that are meaningf ``` And the prompt will be modified with the information pulled from the metadata.json file. The prompt will look like this after modification: ``` -Hint: title: A photograph of John Smith, tags: portrait, outdoors, smiling. +Hint: title: A photograph of John Smith, tags: portrait, outdoors, smiling Write a description. ``` +* `title_and_tags_from_image_json` Same as above but looks for a file ending in `.json` with the same basename and in the same directory as the image, enabling *per-image* metadata. + + ### Programming your own plugins. The plugins are all in `/plugins/caption_plugins.py` and are easy to modify or add to. The plugins are executed in the order they are provided on the command line. Inherit from the `PromptIdentityPlugin` class and spass a key for the arg and your function like `super().__init(key="my_cool_plugin",fn=your_fn)`. Should be obvious from there for anyone familiar with Python.