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
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
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
from GANexLib import expand_dataset
# Generate new images
expand_dataset(
absolute_path="/path/to/your/images",
image_amount=100
)
Advanced Usage
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
- Data Loading: Loads all valid images from the specified directory
- Preprocessing: Resizes images to 64x64 and normalizes pixel values
- Training: Trains a DCGAN model on your dataset
- Generation: Creates new synthetic images that match your data distribution
- Saving: Saves generated images as
generated_img_0.png,generated_img_1.png, etc.
Example
# 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
- Dataset Size: Use at least 1000 images for better quality results
- Image Consistency: Training works best with similar-styled images
- Training Time: More epochs generally produce better results (try 30-50)
- 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.
Release files for GANexLib 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ganexlib-0.1.0.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ganexlib-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.0 kB
Release files / ganexlib-0.1.0.tar.gz
| Download URL | ganexlib-0.1.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8d042244521165c459871975f350af4026dc603834c2612b62dd33f45d8c67f
|
|
BLAKE2b-256 checksum How to use checksums |
224609b60f6f693f7904f0004fabf6a6c65151466923c097111b18855504e4f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ganexlib-0.1.0-py3-none-any.whl
| Download URL | ganexlib-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c2a52e869ed0134b75426237a8d2bd0d14d4db472152cb90cc2a39bf0086c1d
|
|
BLAKE2b-256 checksum How to use checksums |
01459e615d9867d5592b54161262d3b98768ab2b809f7cec3ad1c5bec721c115
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|