manupawar6388 commited on
Commit ·
307d91d
1
Parent(s): c363cd0
Add DCGAN model with Git LFS
Browse files- .gitattributes +1 -0
- README.md +82 -0
- dcgan_generator.keras +3 -0
- requirements.txt +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.keras filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,3 +1,85 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- gan
|
| 5 |
+
- dcgan
|
| 6 |
+
- image-generation
|
| 7 |
+
- chess
|
| 8 |
+
- generative-ai
|
| 9 |
+
datasets:
|
| 10 |
+
- niteshfre/chessman-image-dataset
|
| 11 |
+
metrics:
|
| 12 |
+
- fid
|
| 13 |
+
library_name: tensorflow
|
| 14 |
---
|
| 15 |
+
|
| 16 |
+
# Chessman DCGAN - Chess Piece Generator
|
| 17 |
+
|
| 18 |
+
This is a Deep Convolutional Generative Adversarial Network (DCGAN) trained to generate images of chess pieces.
|
| 19 |
+
|
| 20 |
+
## Model Description
|
| 21 |
+
|
| 22 |
+
- **Architecture**: DCGAN (Deep Convolutional GAN)
|
| 23 |
+
- **Framework**: TensorFlow/Keras
|
| 24 |
+
- **Input**: 100-dimensional random noise vector
|
| 25 |
+
- **Output**: 64x64 RGB images of chess pieces
|
| 26 |
+
- **Training Data**: 552 images from the Chessman Image Dataset (6 chess piece types)
|
| 27 |
+
|
| 28 |
+
## Training Details
|
| 29 |
+
|
| 30 |
+
- **Epochs**: 50
|
| 31 |
+
- **Batch Size**: 128
|
| 32 |
+
- **Optimizer**: Adam (lr=1e-4, beta_1=0.5)
|
| 33 |
+
- **Loss**: Binary Cross-Entropy with label smoothing
|
| 34 |
+
- **Data Augmentation**: Random flips, rotations, and zoom
|
| 35 |
+
|
| 36 |
+
## Model Architecture
|
| 37 |
+
|
| 38 |
+
### Generator
|
| 39 |
+
- Input: 100-dim latent vector
|
| 40 |
+
- Dense layer → 8×8×256
|
| 41 |
+
- Conv2DTranspose layers: 256→128→64→3
|
| 42 |
+
- Output: 64×64×3 RGB image
|
| 43 |
+
|
| 44 |
+
### Discriminator
|
| 45 |
+
- Input: 64×64×3 RGB image
|
| 46 |
+
- Conv2D layers: 64→128→256
|
| 47 |
+
- Output: Binary classification (real/fake)
|
| 48 |
+
|
| 49 |
+
## Usage
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
import tensorflow as tf
|
| 53 |
+
import numpy as np
|
| 54 |
+
import matplotlib.pyplot as plt
|
| 55 |
+
|
| 56 |
+
# Load the model
|
| 57 |
+
generator = tf.keras.models.load_model('dcgan_generator.keras')
|
| 58 |
+
|
| 59 |
+
# Generate random noise
|
| 60 |
+
noise = tf.random.normal([1, 100])
|
| 61 |
+
|
| 62 |
+
# Generate image
|
| 63 |
+
generated_image = generator(noise, training=False)
|
| 64 |
+
|
| 65 |
+
# Display
|
| 66 |
+
img = ((generated_image[0, :, :, :] * 127.5) + 127.5).numpy().astype("uint8")
|
| 67 |
+
plt.imshow(img)
|
| 68 |
+
plt.axis('off')
|
| 69 |
+
plt.show()
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
## Limitations
|
| 73 |
+
|
| 74 |
+
- Images are 64×64 resolution (relatively low)
|
| 75 |
+
- Model trained on only 552 images (small dataset)
|
| 76 |
+
- Generated pieces may not always be perfectly recognizable
|
| 77 |
+
- No control over which piece type is generated
|
| 78 |
+
|
| 79 |
+
## Citation
|
| 80 |
+
|
| 81 |
+
Dataset: [Chessman Image Dataset on Kaggle](https://www.kaggle.com/datasets/niteshfre/chessman-image-dataset)
|
| 82 |
+
|
| 83 |
+
## License
|
| 84 |
+
|
| 85 |
+
MIT License
|
dcgan_generator.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:23505b4648f0b240e18ca82fa65652bd1bf7b65185511b3911d8a7caf696c2b6
|
| 3 |
+
size 10977320
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
tensorflow>=2.10.0
|
| 2 |
+
numpy>=1.23.0
|
| 3 |
+
matplotlib>=3.5.0
|