Clash of Clans Deploy Zone Segmentation
Access is granted after purchase. Buy through the Telegram bot @cocvision_shop_bot; access opens on this page once the payment is confirmed. Pay with USDT or Bitcoin and access opens on its own within minutes. Monero payments are checked by hand, usually within a few hours, so please message me before paying with Monero. Questions: Telegram @nihatxp.
Two segmentation models that find the no-deploy area on a Clash of Clans attack or scout screenshot: the region around the base where troops cannot be dropped. The boundary of that region is where deployment starts.

Try before you buy
- Deploy Zone Finder: try the full model on your own screenshot.
- Dataset Viewer and the free sample: the kind of labels the models were trained on.
Models
| Light | Full | |
|---|---|---|
| Architecture | U-Net, MobileNetV2 encoder | U-Net, EfficientNet-B4 encoder |
| Output | 1 channel: no-deploy logit | 3 classes: deployable, no-deploy, interface |
| Input size | long side 640 px | long side up to 1280 px (no upscaling) |
| Labelled frames (train + val) | 4,674 | 8,824 |
| ONNX size | 27 MB | 78 MB |
| CPU (onnxruntime, desktop) | 51 ms at 640×288 | 447 ms at 1280×576 |
| GPU (PyTorch, fp32) | 17 ms at 640×640 | not measured |
| In the browser, 2400×1080 screenshot | about 0.5 s | 1–3.5 s |
The full model also segments the interface (army bar, buttons, resource bars) as its own class, so the no-deploy area does not spill onto the army bar at the bottom of the screen.
Accuracy
IoU of the no-deploy area, measured on validation frames that neither model saw in training. Validation is split by village, so no base in validation appears in training.
| Validation set | Frames | Light | Full |
|---|---|---|---|
| Held-out frames used by both models | 701 | 0.987 | 0.996 |
| All full-model validation frames | 1,458 | 0.996 | |
| └ 2400×1080 | 1,322 | 0.996 | |
| └ 1121×978 | 136 | 0.995 |
The full model was evaluated with a horizontal flip averaged in (see below); the light model without it. On the 1,458 frames the full model also reaches 0.987 IoU on the interface class.
The boundary follows the game's tile grid, including the gaps inside the border where troops can still be dropped:

Both screen sizes work:

Files
light/deploy_zone_light.onnx ONNX, opset 17, dynamic height/width
light/deploy_zone_light.pt PyTorch state_dict (segmentation_models_pytorch)
full/deploy_zone_full.onnx ONNX, opset 17, dynamic height/width
full/deploy_zone_full.pt PyTorch state_dict (segmentation_models_pytorch)
| Input | Output | |
|---|---|---|
| Light | image float32 [1, 3, H, W] | no_deploy_logit float32 [1, 1, H, W]; > 0 means no-deploy |
| Full | image float32 [1, 3, H, W] | class_logit float32 [1, 3, H, W]; argmax: 0 deployable, 1 no-deploy, 2 interface |
H and W must be multiples of 32.
Usage
Preprocessing is the same for both models: resize so the long side is 640 (light) or at most 1280 (full) keeping the aspect ratio, scale to 0–1, normalise with ImageNet mean and std, pad right and bottom to a multiple of 32.
import numpy as np, onnxruntime as ort
from PIL import Image
MEAN = np.array([0.485, 0.456, 0.406], np.float32)
STD = np.array([0.229, 0.224, 0.225], np.float32)
def predict(path, model="light/deploy_zone_light.onnx", long_side=640, flip=False):
sess = ort.InferenceSession(model, providers=["CPUExecutionProvider"])
img = Image.open(path).convert("RGB")
W, H = img.size
k = long_side / max(W, H)
if "full" in model:
k = min(k, 1.0) # the full model never upscales
w, h = round(W * k), round(H * k)
x = (np.asarray(img.resize((w, h), Image.BILINEAR), np.float32) / 255 - MEAN) / STD
pad = np.zeros((-(-h // 32) * 32, -(-w // 32) * 32, 3), np.float32)
pad[:h, :w] = x
x = pad.transpose(2, 0, 1)[None]
y = sess.run(None, {"image": x})[0][0]
if flip: # optional test-time augmentation: average with the mirrored image
y = y + sess.run(None, {"image": x[..., ::-1].copy()})[0][0][..., ::-1]
y = y[:, :h, :w]
mask = (y[0] > 0) if y.shape[0] == 1 else (y.argmax(0) == 1)
return np.asarray(Image.fromarray(mask.astype(np.uint8) * 255).resize((W, H), Image.NEAREST)) > 0
no_deploy = predict("screenshot.png")
no_deploy_full = predict("screenshot.png", "full/deploy_zone_full.onnx", 1280, flip=True)
flip=True averages the logits of the normal and the mirrored image. The full-model scores above were measured by
averaging the softmax probabilities of the two passes instead. The ONNX and PyTorch files are the best checkpoint
of each run. PyTorch weights load with segmentation_models_pytorch:
import segmentation_models_pytorch as smp, torch
light = smp.Unet("mobilenet_v2", encoder_weights=None, classes=1)
light.load_state_dict(torch.load("light/deploy_zone_light.pt", map_location="cpu"))
full = smp.Unet("efficientnet-b4", encoder_weights=None, classes=3)
full.load_state_dict(torch.load("full/deploy_zone_full.pt", map_location="cpu"))
Limitations
- Trained on screenshots from game versions 18.600 and 18.647. A large visual update may need retraining.
- Only attack and scout screens at the two screen sizes above (2400×1080 and 1121×978). Other resolutions work when resized as described, but were not measured.
- Heavy effects drawn over the base (spells, troop swarms) can make the border less precise.
Licence
- Use the models for any purpose, including commercial work, and ship them inside free or paid apps.
- The weights, or converted versions of them, may not be shared, published or sold as standalone files.
- They may not be used in cheats, bots or other tools that break Clash of Clans' terms of service.
- No attribution is required. Provided as is, without warranty.
Not affiliated with, endorsed, sponsored or approved by Supercell. Clash of Clans is a trademark of Supercell Oy.