# ZZ-Image-Caption
Image captioner CLI using BLIP and BLIP2 models
## Installation
### Requirements:
- Python 3.10 or higher
### Install using pip:
```bash
pip install zz-image-caption
```
### Install pytorch
You may need to install [pytorch](https://pytorch.org/) separately depending on your system to use **CUDA** (default to use **CPU** if not available).
## Usage
### Basic usage:
Print caption for an image to the console
```bash
caption image.jpg
```
### Advanced usage:
Rename images in a directory with their captions
```bash
caption images/ -o filename
```
Write metadata for images in a directory with their captions
```bash
caption images/ -o metadata
```
Print caption for an image to the console using the BLIP2 model
```bash
caption image.jpg --blip2
```
## Command Line Interface Options
The following table lists all the command-line arguments available with descriptions and additional details:
| Argument | Type | Choices | Default | Description |
| ------------------------- | ------- | ------------------------------ | ------- | ------------------------------------------ |
| `-v`, `--version` | flag | | | Display the version of the tool. |
| `input` | string | | | Path to the input image file or directory. |
| `-o`, `--output` | string | text, json, metadata, filename | | Specify the output type. |
| `-a`, `--append` | string | | | Append string to caption output. |
| `-t`, `--token` | integer | | 32 | Max token length for captioning. |
| `-b`, `--batch` | integer | | 1 | Batch size for captioning. |
| `-p`, `--prompt` | string | | | Prompt for captioning. |
| `--temp`, `--temperature` | float | | 1.0 | Temperature for captioning. |
| `--seed` | integer | | | Seed for reproducibility. |
| `--large` | flag | | | Use the large model for captioning. |
| `--cpu` | flag | | | Use CPU instead of GPU (not recommended). |
| `--blip2` | flag | | | Use Blip2 model for captioning. |
| `--verbose` | flag | | | Print verbose output. |
| `--debug` | flag | | | Print debug output. |
### Help:
```bash
caption --help
```
Raw data
{
"_id": null,
"home_page": "https://github.com/sean1832/zz-img-caption",
"name": "zz-img-caption",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Zeke Zhang",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/0b/be/35134e3ab65e8ac84f7580ea55ac4d01ddd52cbeab9b6f0083df8b68f6cf/zz-img-caption-0.0.3.tar.gz",
"platform": null,
"description": "# ZZ-Image-Caption\r\nImage captioner CLI using BLIP and BLIP2 models\r\n\r\n## Installation\r\n\r\n### Requirements:\r\n- Python 3.10 or higher\r\n\r\n### Install using pip:\r\n```bash\r\npip install zz-image-caption\r\n```\r\n### Install pytorch\r\nYou may need to install [pytorch](https://pytorch.org/) separately depending on your system to use **CUDA** (default to use **CPU** if not available).\r\n\r\n## Usage\r\n\r\n### Basic usage:\r\nPrint caption for an image to the console\r\n```bash\r\ncaption image.jpg\r\n```\r\n\r\n### Advanced usage:\r\nRename images in a directory with their captions\r\n```bash\r\ncaption images/ -o filename\r\n```\r\n\r\nWrite metadata for images in a directory with their captions\r\n```bash\r\ncaption images/ -o metadata\r\n```\r\n\r\nPrint caption for an image to the console using the BLIP2 model\r\n```bash\r\ncaption image.jpg --blip2\r\n```\r\n\r\n\r\n\r\n## Command Line Interface Options\r\n\r\nThe following table lists all the command-line arguments available with descriptions and additional details:\r\n\r\n| Argument | Type | Choices | Default | Description |\r\n| ------------------------- | ------- | ------------------------------ | ------- | ------------------------------------------ |\r\n| `-v`, `--version` | flag | | | Display the version of the tool. |\r\n| `input` | string | | | Path to the input image file or directory. |\r\n| `-o`, `--output` | string | text, json, metadata, filename | | Specify the output type. |\r\n| `-a`, `--append` | string | | | Append string to caption output. |\r\n| `-t`, `--token` | integer | | 32 | Max token length for captioning. |\r\n| `-b`, `--batch` | integer | | 1 | Batch size for captioning. |\r\n| `-p`, `--prompt` | string | | | Prompt for captioning. |\r\n| `--temp`, `--temperature` | float | | 1.0 | Temperature for captioning. |\r\n| `--seed` | integer | | | Seed for reproducibility. |\r\n| `--large` | flag | | | Use the large model for captioning. |\r\n| `--cpu` | flag | | | Use CPU instead of GPU (not recommended). |\r\n| `--blip2` | flag | | | Use Blip2 model for captioning. |\r\n| `--verbose` | flag | | | Print verbose output. |\r\n| `--debug` | flag | | | Print debug output. |\r\n\r\n\r\n### Help:\r\n```bash\r\ncaption --help\r\n```\r\n\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "CLI tool for image caption using BLIP & BLIP2",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/sean1832/zz-img-caption"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d91c90e16fde97d08210bbca53c6422bb9704bfe7884fbca76de52fba9adccea",
"md5": "33dd58bc42d0db5a137a856eac98c8a3",
"sha256": "04ea82f1019f69602491534d00397af2248bb6fd53beb5fa818903bc40ddeff5"
},
"downloads": -1,
"filename": "zz_img_caption-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "33dd58bc42d0db5a137a856eac98c8a3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 7506,
"upload_time": "2024-04-28T09:38:57",
"upload_time_iso_8601": "2024-04-28T09:38:57.062707Z",
"url": "https://files.pythonhosted.org/packages/d9/1c/90e16fde97d08210bbca53c6422bb9704bfe7884fbca76de52fba9adccea/zz_img_caption-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0bbe35134e3ab65e8ac84f7580ea55ac4d01ddd52cbeab9b6f0083df8b68f6cf",
"md5": "c2b1c5b49340a39e302fab8505424316",
"sha256": "1b624642758fa555feab16cd9ddda51e1474491c65fe3a25ed26e58d90a74afe"
},
"downloads": -1,
"filename": "zz-img-caption-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "c2b1c5b49340a39e302fab8505424316",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 7104,
"upload_time": "2024-04-28T09:38:59",
"upload_time_iso_8601": "2024-04-28T09:38:59.082583Z",
"url": "https://files.pythonhosted.org/packages/0b/be/35134e3ab65e8ac84f7580ea55ac4d01ddd52cbeab9b6f0083df8b68f6cf/zz-img-caption-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-28 09:38:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sean1832",
"github_project": "zz-img-caption",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "zz-img-caption"
}