Metadata-Version: 2.1
Name: image_diversity
Version: 0.1.5
Summary: A package for computing entropy-based diversity measures on image sets
Author-email: Francisco Ibarrola <francisco.ibarrola@outlook.com>
Project-URL: Homepage, https://github.com/fibarrola/image_diversity
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch>=1.7.1
Requires-Dist: torchvision
Requires-Dist: ftfy
Requires-Dist: regex
Requires-Dist: tqdm
Requires-Dist: scipy

# MEASURING DIVERSITY OF IMAGE SETS

Assess a set of image's diversity by computing an approximation of the Entropy of the images' mappings into a pre-trained network latents.

<br>

## Installation

Install from [test.pypi](https://test.pypi.org/project/image-diversity/):

```
pip install -i https://test.pypi.org/simple/ image-diversity
```

<br>

## Usage (console)

To compute the Truncated CLIP Entropy (TCE) of a set of images in a directory, run
```
python3 -m image_diversity <path/to/dir>
```

<br>

To compute the Truncated Inception Entropy (TIE), change the div_type option to TIE 
```
python3 -m image_diversity <path/to/dir> --div_type TIE
```

### Arguments

```
python3 -m image_diversity <path/to/dir>
--div_type <str>        Encoding network: TCE (default) or TIE
--n_eigs <int>          Number of eigenvalues for truncation (default: 20)
--device <str>          Device to use. Automatic by default
--batch_size <int>      Batch size for data loading (default: 16)
```
<br>

## Usage (script)

Computing Truncated CLIP Entropy (TCE)
```
from image_diversity import ClipMetrics

clip_metrics = ClipMetrics()
tce = clip_metrics.tce("path/to/img/dir")
```
<br>

Computing Truncated Inception Entropy (TIE)
```
from image_diversity import InceptionMetrics

inception_metrics = InceptionMetrics()
tie = inception_metrics.tie("path/to/img/dir")
```
<br>
