Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,122 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- image-colorization
|
| 5 |
+
- pokemon
|
| 6 |
+
- unet
|
| 7 |
+
- pytorch
|
| 8 |
+
- computer-vision
|
| 9 |
+
- tcg
|
| 10 |
+
datasets:
|
| 11 |
+
- ellimaaac/pokemon-tcg-all-image-cards
|
| 12 |
+
language:
|
| 13 |
+
- en
|
| 14 |
+
pipeline_tag: image-to-image
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# 🎨 PokeColor — Pokémon Card Colorizer
|
| 18 |
+
|
| 19 |
+
**PokeColor** is a deep learning model that automatically colorizes grayscale Pokémon Trading Card Game (TCG) images. It is based on a **U-Net** architecture and trained on a large collection of official Pokémon TCG card images.
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
## 🖼️ Demo
|
| 24 |
+
|
| 25 |
+
grayscale -> generated -> original
|
| 26 |
+
|
| 27 |
+
|||
|
| 28 |
+
|---|---|
|
| 29 |
+
|  |  |
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## 🧠 Model Architecture
|
| 34 |
+
|
| 35 |
+
- **Architecture**: U-Net (encoder–decoder with skip connections)
|
| 36 |
+
- **Framework**: PyTorch
|
| 37 |
+
- **Task**: Image-to-image translation (grayscale → color)
|
| 38 |
+
- **Input**: Grayscale Pokémon TCG card image
|
| 39 |
+
- **Output**: Colorized RGB image
|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
## 📦 Dataset
|
| 44 |
+
|
| 45 |
+
The model was trained on the [**Pokemon TCG — All Image Cards**](https://www.kaggle.com/datasets/ellimaaac/pokemon-tcg-all-image-cards) dataset from Kaggle, which contains thousands of official Pokémon card images spanning multiple generations and sets.
|
| 46 |
+
|
| 47 |
+
---
|
| 48 |
+
|
| 49 |
+
## 🚀 Usage
|
| 50 |
+
|
| 51 |
+
### Load the model
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
import torch
|
| 55 |
+
import torch.nn as nn
|
| 56 |
+
from torchvision import transforms
|
| 57 |
+
from PIL import Image
|
| 58 |
+
|
| 59 |
+
# Define your U-Net architecture (must match training)
|
| 60 |
+
# model = UNet(...)
|
| 61 |
+
|
| 62 |
+
# Load weights
|
| 63 |
+
model.load_state_dict(torch.load("pokemon_unet_colorizer.pth", map_location="cpu"))
|
| 64 |
+
model.eval()
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
### Run inference
|
| 68 |
+
|
| 69 |
+
```python
|
| 70 |
+
from PIL import Image
|
| 71 |
+
import torchvision.transforms.functional as TF
|
| 72 |
+
|
| 73 |
+
# Load and preprocess a grayscale image
|
| 74 |
+
img = Image.open("your_card.png").convert("L") # Grayscale
|
| 75 |
+
img_tensor = TF.to_tensor(img).unsqueeze(0) # Shape: [1, 1, H, W]
|
| 76 |
+
|
| 77 |
+
# Predict
|
| 78 |
+
with torch.no_grad():
|
| 79 |
+
output = model(img_tensor) # Shape: [1, 3, H, W]
|
| 80 |
+
|
| 81 |
+
# Save result
|
| 82 |
+
result = TF.to_pil_image(output.squeeze(0).clamp(0, 1))
|
| 83 |
+
result.save("colorized_card.png")
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
> ⚠️ Make sure the U-Net architecture used for inference matches the one used during training (number of layers, channels, etc.).
|
| 87 |
+
|
| 88 |
+
---
|
| 89 |
+
|
| 90 |
+
## 📁 Files
|
| 91 |
+
|
| 92 |
+
| File | Description |
|
| 93 |
+
|---|---|
|
| 94 |
+
| `pokemon_unet_colorizer.pth` | PyTorch model weights (373 MB) |
|
| 95 |
+
| `demo-1.png` | Example input / output image 1 |
|
| 96 |
+
| `demo-2.png` | Example input / output image 2 |
|
| 97 |
+
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
## ⚙️ Training Details
|
| 101 |
+
|
| 102 |
+
| Parameter | Value |
|
| 103 |
+
|---|---|
|
| 104 |
+
| Architecture | U-Net |
|
| 105 |
+
| Loss function | L1 / MSE (image reconstruction) |
|
| 106 |
+
| Dataset | Pokémon TCG All Image Cards (Kaggle) |
|
| 107 |
+
| Framework | PyTorch |
|
| 108 |
+
|
| 109 |
+
---
|
| 110 |
+
|
| 111 |
+
## 📜 License
|
| 112 |
+
|
| 113 |
+
This model is released under the **Apache 2.0** license.
|
| 114 |
+
The training dataset is subject to its own [Kaggle license](https://www.kaggle.com/datasets/ellimaaac/pokemon-tcg-all-image-cards).
|
| 115 |
+
Pokémon and all related names are trademarks of Nintendo / Game Freak / The Pokémon Company. This project is not affiliated with or endorsed by them.
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## 🙏 Acknowledgements
|
| 120 |
+
|
| 121 |
+
- Dataset by [ellimaaac](https://www.kaggle.com/ellimaaac) on Kaggle
|
| 122 |
+
- U-Net architecture originally introduced by Ronneberger et al. (2015)
|