Paper · 2023-11-03 · cs.CV, cs.LG
Using DUCK-Net for Polyp Image Segmentation
DUCK-Net is a U-Net-style encoder-decoder for polyp masks in colonoscopy images. Each level uses a DUCK block of six parallel branches, adds a learned downscaled copy of the input, and trains from scratch with a soft Dice loss. Author-reported Kvasir-SEG Dice 0.9502 with 34 filters, with the best in-dataset Dice on four benchmarks.
Semantic segmentationDice lossData augmentationDilated convolutionpolyp-segmentationmedical-image-segmentationcolonoscopyconvolutional-network
arXivPDFCodeMarkdown14 min read
AI-compiled by claude-haiku-5-5 on 2026-11-13, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
Doctors look for polyps, small growths on the inside of the colon, with a camera and outline them by hand. A computer model can draw those outlines, but polyps vary a lot in shape, size and colour, and labelled medical images are costly to collect.
This paper's model is a neural network built on the common U-Net design, which shrinks an image to find what is there and then grows it back into a mask. Two things change. First, each step uses a custom block that runs several small branches side by side, each looking at the picture with a different reach and shape, and adds their outputs together. Second, smaller copies of the input image are fed back in at each level, so fine detail from the original picture is not lost along the way. The model learns from scratch, without pre-trained weights, and the training images are varied with flips, colour changes, turns, stretches and shears.
The authors report the best in-dataset scores on the four public polyp datasets they tested. Against a pre-trained transformer model, however, the cross-dataset tests are less clear-cut, and the paper says so.
TL;DR
DUCK-Net is a U-Net-style encoder-decoder for polyp masks in colonoscopy images. It replaces the usual pair of 3×3 convolutions with a DUCK block that sums six parallel branches fig. 6, adds learned 2×2 stride-2 copies of the input at each level DUCK_Net.py, and trains from scratch with RMSprop at 1e-4, batch size 4, 600 epochs and a soft Dice loss p. 12. Author-reported Dice is 0.9502 on Kvasir-SEG with 34 filters tab. 1. Before reimplementing, read the Pitfalls: the code pools Dice over all pixels, saves a checkpoint only below a fixed validation threshold, and reports single runs.
Problem
Polyp segmentation is hard because polyps differ in shape, size and texture, and deep models usually need many labelled images § Introduction p. 2. The paper argues that transformer encoders pre-trained on large image sets do well on this task but depend on that pre-training § Related work (Transformers) [pp. 4–5]. The authors aim for a model that learns from small, labelled polyp sets without any pre-training § Introduction p. 2 § Methodology p. 6.
Method
The model keeps the U-Net encoder-decoder layout with skip connections § Methodology (Model architecture) p. 6 and changes three things: the blocks at each level, a second input path, and how the two paths are merged.
- Input: a 352 × 352 RGB image, scaled to [0, 1]. Output: one probability map per pixel § Experiments (Implementation details) p. 12 fig. 1 p. 7.
- Level 0 applies one DUCK block at full resolution with F filters, where F is 17 or 34 § Methodology (Model architecture) p. 6 fig. 1 p. 7.
- The network makes five downscaled copies of the input with 2×2 stride-2 convolutions, with 2F, 4F, 8F, 16F and 32F channels § Methodology (Model architecture) p. 6 DUCK_Net.py.
- Each deeper encoder level applies a 2×2 stride-2 convolution to the previous level's output, adds the matching copy, and runs a DUCK block § Methodology (Model architecture) p. 6 DUCK_Net.py.
- The bottom, at 11 × 11, uses four residual blocks in place of DUCK blocks: two at 32F channels, then two at 16F § Methodology (Model architecture) p. 6 DUCK_Net.py.
- The decoder upsamples by 2 with nearest-neighbour interpolation, adds the encoder tensor of the same level (addition, not concatenation), and runs a DUCK block § Methodology (Model architecture) p. 6 [code: ModelArchitecture/DUCK_Net.py#L46-L64].
- A 1 × 1 convolution with one output channel and a sigmoid gives the mask fig. 1 p. 7 DUCK_Net.py.
- Training minimises 1 − Dice eq. 6 p. 12.
The DUCK block (Figure 6) is the main novelty § Methodology (Block components) [pp. 8–10]. It holds six branches that read the same normalised input and are summed:
# DUCK block [fig. 6] [p. 10]
# Code: CustomLayers/ConvBlock2D.py#L34-L52
def duck_block(x, filters):
# Normalise the input [code: CustomLayers/ConvBlock2D.py#L35]
x = batch_norm(x)
# Branch 1: three 3x3 convs, dilation 1, 2 and 3 [fig. 4] [p. 8]
wide = dilated_stack(x, filters, dilations=[1, 2, 3])
# Branch 2: two 3x3 convs, dilation 1 and 2 [fig. 3] [p. 8]
mid = dilated_stack(x, filters, dilations=[1, 2])
# Branches 3 to 5: one, two and three residual blocks in a chain [p. 10]
res_1 = residual_stack(x, filters, depth=1)
res_2 = residual_stack(x, filters, depth=2)
res_3 = residual_stack(x, filters, depth=3)
# Branch 6: a 1x6 conv then a 6x1 conv [fig. 5] [p. 9]
sep = separable(x, filters, size=6)
# Sum the six branches, then normalise [code: ...ConvBlock2D.py#L46-L50]
y = wide + mid + res_1 + res_2 + res_3 + sep
return batch_norm(y)The helper blocks, from the same source file:
# Residual block [fig. 2] [p. 8]
# Code: CustomLayers/ConvBlock2D.py#L100-L114
def residual_block(x, filters):
# 1x1 projection on the skip path [code: ...ConvBlock2D.py#L101-L102]
skip = relu(conv2d(x, filters, kernel=1))
# Two 3x3 convs, each with ReLU then batch norm [code: ...#L104-L109]
y = batch_norm(relu(conv2d(x, filters, kernel=3)))
y = batch_norm(relu(conv2d(y, filters, kernel=3)))
# Add the skip, then normalise [code: ...ConvBlock2D.py#L110-L112]
return batch_norm(y + skip)
# Chain of residual blocks, used by the DUCK branches and the bottom
def residual_stack(x, filters, depth):
# Apply the residual block depth times in sequence [code: ...#L10-L11]
for step in range(depth):
x = residual_block(x, filters)
return x
# Dilated 3x3 stack, used for the midscope and widescope branches
def dilated_stack(x, filters, dilations):
# Each 3x3 conv has ReLU, then batch norm [code: ...#L67-L97]
for rate in dilations:
x = batch_norm(relu(conv2d(x, filters, 3, dilation=rate)))
return x
# Separable branch: 1 x size then size x 1, with N = size [fig. 5] [p. 9]
# Code: CustomLayers/ConvBlock2D.py#L55-L64
def separable(x, filters, size):
# 1 x size conv with ReLU, then batch norm [code: ...#L56-L58]
x = batch_norm(relu(conv2d(x, filters, kernel=(1, size))))
# size x 1 conv with ReLU, then batch norm [code: ...#L60-L62]
return batch_norm(relu(conv2d(x, filters, kernel=(size, 1))))The forward pass that ties the levels together:
# DUCK-Net forward pass with F filters (17 or 34) [fig. 1] [p. 7]
# Code: ModelArchitecture/DUCK_Net.py#L12-L70
def duck_net(image, F):
# Five learned 2x2 stride-2 convs make the low-res copies, linear
# [code: ModelArchitecture/DUCK_Net.py#L17-L21]
copies = downscale_chain(image, [2 * F, 4 * F, 8 * F, 16 * F, 32 * F])
# Level 0 at full resolution [code: ModelArchitecture/DUCK_Net.py#L23]
skip_0 = duck_block(image, F)
# Level 1: strided conv of level 0, plus copy 1, then DUCK [#L25-L27]
skip_1 = duck_block(conv_s2(skip_0, 2 * F) + copies[0], 2 * F)
# Level 2: same pattern [code: ModelArchitecture/DUCK_Net.py#L29-L31]
skip_2 = duck_block(conv_s2(skip_1, 4 * F) + copies[1], 4 * F)
# Level 3: same pattern [code: ModelArchitecture/DUCK_Net.py#L33-L35]
skip_3 = duck_block(conv_s2(skip_2, 8 * F) + copies[2], 8 * F)
# Level 4: same pattern [code: ModelArchitecture/DUCK_Net.py#L37-L39]
skip_4 = duck_block(conv_s2(skip_3, 16 * F) + copies[3], 16 * F)
# Bottom: strided conv plus copy 4, then four residual blocks [#L41-L44]
bottom = conv_s2(skip_4, 32 * F) + copies[4]
bottom = residual_stack(bottom, 32 * F, depth=2)
bottom = residual_stack(bottom, 16 * F, depth=2)
# Decoder: upsample x2 (nearest), add the skip, then DUCK [#L46-L64]
decoder_steps = [(skip_4, 8 * F), (skip_3, 4 * F), (skip_2, 2 * F),
(skip_1, F), (skip_0, F)]
x = bottom
for skip, channels in decoder_steps:
x = duck_block(upsample2x(x) + skip, channels)
# Output: 1x1 conv to one channel, then sigmoid [code: ...DUCK_Net.py#L66]
return sigmoid(conv2d(x, 1, kernel=1))The loss is a soft Dice on the sigmoid outputs, with the whole batch flattened into one vector eq. 6 p. 12 DiceLoss.py:
# Soft Dice loss [eq. 6] [p. 12]
# Code: ModelArchitecture/DiceLoss.py#L5-L15
def dice_loss(truth, probs):
# Flatten the whole batch into one vector [code: ...DiceLoss.py#L8-L9]
truth_flat = flatten(truth)
probs_flat = flatten(probs)
# Overlap term [code: ...DiceLoss.py#L10]
intersection = sum(probs_flat * truth_flat)
# Total mass term [code: ...DiceLoss.py#L11]
total = sum(probs_flat) + sum(truth_flat)
# Smoothing constant 1e-6 in both terms [code: ...DiceLoss.py#L13]
dice = (2 * intersection + 1e-6) / (total + 1e-6)
return 1 - diceData preparation and augmentation (the notebook uses the Kvasir-SEG loader; the other datasets use the same function with a different file pattern):
# Load one image and mask at 352 x 352
# [§ Experiments] (Implementation details) [p. 12]
# Code: ImageLoader/ImageLoader2D.py#L36-L59
def load_pair(image_path, mask_path):
# Resize the RGB image with Pillow's default filter, scale to [0, 1]
# [code: ImageLoader/ImageLoader2D.py#L45-L48]
image = resize(read(image_path), 352, 352) / 255
# Resize the mask with Lanczos, then binarise at 127 [code: ...#L51-L57]
mask = resize(read(mask_path), 352, 352, filter="lanczos") >= 127
return image, mask
# Augment one training pair [§ Experiments] (Data augmentation) [p. 13]
# Code: ModelNotebook.ipynb#L111-L114
def augment(image, mask):
# Horizontal and vertical flips, at the library default probability
# [code: ModelNotebook.ipynb#L111-L112]
image, mask = maybe_flip_horizontal(image, mask)
image, mask = maybe_flip_vertical(image, mask)
# Colour jitter on the image only; the mask is not changed [p. 13]
image = color_jitter(image, brightness=(0.6, 1.6), contrast=0.2,
saturation=0.1, hue=0.01)
# Affine on image and mask together, applied to every sample [p. 13]
image, mask = affine(image, mask, scale=(0.5, 1.5),
translate=(-0.125, 0.125), rotate=(-180, 180),
shear=(-22.5, 22))
return image, maskTraining loop, with checkpoint selection (the paper does not describe this; the code does):
# Training schedule [§ Experiments] (Implementation details) [p. 12]
# Code: ModelNotebook.ipynb#L68-L69, #L175-L202
best_val = 0.2
for epoch in range(600):
# Build a fresh augmented copy of the whole training set [p. 13]
aug_images, aug_masks = augment_all(train_images, train_masks)
# One epoch of RMSprop at learning rate 1e-4, batch size 4 [p. 12]
fit(model, aug_images, aug_masks, batch_size=4, loss=dice_loss)
# Validation loss decides which weights are kept [#L185-L186, #L199-L200]
val_loss = dice_loss(valid_masks, predict(model, valid_images))
# Test loss is only logged and never used to save [#L188-L192]
test_loss = dice_loss(test_masks, predict(model, test_images))
if val_loss < best_val:
# Keep the best checkpoint so far [code: ModelNotebook.ipynb#L201-L202]
best_val = val_loss
save(model)Hyperparameters
| Name | Value | Where | Notes |
|---|---|---|---|
| Input size | 352 × 352 | § Experiments (Implementation details) p. 12 ModelNotebook.ipynb | Aspect ratio not kept (plain resize) |
| Input channels | 3 (RGB) | ModelNotebook.ipynb | Scaled by 1/255; no mean or std normalisation in code ImageLoader2D.py |
| Output channels | 1 (sigmoid) | fig. 1 p. 7 DUCK_Net.py | Binary mask |
| Filters F | 17 (smaller), 34 (larger) | p. 7 ModelNotebook.ipynb | Notebook default 17 |
| Downscale convs | 2×2, stride 2, linear | p. 6 DUCK_Net.py | No activation in code |
| Bottom depth | 4 residual blocks (2 at 32F, 2 at 16F) | p. 6 DUCK_Net.py | Paper: "four Residual Blocks" |
| Optimiser | RMSprop | p. 12 ModelNotebook.ipynb | Other RMSprop arguments: Keras defaults, not stated |
| Learning rate | 1e-4, constant | p. 12 ModelNotebook.ipynb | No schedule in paper or code |
| Batch size | 4 | p. 12 ModelNotebook.ipynb | |
| Epochs | 600 | p. 12 ModelNotebook.ipynb | One augmented pass per epoch |
| Loss | 1 − soft Dice (smooth 1e-6) | eq. 6 p. 12 DiceLoss.py | Smoothing constant only in code |
| Split | about 80 / 10 / 10 (random) | p. 12 ModelNotebook.ipynb | Code: 10% test, then 0.111 of the rest as validation; seed 58800 |
| Colour jitter | brightness 0.6–1.6; contrast 0.2; saturation 0.1; hue 0.01 | p. 13 ModelNotebook.ipynb | Scalar meaning: see Pitfalls |
| Affine | rotation ±180°; translate ±0.125; scale 0.5–1.5; shear −22.5° to 22° | p. 13 ModelNotebook.ipynb | Applied to every sample (always on) |
| Flips | horizontal and vertical | p. 13 ModelNotebook.ipynb | Probability not stated; code uses library default |
| Mask threshold | ≥ 127 (of 255) after resize | ImageLoader2D.py | Not stated in paper |
| Metric threshold | 0.5 on sigmoid output | ModelNotebook.ipynb | Not stated in paper; not tuned |
| Checkpoint rule | save if validation loss beats 0.2 and the best so far | ModelNotebook.ipynb | Not stated in paper |
| Hardware | NVIDIA A100 | p. 12 | README also lists RTX 3090 (24 GB) |
| Framework | TensorFlow (pinned 2.10.0, Keras 2.10.0, albumentations 1.2.1) | p. 12 requirements.txt | Paper names TensorFlow only |
Results
Author-reported, from the paper's own runs. Setup: four public polyp datasets, random 80/10/10 splits, 352 × 352 inputs, no pre-training, one run per cell § Experiments (Implementation details) p. 12 § Experiments (Datasets) p. 13. Baselines are cited from the paper; some use pre-training, which the tables mark. Dice (DSC) figures:
| Dataset | This paper, F = 17 | This paper, F = 34 | Best listed baseline (DSC) | Source |
|---|---|---|---|---|
| Kvasir-SEG | 0.9343 | 0.9502 | FCN-Transformer 0.9220 (pre-trained) | tab. 1 |
| CVC-ClinicDB | 0.9450 | 0.9478 | FCN-Transformer 0.9327 (pre-trained) | tab. 2 |
| ETIS-LaribPolypDB | 0.9324 | 0.9354 | FCN-Transformer 0.9163 (pre-trained) | tab. 3 |
| CVC-ColonDB | 0.9353 | 0.9230 | PraNet 0.9131 (pre-trained) | tab. 4 |
All five metrics on Kvasir-SEG, for F = 34 tab. 1: Dice 0.9502, Jaccard 0.9051, precision 0.9628, recall 0.9379, accuracy 0.9842. For F = 17: Dice 0.9343, Jaccard 0.8769, precision 0.9350, recall 0.9337, accuracy 0.9789 tab. 1.
Cross-dataset (train on one dataset, test on the other, DSC) § Experiments (Results) tab. 5 tab. 6:
| Setting | This paper, F = 17 | This paper, F = 34 | Best listed baseline (DSC) | Source |
|---|---|---|---|---|
| Train Kvasir-SEG, test CVC-ClinicDB | 0.8014 | 0.8211 | FCN-Transformer 0.8314 (pre-trained) | tab. 5 |
| Train CVC-ClinicDB, test Kvasir-SEG | 0.7525 | 0.8251 | FCN-Transformer 0.8800 (pre-trained) | tab. 6 |
Ablation on Kvasir-SEG, DSC, one run per cell § Experiments (Ablation studies) tab. 7:
| Block in DUCK-Net | F = 17 | F = 34 | Source |
|---|---|---|---|
| Simple convolution blocks | 0.8722 | 0.8914 | tab. 7 |
| DUCK blocks | 0.9343 | 0.9502 | tab. 7 |
The paper's qualitative comparison of predicted masks on three Kvasir-SEG test images is in fig. 7 p. 18. It is described by eye, with no numbers.
Paper vs code
Checked against the official repository at code_commit. The abstract links
it p. 1, and its README names the same three authors [README]. The code
is licensed CC BY 4.0 (LICENSE file), which is not a software licence in the
MIT, Apache-2.0 or BSD sense. No code is quoted verbatim in this card.
- Dice is pooled, not averaged per image. The abstract says "mean Dice coefficient" p. 1. The paper defines Dice per set eq. 1 p. 11. The notebook computes F1 (equal to Dice) over all flattened pixels of the whole split at once ModelNotebook.ipynb. The reported DSC values are therefore pixel-pooled, unless the paper's own evaluation differed from this notebook (not stated).
- Lanczos applies to masks only. The paper says images are rescaled with a Lanczos filter § Experiments (Implementation details) p. 12. The code applies Lanczos to the mask ImageLoader2D.py; the image uses Pillow's default filter, with no argument passed ImageLoader2D.py.
- Checkpoint selection is not in the paper. The paper gives 600 epochs p. 12. The code keeps the weights with the lowest validation loss, but only when that loss is below 0.2 at the start [code: ModelNotebook.ipynb#L68-L69, #L199-L202]. The metrics cell reloads that saved checkpoint [code: ModelNotebook.ipynb#L225-L229]. So reported numbers come from the best-validation epoch, not the last one (inferred from the code).
- Augmentation is always on. The paper says transformations are "randomly
applied" § Experiments (Data augmentation) p. 13. The code uses colour
jitter and affine with
always_apply=TrueModelNotebook.ipynb, so every training sample is transformed on every epoch. Flips use the library default probability ModelNotebook.ipynb; the paper gives no probability. - Secondary path is learned. The paper says the secondary downscaling layer "does not implement any convolutional processing", while also using 2×2 stride-2 convolutions to downscale § Methodology (Model architecture) p. 6. The code learns those five convolutions, with no activation DUCK_Net.py. The paper's wording is ambiguous on whether they are trainable.
- Activations and initialisers. The block figures show normalisation but
no activation fig. 2 p. 8. The code uses ReLU after each block
convolution ConvBlock2D.py, linear downscale convs,
and a sigmoid output DUCK_Net.py. The module
defines
kernel_initializer = 'he_uniform'[code: ModelArchitecture/DUCK_Net.py#L8], but the convolutions inDUCK_Net.pynever pass it, so they use Keras' default initialiser. Block convolutions do pass it ConvBlock2D.py. - Preprocessing details. Input is scaled by 1/255 only [code: ImageLoader/ImageLoader2D.py#L48]. Masks are binarised at 127 after resize ImageLoader2D.py. The paper states neither.
- Seeds. The notebook seeds only the train/validation/test split [code: ModelNotebook.ipynb#L55, #L97-L98]. No TensorFlow, NumPy or augmentation seed appears in the notebook, so repeated training runs will differ.
- Splits. The paper points to shared split files § Data availability p. 20. The notebook makes its own split with the seed above [code: ModelNotebook.ipynb#L97-L98]. Whether it matches the shared files is not verified.
- Only Kvasir-SEG is wired in. The notebook loads only the Kvasir-SEG set ModelNotebook.ipynb. The loader can read the other three sets ImageLoader2D.py, but the cross-dataset runs tab. 5 tab. 6 have no code in the repo.
- Baselines and ablation code are absent. The repo has no code for U-Net,
HRNetV2, PraNet, HarDNet-DFUS, MSRF-Net or FCN-Transformer [README]. The
model file uses only the DUCK block DUCK_Net.py.
ConvBlock2D.pydefines 'conv' and 'double_convolution' options, but the model does not use them ConvBlock2D.py. The "simple convolution blocks" of tab. 7 are not defined in the paper. Inferred from the code: the closest match isdouble_convolution, two 3×3 convolutions with batch norm, but that is not confirmed. - Versions. The repo pins TensorFlow 2.10.0, Keras 2.10.0, albumentations 1.2.1 and Pillow 9.2.0 requirements.txt. The paper names TensorFlow only p. 12.
Pitfalls
- Metric definition. Dice in the tables pools pixels across the split ModelNotebook.ipynb. A per-image mean, which "mean Dice" suggests, can differ. Check which one you implement before comparing numbers.
- Checkpoint rule. The 0.2 starting threshold is a hard cut-off. If no validation loss falls below 0.2, the notebook saves nothing and the metrics cell cannot load a model ModelNotebook.ipynb. The paper does not mention this.
- Variance is not reported. The "Standard Deviation (between methods)" rows in tab. 1–tab. 6 measure spread across methods, not across seeds. No repeated runs are shown, and the ablation tab. 7 is also one run per cell.
- No augmentation ablation. The paper says augmentation "significantly" improves generalisation and makes dropout unnecessary § Experiments (Implementation details) p. 12. It reports no run without augmentation; tab. 7 only compares block types. The code applies the affine and colour jitter to every sample every epoch ModelNotebook.ipynb.
- Colour jitter scalars. The paper says "a contrast of 0.2, a saturation factor of 0.1, and a hue factor of 0.01" p. 13. The code passes scalars to albumentations. Per the library's documentation, a scalar becomes a symmetric range around 1 for brightness, contrast and saturation, and around 0 for hue. I did not check this against the pinned version (1.2.1) in this session.
- Optimiser defaults. Only the learning rate is set for RMSprop [code: ModelNotebook.ipynb#L57]. Rho, epsilon and momentum are Keras defaults, not stated in the paper. A different framework's RMSprop will not match exactly.
- Loss over a batch. The Dice loss flattens the whole batch [code: ModelArchitecture/DiceLoss.py#L8-L9]. The loss is therefore not a mean of per-image losses, and it depends on batch size, which is 4 here.
- Bottom size. A 352 input is halved five times, giving 11 × 11 at the bottom p. 6; the code matches this. The bottom has 32F channels (544 for F = 17, 1088 for F = 34; computed from the code, not stated in the paper).
- Cost is not reported. No parameter count, FLOPs, FPS or training time appears in the paper. It argues costs only qualitatively § Discussion p. 19. The README lists 24 GB of VRAM as enough for training [README].
- Generalisation claim. The abstract claims "strong generalization" p. 1. In tab. 5 and tab. 6 the pre-trained FCN-Transformer scores higher, and the paper says so § Discussion p. 18.
- Threshold. The metrics use 0.5 on the sigmoid output [code: ModelNotebook.ipynb#L233-L238]. The paper does not say whether this was tuned, and the code does not tune it.
Lineage
- Builds on: U-Net's encoder-decoder with skip connections § Methodology (Model architecture) p. 6; the residual block of ResUNet++ § Methodology (Block components) p. 8; atrous convolutions from DeepLabV3 § Introduction p. 2; addition for merging, following LinkNet § Methodology (Model architecture) p. 6.
- Compared against: U-Net (with the same augmentations), HRNetV2, PraNet, HarDNet-DFUS, MSRF-Net and FCN-Transformer tab. 1–tab. 4; the same set in cross-dataset tests tab. 5 tab. 6.
- Superseded by: not stated.
Source and license
Adapted from “Using DUCK-Net for Polyp Image Segmentation” by Razvan-Gabriel Dumitru, Darius Peteleaza, Catalin Craciun (arXiv:2311.02239), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/RazvanDu/DUCK-Net at commit 7cc6517332ec (CC-BY-4.0). Any quoted code is shown under that license.