Skip to main content

CLI tool for image caption using BLIP & BLIP2

Project description

ZZ-Image-Caption

Image captioner CLI using BLIP and BLIP2 models

Installation

Requirements:

  • Python 3.10 or higher

Install using pip:

pip install zz-image-caption

Install pytorch

You may need to install pytorch 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

caption image.jpg

Advanced usage:

Rename images in a directory with their captions

caption images/ -o filename

Write metadata for images in a directory with their captions

caption images/ -o metadata

Print caption for an image to the console using the BLIP2 model

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:

caption --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zz-img-caption-0.0.2.tar.gz (7.1 kB view hashes)

Uploaded Source

Built Distribution

zz_img_caption-0.0.2-py3-none-any.whl (7.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page