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