A library for expanding image datasets using DCGAN
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ganexlib-0.1.0.tar.gz.
File metadata
- Download URL: ganexlib-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8d042244521165c459871975f350af4026dc603834c2612b62dd33f45d8c67f
|
|
| MD5 |
6519ee90ecf334556567c187b8034af4
|
|
| BLAKE2b-256 |
224609b60f6f693f7904f0004fabf6a6c65151466923c097111b18855504e4f5
|
File details
Details for the file ganexlib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ganexlib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c2a52e869ed0134b75426237a8d2bd0d14d4db472152cb90cc2a39bf0086c1d
|
|
| MD5 |
86410d27b4a8e0cbba128b97b5b8ba20
|
|
| BLAKE2b-256 |
01459e615d9867d5592b54161262d3b98768ab2b809f7cec3ad1c5bec721c115
|