Metadata-Version: 2.4
Name: GANexLib
Version: 0.1.0
Summary: A library for expanding image datasets using DCGAN
Author: acetim
Keywords: gan,dcgan,image-generation,dataset-expansion,deep-learning,tensorflow
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: numpy>=1.19.0
Requires-Dist: tensorflow>=2.8.0
Requires-Dist: Pillow>=8.0.0
Requires-Dist: tqdm>=4.60.0
Requires-Dist: joblib>=1.0.0

# GANexLib

A Python library for expanding image datasets using Deep Convolutional Generative Adversarial Networks (DCGAN).

## Overview

GANexLib provides an easy-to-use interface for generating synthetic images to augment your existing image datasets. 
## Installation

```bash
pip install GANexLib
```

## Requirements

- Python >= 3.8
- TensorFlow >= 2.8.0
- NumPy >= 1.19.0
- Pillow >= 8.0.0
- tqdm >= 4.60.0
- joblib >= 1.0.0

## Quick Start

```python
from GANexLib import expand_dataset

# Generate 100 new images based on images in the specified directory
expand_dataset("/path/to/your/images", 100)
```

## Usage

### Basic Usage

```python
from GANexLib import expand_dataset

# Generate new images
expand_dataset(
    absolute_path="/path/to/your/images",
    image_amount=100
)
```

### Advanced Usage

```python
from GANexLib import expand_dataset

# Custom training parameters
expand_dataset(
    absolute_path="/path/to/your/images",
    image_amount=100,
    epochs=30,              # Number of training epochs (default: 20)
    batch_size=64,          # Batch size for training (default: 32)
    callback=lambda msg: print(f"Training complete: {msg}")
)
```

### Parameters

- **absolute_path** (str, required): Absolute path to directory containing your training images
- **image_amount** (int, required): Number of new images to generate
- **callback** (callable, optional): Function to call when training completes
- **epochs** (int, optional): Number of training epochs (default: 20)
- **batch_size** (int, optional): Batch size for training (default: 32)

### Supported Image Formats

- JPEG (.jpg, .jpeg)
- PNG (.png)
- BMP (.bmp)
- WebP (.webp)

## How It Works

1. **Data Loading**: Loads all valid images from the specified directory
2. **Preprocessing**: Resizes images to 64x64 and normalizes pixel values
3. **Training**: Trains a DCGAN model on your dataset
4. **Generation**: Creates new synthetic images that match your data distribution
5. **Saving**: Saves generated images as `generated_img_0.png`, `generated_img_1.png`, etc.


## Example

```python
# Example: Expand a dataset of cat images
from GANexLib import expand_dataset

def training_complete(message):
    print(f"✓ {message}")
    print("Check your image folder for new generated images!")

expand_dataset(
    absolute_path="/datasets/cats",
    image_amount=200,
    epochs=25,
    callback=training_complete
)
```

## Tips for Best Results

1. **Dataset Size**: Use at least 1000 images for better quality results
2. **Image Consistency**: Training works best with similar-styled images
3. **Training Time**: More epochs generally produce better results (try 30-50)
4. **GPU**: Training is much faster with GPU support (CUDA-enabled TensorFlow)

## Limitations

- Generated images are fixed at 64x64 resolution
- Requires TensorFlow installation (can be large)
- Training time depends on dataset size and hardware


## Citation

If you use GANexLib in your research, please cite the original DCGAN paper:

```
Radford, A., Metz, L., & Chintala, S. (2015). 
Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks. 
arXiv preprint arXiv:1511.06434.
```

## Acknowledgments

This library implements the DCGAN architecture as described in the 2014 paper by Radford et al.

