Skip to content

Finding and outlining objects in images

Count and locate everyday objects in images with pretrained COCO models — boxes (Faster R-CNN), pixel masks (Mask R-CNN), a class per pixel (DeepLabV3) — and read scores, thresholds and the boxes table.

Applied ~14 min9 steps

What runs in CodeSplash

You will be able to

  • Read a detector's boxes, classes and scores, and choose a score threshold knowingly
  • Tell detection, instance segmentation and semantic segmentation apart by what each one returns
  • Use the boxes and masks table (COCO RLE) to count, measure and evaluate objects

Read first

01

What is in these pictures?

Read

A pretrained detector has already seen hundreds of thousands of labeled photos. Here it looks at a small folder: a cat, a coffee cup on a table, an astronaut, a drawing of shapes and a flat gray square. One file is broken and one row has no path, so the method reads 5 images and says how many it left outImages readRows whose image file could be decoded; rows without a path and files that can't be decoded are counted and left out..

Object detectionObject detectionFinding each object in an image as a box with a class and a score, such as every person and car in a street photo. answers with one box per object, a class and a score. The classes are COCO's 80 everyday classesCOCO's 80 classesThe 80 everyday object classes of the COCO dataset (people, vehicles, animals, food, furniture) the detectors learned.: people, vehicles, animals, kitchen things, furniture. Anything else is missed or given the nearest class.

02

Boxes, classes and scores

Predict

Predict first

The fast MobileNetV3 detector runs with a score threshold of 0.5. What do you expect it to find?

About one object per photo, none in the drawingsDozens of objects in every imageNothing at all: the photos are too small
Reveal

The answer: About one object per photo, none in the drawings

It finds 3 objects in 3 images: the cat, the cup and the astronaut. The drawing and the gray square have no COCO object, and the detector rightly stays quiet.

03

Run it

In the app
Object detection (Faster R-CNN, COCO)Recorded · Python and R agreeRecorded 2026-11-25 · 26 values compared
R

3 objects in 3 of 5 images; most common: cat (1).

Objects
3
Images
5
Classes found
3
Objects per image
0.6000

Plots

Detected objectsWhat did the detector or segmenter find in each image, and where exactly?
View data
Height (px)ImageClassMedia idScoreWidth (px)x0x1y0y1
160cat.pngcat0eaeb6793ad08de630a090bbf7b187aa30acbc292e63d298d3ff0338cec02a500.99452404.049210.150.2764158.14
160cup.pngcup0f2f46f52111cb7dc1a71df8df67fa7af376bf66c5304888c767b881a4c9c6a60.975624065.684168.947.390123.73
192astronaut.pngpersonf37291cf2c47100683468e90bd3810c1f03d64d8eb9c51f8972c9160a9de5d220.89181926.176141.005.883190.94
150shapes.png—fb6409af86ab2ef69eff6ef058e1227929f5a75ad407435a729a370097b2578c—200————
48flat.png—81d0ef9f87003b2a8f4726bd99d84744e070a37fc2ba0a63f1537fd951587a11—64————
Objects by classHow often does each category occur?
View data
Class
cat
cup
person

Assumptions

  • COCO's 80 classes — Only COCO's everyday classes (people, vehicles, animals, household objects) can be found; anything else is missed or given the nearest class.
  • Score threshold — Objects scored below 0.5 are dropped. Lower it to find more objects (and more false ones).
  • Photos like COCO's — The model learned from everyday photos; drawings, microscopy, aerial or medical images need a model trained on them.
  • People in images — 1 images show people. Treat them as personal data; results stay on this computer.

Objects by class

ClassObjectsImagesMean scoreHighest score
cat110.99450.9945
cup110.97560.9756
person110.89180.8918

Objects per image

RowFileObjectsClasses
1cat.png1cat
2cup.png1cup
3astronaut.png1person
4shapes.png0
5flat.png0
  • 1 rows have no path and are left out.
  • 1 files could not be decoded and are left out.
The exact R script · R R version 4.5.1 (2025-06-13)
# Object detection (Faster R-CNN, COCO)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method detect.objects 1.0.1 · spec 8b376c52a30d1405
# Dataset: img3_photos (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.

# %% Setup
library(codesplashr)

ARCH <- "fasterrcnn_mobilenet_v3_large_fpn"
# %% Images listed in the path column
PATH <- "path"
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/img3_photos.parquet", col_select = PATH))
if (!nrow(df)) cs_error("CS_E_NO_ROWS")
warnings <- character(0)
# %% Media files (image column path)
# In the app the files were decoded once into float32 arrays (media.json in the run folder). Elsewhere they are
# decoded here the same way: PNG and WAV give the app's values; JPEG, MP3 and other lossy files can differ slightly.
media <- cs_media_setup(jsonlite::fromJSON("{\"ids_column\":\"media_id\",\"kind\":\"image\",\"path_column\":\"path\",\"role\":\"image\",\"transform\":{\"filter\":\"triangle\",\"fit\":\"within\",\"mode\":\"rgb\",\"normalize\":\"none\",\"size\":[1333,1333]}}", simplifyVector = FALSE), "target/academy-parity/run-8142/detect.objects/fast_defaults_small/out-r", df,
                        "tests/parity/fixtures/img3_photos.parquet")
media_ids <- cs_media_ids(media, df)

text_ <- function(v) { v <- as.character(v); v[!is.na(v) & !nzchar(v)] <- NA_character_; v }
paths_ <- text_(df[[PATH]])
has_id <- which(!is.na(media_ids) & !is.na(paths_))
if (!length(has_id)) cs_error("CS_E_ALL_MISSING", column = PATH)
status_ <- cs_media_status(media, media_ids[has_id])
ok <- has_id[is.na(status_)]
n_no_path <- nrow(df) - length(has_id)
n_unreadable <- length(has_id) - length(ok)
if (!length(ok)) cs_error("CS_E_INVALID_VALUES", column = PATH, requirement = "an image file that can be decoded", count = length(has_id))
if (n_no_path) warnings <- c(warnings, sprintf("%d rows have no path and are left out.", n_no_path))
if (n_unreadable) warnings <- c(warnings, sprintf("%d files could not be decoded and are left out.", n_unreadable))
items <- lapply(ok, function(k) list(media_id = media_ids[k], file = basename(paths_[k]), row = k - 1L))

# One decoded image (3, h, w) on 0-1 and its size before decoding (orientation applied).
load_image <- function(mid) {
  a <- cs_media_load(media, mid)
  list(image = array(a, dim = dim(a)[-1]), size = cs_media_source_size(media, mid)[[1]])
}

# %% Pretrained model and compute profile
cs_deep_profile_configure(list(profile = "parity"))
cs_deep_torch()
model <- cs_vis_load(ARCH, dtype = cs_deep_profile_current()$dtype)

# %% Detect objects (torchvision fasterrcnn_mobilenet_v3_large_fpn on the converted COCO weights)
SCORE <- 0.5
MIN_SIZE <- 320
CLASSES <- unlist(c())
run <- cs_vis_detect_images(model, items, load_image, masks = FALSE, min_size = MIN_SIZE, max_size = 1333,
                            score_threshold = SCORE, nms_threshold = 0.5,
                            max_detections = 100, classes = CLASSES)
table <- run$table
s <- cs_vis_summarize(table, run$images)
values <- c(list(n_rows = nrow(df), n_no_path = n_no_path, n_unreadable = n_unreadable), s$values,
            list(model = cs_vis_model_info(ARCH)$label, min_size = MIN_SIZE, score_threshold = SCORE))

# %% Artifacts: the boxes table (one row per object) and one row per image
out <- cs_ml_out_dir("target/academy-parity/run-8142/detect.objects/fast_defaults_small/out-r")
cs_boxes_write(table, file.path(out, "boxes.parquet"))
per <- data.frame(row = vapply(run$images, function(r) r$row + 1L, 0L),
                  media_id = vapply(run$images, function(r) r$media_id, ""),
                  file = vapply(run$images, function(r) r$file, ""),
                  width = vapply(run$images, function(r) r$width, 0L),
                  height = vapply(run$images, function(r) r$height, 0L),
                  objects = vapply(run$images, function(r) as.integer(r$objects), 0L), stringsAsFactors = FALSE)
nanoparquet::write_parquet(per, file.path(out, "images.parquet"))

# %% Result
ov <- cs_vis_overlay_columns(table, run$images)
charts <- list(cs_chart("overlay", "image-overlay", "Detected objects", list(
  image = cs_col("Image", ov$image, "categorical"),
  media_id = cs_col("Media id", ov$media_id, "categorical"),
  x0 = cs_col("x0", ov$x0, "numeric"), y0 = cs_col("y0", ov$y0, "numeric"),
  x1 = cs_col("x1", ov$x1, "numeric"), y1 = cs_col("y1", ov$y1, "numeric"),
  label = cs_col("Class", ov$label, "categorical"),
  score = cs_col("Score", ov$score, "numeric"),
  width = cs_col("Width (px)", ov$width, "numeric"), height = cs_col("Height (px)", ov$height, "numeric")
), controls = list(threshold = SCORE)))
if (nrow(table)) {
  charts[[length(charts) + 1L]] <- cs_chart("classes", "bar", "Objects by class", list(
    x = cs_col("Class", as.character(table$label), "categorical", s$order)))
}
n_person <- if (is.null(values[["n[person]"]])) 0L else values[["n[person]"]]
img_person <- if (is.null(values[["images[person]"]])) 0L else values[["images[person]"]]
assumptions <- c(list(
  list(key = "coco_classes", label = "COCO's 80 classes", status = "info",
       detail = "Only COCO's everyday classes (people, vehicles, animals, household objects) can be found; anything else is missed or given the nearest class."),
  list(key = "threshold", label = "Score threshold", status = "info",
       detail = sprintf("Objects scored below %s are dropped. Lower it to find more objects (and more false ones).", format(SCORE))),
  list(key = "domain", label = "Photos like COCO's", status = "info",
       detail = "The model learned from everyday photos; drawings, microscopy, aerial or medical images need a model trained on them."),
  list(key = "people", label = "People in images", status = if (n_person > 0) "warn" else "pass",
       detail = if (n_person > 0) sprintf("%d images show people. Treat them as personal data; results stay on this computer.", img_person) else "No person was detected.")
), cs_deep_profile_warning_rows())
image_cols <- list(list(key = "row", label = "Row", type = "integer"), list(key = "file", label = "File"),
                   list(key = "objects", label = "Objects", type = "integer"), list(key = "classes", label = "Classes"))
class_cols <- list(list(key = "class", label = "Class"), list(key = "objects", label = "Objects", type = "integer"),
                   list(key = "images", label = "Images", type = "integer"), list(key = "mean_score", label = "Mean score", type = "number"),
                   list(key = "max_score", label = "Highest score", type = "number"))
cs_publish(list(
  title = "Object detection (Faster R-CNN, COCO)",
  engine = cs_engine_info("torch", "torchvision", "safetensors", "nanoparquet", "codesplashr"),
  n = values$n_images,
  summary = paste0(sprintf("%d objects in %d of %d images", values$n_objects, values$n_images_with_objects, values$n_images),
                   if (length(s$order)) sprintf("; most common: %s (%d).", s$order[1], values[[sprintf("n[%s]", s$order[1])]]) else "."),
  statistics = list(
    list(key = "n_objects", label = "Objects", value = values$n_objects, format = "integer"),
    list(key = "n_images", label = "Images", value = values$n_images, format = "integer"),
    list(key = "n_classes", label = "Classes found", value = values$n_classes, format = "integer"),
    list(key = "objects_per_image", label = "Objects per image", value = values$objects_per_image)
  ),
  tables = list(
    list(key = "classes", title = "Objects by class", columns = class_cols, rows = s$classes),
    list(key = "images", title = "Objects per image", columns = image_cols, rows = s$images[seq_len(min(200L, length(s$images)))])
  ),
  assumptions = assumptions,
  charts = charts,
  values = values,
  warnings = as.list(warnings),
  artifacts = list(list(key = "boxes", path = file.path(out, "boxes.parquet"), format = "parquet"),
                   list(key = "images", path = file.path(out, "images.parquet"), format = "parquet"))
))
Python

3 objects in 3 of 5 images; most common: cat (1).

Objects
3
Images
5
Classes found
3
Objects per image
0.6000

To keep this page light, the plots are shown once, under the R tab.

Assumptions

  • COCO's 80 classes — Only COCO's everyday classes (people, vehicles, animals, household objects) can be found; anything else is missed or given the nearest class.
  • Score threshold — Objects scored below 0.5 are dropped. Lower it to find more objects (and more false ones).
  • Photos like COCO's — The model learned from everyday photos; drawings, microscopy, aerial or medical images need a model trained on them.
  • People in images — 1 images show people. Treat them as personal data; results stay on this computer.

Objects by class

ClassObjectsImagesMean scoreHighest score
cat110.99450.9945
cup110.97560.9756
person110.89180.8918

Objects per image

RowFileObjectsClasses
1cat.png1cat
2cup.png1cup
3astronaut.png1person
4shapes.png0
5flat.png0
  • 1 rows have no path and are left out.
  • 1 files could not be decoded and are left out.
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Object detection (Faster R-CNN, COCO)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method detect.objects 1.0.1 · spec 8b376c52a30d1405
# Dataset: img3_photos (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import os

import numpy as np
import pandas as pd

import codesplash as cs
from codesplash import media as cs_media
from codesplash import ml as csml
from codesplash.deep import core as cs_core
from codesplash.deep import profile as cs_profile
from codesplash.vision import boxes as vbox
from codesplash.vision import detect as vdet

ARCH = "fasterrcnn_mobilenet_v3_large_fpn"
# %% Images listed in the path column
PATH = "path"
df = pd.read_parquet("tests/parity/fixtures/img3_photos.parquet", columns=[PATH])
if not len(df):
    cs.cs_error("CS_E_NO_ROWS")
warnings = []
# %% Media files (image column path)
# In the app the files were decoded once into float32 arrays (media.json in the run folder). Elsewhere they are
# decoded here the same way: PNG and WAV give the app's values; JPEG, MP3 and other lossy files can differ slightly.
import json as _media_json
from codesplash import media as cs_media
media = cs_media.setup(_media_json.loads("{\"ids_column\":\"media_id\",\"kind\":\"image\",\"path_column\":\"path\",\"role\":\"image\",\"transform\":{\"filter\":\"triangle\",\"fit\":\"within\",\"mode\":\"rgb\",\"normalize\":\"none\",\"size\":[1333,1333]}}"), "target/academy-parity/run-8142/detect.objects/fast_defaults_small/out-python", df, "tests/parity/fixtures/img3_photos.parquet")
media_ids = cs_media.ids_of(media, df)


def _text(v):
    return None if pd.isna(v) else str(v)  # None, NaN, pd.NA


has_id = [k for k, m in enumerate(media_ids) if m is not None and _text(df[PATH].iloc[k]) not in (None, "")]
if not has_id:
    cs.cs_error("CS_E_ALL_MISSING", column=PATH)
_status = cs_media.status(media, [media_ids[k] for k in has_id])
ok = [k for k, s in zip(has_id, _status) if s is None]
n_no_path = len(df) - len(has_id)
n_unreadable = len(has_id) - len(ok)
if not ok:
    cs.cs_error("CS_E_INVALID_VALUES", column=PATH, requirement="an image file that can be decoded", count=len(has_id))
if n_no_path:
    warnings.append(f"{n_no_path} rows have no path and are left out.")
if n_unreadable:
    warnings.append(f"{n_unreadable} files could not be decoded and are left out.")
items = [{"media_id": media_ids[k], "file": os.path.basename(str(df[PATH].iloc[k])), "row": k} for k in ok]


def load_image(mid):
    """One decoded image (3, h, w) on 0–1 and its size before decoding (orientation applied)."""
    return cs_media.load(media, [mid])[0], tuple(cs_media.source_size(media, [mid])[0])


# %% Pretrained model and compute profile
cs_profile.configure({"profile": "parity"})
cs_core.torch_init()
model = vdet.load(ARCH, dtype=cs_profile.current().dtype)

# %% Detect objects (torchvision fasterrcnn_mobilenet_v3_large_fpn on the converted COCO weights)
SCORE = 0.5
MIN_SIZE = 320
CLASSES = [] or None
run = vdet.detect_images(model, items, load_image, masks=False, min_size=MIN_SIZE, max_size=1333, score_threshold=SCORE,
                         nms_threshold=0.5, max_detections=100, classes=CLASSES)
table = run["table"]
s = vdet.summarize(table, run["images"])
values = {"n_rows": len(df), "n_no_path": n_no_path, "n_unreadable": n_unreadable, **s["values"],
          "model": vdet.MODELS[ARCH]["label"], "min_size": MIN_SIZE, "score_threshold": SCORE}

# %% Artifacts: the boxes table (one row per object) and one row per image
out = csml.out_dir("target/academy-parity/run-8142/detect.objects/fast_defaults_small/out-python")
vbox.write(table, os.path.join(out, "boxes.parquet"))
per = pd.DataFrame([{"row": r["row"] + 1, "media_id": r["media_id"], "file": r["file"], "width": r["width"],
                     "height": r["height"], "objects": r["objects"]} for r in run["images"]],
                   columns=["row", "media_id", "file", "width", "height", "objects"])
per.to_parquet(os.path.join(out, "images.parquet"), index=False)

# %% Result
ov = vdet.overlay_columns(table, run["images"])
charts = [cs.chart("overlay", "image-overlay", "Detected objects", {
    "image": cs.col("Image", ov["image"], "categorical"),
    "media_id": cs.col("Media id", ov["media_id"], "categorical"),
    "x0": cs.col("x0", ov["x0"], "numeric"), "y0": cs.col("y0", ov["y0"], "numeric"),
    "x1": cs.col("x1", ov["x1"], "numeric"), "y1": cs.col("y1", ov["y1"], "numeric"),
    "label": cs.col("Class", ov["label"], "categorical"),
    "score": cs.col("Score", ov["score"], "numeric"),
    "width": cs.col("Width (px)", ov["width"], "numeric"), "height": cs.col("Height (px)", ov["height"], "numeric"),
}, controls={"threshold": SCORE})]
if len(table):
    charts.append(cs.chart("classes", "bar", "Objects by class", {
        "x": cs.col("Class", [str(v) for v in table["label"].tolist()], "categorical", s["order"])}))
assumptions = [
    {"key": "coco_classes", "label": "COCO's 80 classes", "status": "info",
     "detail": "Only COCO's everyday classes (people, vehicles, animals, household objects) can be found; anything else is missed or given the nearest class."},
    {"key": "threshold", "label": "Score threshold", "status": "info",
     "detail": f"Objects scored below {SCORE:g} are dropped. Lower it to find more objects (and more false ones)."},
    {"key": "domain", "label": "Photos like COCO's", "status": "info",
     "detail": "The model learned from everyday photos; drawings, microscopy, aerial or medical images need a model trained on them."},
    {"key": "people", "label": "People in images", "status": "warn" if values.get("n[person]", 0) else "pass",
     "detail": f"{values.get('images[person]', 0)} images show people. Treat them as personal data; results stay on this computer." if values.get("n[person]", 0) else "No person was detected."},
] + cs_profile.warning_rows()
image_cols = [{"key": "row", "label": "Row", "type": "integer"}, {"key": "file", "label": "File"},
              {"key": "objects", "label": "Objects", "type": "integer"}, {"key": "classes", "label": "Classes"}]
class_cols = [{"key": "class", "label": "Class"}, {"key": "objects", "label": "Objects", "type": "integer"},
              {"key": "images", "label": "Images", "type": "integer"}, {"key": "mean_score", "label": "Mean score", "type": "number"},
              {"key": "max_score", "label": "Highest score", "type": "number"}]
cs.publish({
    "title": "Object detection (Faster R-CNN, COCO)",
    "engine": cs.engine_info("torch", "torchvision", "numpy", "pandas"),
    "n": values["n_images"],
    "summary": f"{values['n_objects']} objects in {values['n_images_with_objects']} of {values['n_images']} images"
               + (f"; most common: {s['order'][0]} ({values['n[' + s['order'][0] + ']']})." if s["order"] else "."),
    "statistics": [
        {"key": "n_objects", "label": "Objects", "value": values["n_objects"], "format": "integer"},
        {"key": "n_images", "label": "Images", "value": values["n_images"], "format": "integer"},
        {"key": "n_classes", "label": "Classes found", "value": values["n_classes"], "format": "integer"},
        {"key": "objects_per_image", "label": "Objects per image", "value": values["objects_per_image"]},
    ],
    "tables": [
        {"key": "classes", "title": "Objects by class", "columns": class_cols, "rows": s["classes"]},
        {"key": "images", "title": "Objects per image", "columns": image_cols, "rows": s["images"][:200]},
    ],
    "assumptions": assumptions,
    "charts": charts,
    "values": values,
    "warnings": warnings,
    "artifacts": [{"key": "boxes", "path": os.path.join(out, "boxes.parquet"), "format": "parquet"},
                  {"key": "images", "path": os.path.join(out, "images.parquet"), "format": "parquet"}],
})
Image overlay (boxes and masks)What did the detector or segmenter find in each image, and where exactly?
View data
imagemedia idx0y0x1y1classscoremaskwidthheight
table.jpgdemo:table5072142164cup0.9700_j;>m6:H6J6K4L4L4M2M4M2N2N2M4M2N2O0O2N2N2N2O0O2N2O0O2O0O2O0O2O000O2O000O2O0000000O2O00000000000000000000000001N100000001N10001N10001N101N101N101N2N101N2N2N2N101N2N3L3N2N2N3L3N3L4L4L5J6J8FfcY1320240
table.jpgdemo:table16860292112book0.8800l]W1d1l500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000T`6320240
table.jpgdemo:table176140300214laptop0.6100\\Y1Z2V500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000da4320240
street.jpgdemo:street30110170176car0.9900nn5R2V40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000RVm0320200
street.jpgdemo:street21446252168person0.9300njY1j3^20000000000000000000000000000000000000000000000000000000000000000000000000bW=320200
street.jpgdemo:street26270290160person0.4200fWc1j2^300000000000000000000000000000000000000000000000000000Zi5320200
park.jpgdemo:park6282178198dog0.9500Te>`0k6:G8I6K4K6K4L4M2M4M2M4M2N2N2N2M4M2O0O2N2N2N2N2O0O2N2O0O2N2O0O2O0O2O000O2O0O2O000O2O00000O2O0000000O2O000000000000000000000000000001N100000001N1000001N10001N101N10001N101N101N2N101N2N101N2N2N2N2N101N3L3N2N2N2N3L3N3L3N3L4L5J5L5J7H9FQ]>240240
park.jpgdemo:park1783621472sports ball0.7400bhY18U76K4L4M2N2N2N2O0O2O0O2O000O2O00000000000001N10001N101N101N2N2N2N3L4L5JaQ6240240
empty.jpgdemo:empty———————280210

Each tile is one image with its boxes; the label on a box is the class and the scoreDetection scoreHow sure the detector is about one object, from 0 to 1; objects below the threshold are dropped. A rank, not a probability.. Hide low scores with the slider and watch which boxes go first.

04

Lowering the threshold

Reflect

With the accurate ResNet-50 model and the threshold lowered to 0.200, the same images give 13 objects of 9 classes. Some are real (a spoon beside the cup), some are guesses. A threshold trades missed objects against false ones; only annotations tell you where your balance lies.

When two boxes of one class overlap a lot, non-maximum suppressionNon-maximum suppression (NMS)Of two boxes of one class overlapping more than a set intersection over union, only the higher-scoring one is kept. keeps the higher-scoring one. The detection sizeDetection sizeThe short side, in pixels, each image is resized to before detection (long side at most 1,333). Smaller is faster. matters too: small objects need a larger short side, at the cost of time.

05

Outlines instead of boxes

In the app

Instance segmentationInstance segmentationDetection plus a pixel mask for every object, so each object's exact outline and area are known, not just its box. adds a pixel mask to each box. Mask R-CNN outlines the same objects, and on average they cover 42.4% of an image's pixels.

Instance segmentation (Mask R-CNN, COCO)Recorded · Python and R agreeRecorded 2026-11-25 · 36 values compared
R

7 objects outlined in 3 of 5 images, covering 42.4% of an image on average; most common: spoon (2).

Objects
7
Images
5
Classes found
6
Share covered
42.4%

Plots

Object masksWhat did the detector or segmenter find in each image, and where exactly?
View data
Height (px)ImageClassMask (COCO RLE)Media idScoreWidth (px)x0x1y0y1
160cat.pngcatb7\2[2:L3N3N1N2O1N2O1N2N2O1N2L4I7F:J6J6L4L4L4M3N200O100O100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001O0000000000000000000000000000000000000_NOSN1l12RNNl16RNJm18RNHl1;SNEj1?UNAh1b0XN^Oe1f0ZNZOc1j0\NVOa1o0]NQOa1Q1_NoN32OS1MkN0<Jm05gNOm0TOe0m0^NLk23UMKn24RMJQ35oLIT36lLHW37iLHY37gLG]36dLFa39_LDg39YLEk39ULEP48PLGV43lKJZ42fKKa41[f40eaeb6793ad08de630a090bbf7b187aa30acbc292e63d298d3ff0338cec02a500.99682400217.650.7896160
160cup.pngspoonUXd02l43ZK7R4=O2N100N2O1N2O000O100O100O1O1O1N2O1M3O1M3M2N3NkNkLb0S3[OWM`0h2_O]M>b2AbM=]2CgM9W2HmM6Q2JSN2m1MZNMP1MTN8a3?4L4N3M4K4M5JVm:0f2f46f52111cb7dc1a71df8df67fa7af376bf66c5304888c767b881a4c9c6a60.9988240127.82169.7125.976129.97
160cup.pngcupVe::b4;F>B;F5L3L4M3M3M2M3N3N1N2N1O2O0O2O1N100O2O000O2O00001N101O0O2O00001O0O2O1O1O1O000000001O0000000000O10000000001O0L4O1O2O00001N10000O2L30001O1N101O0O2O001N2M2N3M201N2N2N2L5M2M3M3M2N3M2M3L4K5N2L5K4KX\;0f2f46f52111cb7dc1a71df8df67fa7af376bf66c5304888c767b881a4c9c6a60.997824068.305168.327.286105.16
160cup.pngdining table_6_3]15N1O2O0O1O1O1O100O100O100O100O1O1O100O1O100O100O1O1O1O100O100O1O1O1O1O1O100O1O1O100O1O1O100O100N2O1O1O100O1O1000000O1000000O100000000000000000000000000000000000000000O1000000[N1lL1T1NP2;oMEQ2;oMEQ2;oMEQ2<nMDR2<nMDR2<nMDR2=mMCS2=mMCS2>lMBT2>lMBT2>lMBT2>lMBT2>lMBT23hL5T1HT2OlL9P1H[27UMJHOS37SMMILT37RMNJKT37RMNJKT36SMOIKU35RM0IKU35RM0IKU34SM1HKU34SM1HKV32SM3GKV32SM3GKV32SM3GKU34VMMFOl22jL4S1JR24jL4R1HT2a0kM_OT2c0kM]OU2c0kM]OT2d0lM\OT2e0kM[OT2f0lMZOU2e0kM[OU2f0jMZOV2f0jMZOV2f0jMZOV2g0iMYOW2g0iMYOW2g0iMYOW2g0iMYOW2g0iMYOW2g0iMYOW2g0iMYOW2g0iMYOX2f0hMZOX2e0iM[OW2e0iM[OX2d0hM\OX2c0iM]OW2c0iM]OW2c0jM\OV2d0jM\OV2c0kM]OU2c0kM]OU2c0kM]OU2b0lM^OU2`0lM@j3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000O101O0000000O2N5FO0f2f46f52111cb7dc1a71df8df67fa7af376bf66c5304888c767b881a4c9c6a60.95672400239.890160
160cup.pngspoon`Xd05g48I6J5N1N2N2N2N101N101N100O1O1N2O1N2O1N1O2N2N1O1NmNiLc0U3YOUMb0i2\O^Ma0b2]ObMa0_2\OeMa0]2\OhM`0^3M4LgR<0f2f46f52111cb7dc1a71df8df67fa7af376bf66c5304888c767b881a4c9c6a60.6700240128.76163.2368.674132.83
192astronaut.pngpersondd1>Y5b0@?C:G7I5J6K4M4N1M3N2N2O1N2O1N2O1O1O1O1N2O100O1O1O1N2O1O1O1O100N2M3N2N2N2O1O1O1N200O100O100000000POSLLn30ZLLf32^LLb32bLL^32fLLZ33iLJX35kLIU36mLHT37[100O100O1O1O1O10000O1000000000000000000000000000000000000001O00001oKFZ2;_MM_24^M0`21^M1a2O^M3`2O]M5a2L\M7b2K\M7m1`0QNBh1e0VN^Of1g0UN]Og1g0TN^Og1i0RN[Ok1`2M2M4L3N3L3N2N1O2N2N2O1N2N2N2N2N2O3L3N2M3M6I`h:f37291cf2c47100683468e90bd3810c1f03d64d8eb9c51f8972c9160a9de5d220.99871924.024138.157.449190.46
192astronaut.pngcell phonenc52n5000O100S^m0f37291cf2c47100683468e90bd3810c1f03d64d8eb9c51f8972c9160a9de5d220.562819227.01335.785189.99192.00
150shapes.png——fb6409af86ab2ef69eff6ef058e1227929f5a75ad407435a729a370097b2578c—200————
48flat.png——81d0ef9f87003b2a8f4726bd99d84744e070a37fc2ba0a63f1537fd951587a11—64————
Objects by classHow often does each category occur?
View data
Class
cat
spoon
cup
dining table
spoon
person
cell phone

Assumptions

  • COCO's 80 classes — Only COCO's everyday classes (people, vehicles, animals, household objects) can be found; anything else is missed or given the nearest class.
  • Score threshold — Objects scored below 0.5 are dropped. Lower it to find more objects (and more false ones).
  • Masks at 28 × 28 — Each mask is predicted on a 28 × 28 grid inside its box and enlarged; a pixel is inside when its probability is above 0.5.
  • Photos like COCO's — The model learned from everyday photos; drawings, microscopy, aerial or medical images need a model trained on them.
  • People in images — 1 images show people. Treat them as personal data; results stay on this computer.

Objects by class

ClassObjectsImagesMean scoreHighest score
spoon210.83440.9988
cat110.99680.9968
cell phone110.56280.5628
cup110.99780.9978
dining table110.95670.9567
person110.99870.9987

Objects per image

RowFileObjectsClassesShare covered
1cat.png1cat77.4%
2cup.png4spoon × 2, cup, dining table93.6%
3astronaut.png2cell phone, person40.8%
4shapes.png00.0%
5flat.png00.0%
  • 1 rows have no path and are left out.
  • 1 files could not be decoded and are left out.
The exact R script · R R version 4.5.1 (2025-06-13)
# Instance segmentation (Mask R-CNN, COCO)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method segment.instances 1.0.1 · spec 66718d969bbc93ff
# Dataset: img3_photos (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.

# %% Setup
library(codesplashr)

ARCH <- "maskrcnn_resnet50_fpn_v2"
# %% Images listed in the path column
PATH <- "path"
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/img3_photos.parquet", col_select = PATH))
if (!nrow(df)) cs_error("CS_E_NO_ROWS")
warnings <- character(0)
# %% Media files (image column path)
# In the app the files were decoded once into float32 arrays (media.json in the run folder). Elsewhere they are
# decoded here the same way: PNG and WAV give the app's values; JPEG, MP3 and other lossy files can differ slightly.
media <- cs_media_setup(jsonlite::fromJSON("{\"ids_column\":\"media_id\",\"kind\":\"image\",\"path_column\":\"path\",\"role\":\"image\",\"transform\":{\"filter\":\"triangle\",\"fit\":\"within\",\"mode\":\"rgb\",\"normalize\":\"none\",\"size\":[1333,1333]}}", simplifyVector = FALSE), "target/academy-parity/run-8142/segment.instances/defaults_small/out-r", df,
                        "tests/parity/fixtures/img3_photos.parquet")
media_ids <- cs_media_ids(media, df)

text_ <- function(v) { v <- as.character(v); v[!is.na(v) & !nzchar(v)] <- NA_character_; v }
paths_ <- text_(df[[PATH]])
has_id <- which(!is.na(media_ids) & !is.na(paths_))
if (!length(has_id)) cs_error("CS_E_ALL_MISSING", column = PATH)
status_ <- cs_media_status(media, media_ids[has_id])
ok <- has_id[is.na(status_)]
n_no_path <- nrow(df) - length(has_id)
n_unreadable <- length(has_id) - length(ok)
if (!length(ok)) cs_error("CS_E_INVALID_VALUES", column = PATH, requirement = "an image file that can be decoded", count = length(has_id))
if (n_no_path) warnings <- c(warnings, sprintf("%d rows have no path and are left out.", n_no_path))
if (n_unreadable) warnings <- c(warnings, sprintf("%d files could not be decoded and are left out.", n_unreadable))
items <- lapply(ok, function(k) list(media_id = media_ids[k], file = basename(paths_[k]), row = k - 1L))

# One decoded image (3, h, w) on 0-1 and its size before decoding (orientation applied).
load_image <- function(mid) {
  a <- cs_media_load(media, mid)
  list(image = array(a, dim = dim(a)[-1]), size = cs_media_source_size(media, mid)[[1]])
}

# %% Pretrained model and compute profile
cs_deep_profile_configure(list(profile = "parity"))
cs_deep_torch()
model <- cs_vis_load(ARCH, dtype = cs_deep_profile_current()$dtype)

# %% Outline objects (torchvision Mask R-CNN on the converted COCO weights; a pixel is inside when p > 0.5)
SCORE <- 0.5
MIN_SIZE <- 320
CLASSES <- unlist(c())
run <- cs_vis_detect_images(model, items, load_image, masks = TRUE, min_size = MIN_SIZE, max_size = 1333,
                            score_threshold = SCORE, nms_threshold = 0.5,
                            max_detections = 100, classes = CLASSES)
table <- run$table
s <- cs_vis_summarize(table, run$images)
values <- c(list(n_rows = nrow(df), n_no_path = n_no_path, n_unreadable = n_unreadable), s$values,
            list(model = cs_vis_model_info(ARCH)$label, min_size = MIN_SIZE, score_threshold = SCORE))

# %% Artifacts: the boxes and masks table (one row per object, masks as COCO RLE) and one row per image
out <- cs_ml_out_dir("target/academy-parity/run-8142/segment.instances/defaults_small/out-r")
cs_boxes_write(table, file.path(out, "boxes.parquet"))
per <- data.frame(row = vapply(run$images, function(r) r$row + 1L, 0L),
                  media_id = vapply(run$images, function(r) r$media_id, ""),
                  file = vapply(run$images, function(r) r$file, ""),
                  width = vapply(run$images, function(r) r$width, 0L),
                  height = vapply(run$images, function(r) r$height, 0L),
                  objects = vapply(run$images, function(r) as.integer(r$objects), 0L),
                  covered = vapply(run$images, function(r) r$covered, 0), stringsAsFactors = FALSE)
nanoparquet::write_parquet(per, file.path(out, "images.parquet"))

# %% Result
ov <- cs_vis_overlay_columns(table, run$images)
charts <- list(cs_chart("overlay", "image-overlay", "Object masks", list(
  image = cs_col("Image", ov$image, "categorical"),
  media_id = cs_col("Media id", ov$media_id, "categorical"),
  x0 = cs_col("x0", ov$x0, "numeric"), y0 = cs_col("y0", ov$y0, "numeric"),
  x1 = cs_col("x1", ov$x1, "numeric"), y1 = cs_col("y1", ov$y1, "numeric"),
  label = cs_col("Class", ov$label, "categorical"),
  score = cs_col("Score", ov$score, "numeric"),
  mask = cs_col("Mask (COCO RLE)", ov$mask, "categorical"),
  width = cs_col("Width (px)", ov$width, "numeric"), height = cs_col("Height (px)", ov$height, "numeric")
), controls = list(threshold = SCORE)))
if (nrow(table)) {
  charts[[length(charts) + 1L]] <- cs_chart("classes", "bar", "Objects by class", list(
    x = cs_col("Class", as.character(table$label), "categorical", s$order)))
}
n_person <- if (is.null(values[["n[person]"]])) 0L else values[["n[person]"]]
img_person <- if (is.null(values[["images[person]"]])) 0L else values[["images[person]"]]
assumptions <- c(list(
  list(key = "coco_classes", label = "COCO's 80 classes", status = "info",
       detail = "Only COCO's everyday classes (people, vehicles, animals, household objects) can be found; anything else is missed or given the nearest class."),
  list(key = "threshold", label = "Score threshold", status = "info",
       detail = sprintf("Objects scored below %s are dropped. Lower it to find more objects (and more false ones).", format(SCORE))),
  list(key = "mask_resolution", label = "Masks at 28 \u00d7 28", status = "info",
       detail = "Each mask is predicted on a 28 \u00d7 28 grid inside its box and enlarged; a pixel is inside when its probability is above 0.5."),
  list(key = "domain", label = "Photos like COCO's", status = "info",
       detail = "The model learned from everyday photos; drawings, microscopy, aerial or medical images need a model trained on them."),
  list(key = "people", label = "People in images", status = if (n_person > 0) "warn" else "pass",
       detail = if (n_person > 0) sprintf("%d images show people. Treat them as personal data; results stay on this computer.", img_person) else "No person was detected.")
), cs_deep_profile_warning_rows())
image_cols <- list(list(key = "row", label = "Row", type = "integer"), list(key = "file", label = "File"),
                   list(key = "objects", label = "Objects", type = "integer"), list(key = "classes", label = "Classes"),
                   list(key = "covered", label = "Share covered", type = "percent"))
class_cols <- list(list(key = "class", label = "Class"), list(key = "objects", label = "Objects", type = "integer"),
                   list(key = "images", label = "Images", type = "integer"), list(key = "mean_score", label = "Mean score", type = "number"),
                   list(key = "max_score", label = "Highest score", type = "number"))
cs_publish(list(
  title = "Instance segmentation (Mask R-CNN, COCO)",
  engine = cs_engine_info("torch", "torchvision", "safetensors", "nanoparquet", "codesplashr"),
  n = values$n_images,
  summary = paste0(sprintf("%d objects outlined in %d of %d images, covering %.1f%% of an image on average", values$n_objects,
                           values$n_images_with_objects, values$n_images, values$covered_mean * 100),
                   if (length(s$order)) sprintf("; most common: %s (%d).", s$order[1], values[[sprintf("n[%s]", s$order[1])]]) else "."),
  statistics = list(
    list(key = "n_objects", label = "Objects", value = values$n_objects, format = "integer"),
    list(key = "n_images", label = "Images", value = values$n_images, format = "integer"),
    list(key = "n_classes", label = "Classes found", value = values$n_classes, format = "integer"),
    list(key = "covered_mean", label = "Share covered", value = values$covered_mean, format = "percent")
  ),
  tables = list(
    list(key = "classes", title = "Objects by class", columns = class_cols, rows = s$classes),
    list(key = "images", title = "Objects per image", columns = image_cols, rows = s$images[seq_len(min(200L, length(s$images)))])
  ),
  assumptions = assumptions,
  charts = charts,
  values = values,
  warnings = as.list(warnings),
  artifacts = list(list(key = "boxes", path = file.path(out, "boxes.parquet"), format = "parquet"),
                   list(key = "images", path = file.path(out, "images.parquet"), format = "parquet"))
))
Python

7 objects outlined in 3 of 5 images, covering 42.4% of an image on average; most common: spoon (2).

Objects
7
Images
5
Classes found
6
Share covered
42.4%

To keep this page light, the plots are shown once, under the R tab.

Assumptions

  • COCO's 80 classes — Only COCO's everyday classes (people, vehicles, animals, household objects) can be found; anything else is missed or given the nearest class.
  • Score threshold — Objects scored below 0.5 are dropped. Lower it to find more objects (and more false ones).
  • Masks at 28 × 28 — Each mask is predicted on a 28 × 28 grid inside its box and enlarged; a pixel is inside when its probability is above 0.5.
  • Photos like COCO's — The model learned from everyday photos; drawings, microscopy, aerial or medical images need a model trained on them.
  • People in images — 1 images show people. Treat them as personal data; results stay on this computer.

Objects by class

ClassObjectsImagesMean scoreHighest score
spoon210.83440.9988
cat110.99680.9968
cell phone110.56280.5628
cup110.99780.9978
dining table110.95670.9567
person110.99870.9987

Objects per image

RowFileObjectsClassesShare covered
1cat.png1cat77.4%
2cup.png4spoon × 2, cup, dining table93.6%
3astronaut.png2cell phone, person40.8%
4shapes.png00.0%
5flat.png00.0%
  • 1 rows have no path and are left out.
  • 1 files could not be decoded and are left out.
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Instance segmentation (Mask R-CNN, COCO)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method segment.instances 1.0.1 · spec 66718d969bbc93ff
# Dataset: img3_photos (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import os

import numpy as np
import pandas as pd

import codesplash as cs
from codesplash import media as cs_media
from codesplash import ml as csml
from codesplash.deep import core as cs_core
from codesplash.deep import profile as cs_profile
from codesplash.vision import boxes as vbox
from codesplash.vision import detect as vdet

ARCH = "maskrcnn_resnet50_fpn_v2"
# %% Images listed in the path column
PATH = "path"
df = pd.read_parquet("tests/parity/fixtures/img3_photos.parquet", columns=[PATH])
if not len(df):
    cs.cs_error("CS_E_NO_ROWS")
warnings = []
# %% Media files (image column path)
# In the app the files were decoded once into float32 arrays (media.json in the run folder). Elsewhere they are
# decoded here the same way: PNG and WAV give the app's values; JPEG, MP3 and other lossy files can differ slightly.
import json as _media_json
from codesplash import media as cs_media
media = cs_media.setup(_media_json.loads("{\"ids_column\":\"media_id\",\"kind\":\"image\",\"path_column\":\"path\",\"role\":\"image\",\"transform\":{\"filter\":\"triangle\",\"fit\":\"within\",\"mode\":\"rgb\",\"normalize\":\"none\",\"size\":[1333,1333]}}"), "target/academy-parity/run-8142/segment.instances/defaults_small/out-python", df, "tests/parity/fixtures/img3_photos.parquet")
media_ids = cs_media.ids_of(media, df)


def _text(v):
    return None if pd.isna(v) else str(v)  # None, NaN, pd.NA


has_id = [k for k, m in enumerate(media_ids) if m is not None and _text(df[PATH].iloc[k]) not in (None, "")]
if not has_id:
    cs.cs_error("CS_E_ALL_MISSING", column=PATH)
_status = cs_media.status(media, [media_ids[k] for k in has_id])
ok = [k for k, s in zip(has_id, _status) if s is None]
n_no_path = len(df) - len(has_id)
n_unreadable = len(has_id) - len(ok)
if not ok:
    cs.cs_error("CS_E_INVALID_VALUES", column=PATH, requirement="an image file that can be decoded", count=len(has_id))
if n_no_path:
    warnings.append(f"{n_no_path} rows have no path and are left out.")
if n_unreadable:
    warnings.append(f"{n_unreadable} files could not be decoded and are left out.")
items = [{"media_id": media_ids[k], "file": os.path.basename(str(df[PATH].iloc[k])), "row": k} for k in ok]


def load_image(mid):
    """One decoded image (3, h, w) on 0–1 and its size before decoding (orientation applied)."""
    return cs_media.load(media, [mid])[0], tuple(cs_media.source_size(media, [mid])[0])


# %% Pretrained model and compute profile
cs_profile.configure({"profile": "parity"})
cs_core.torch_init()
model = vdet.load(ARCH, dtype=cs_profile.current().dtype)

# %% Outline objects (torchvision Mask R-CNN on the converted COCO weights; a pixel is inside when p > 0.5)
SCORE = 0.5
MIN_SIZE = 320
CLASSES = [] or None
run = vdet.detect_images(model, items, load_image, masks=True, min_size=MIN_SIZE, max_size=1333, score_threshold=SCORE,
                         nms_threshold=0.5, max_detections=100, classes=CLASSES)
table = run["table"]
s = vdet.summarize(table, run["images"])
values = {"n_rows": len(df), "n_no_path": n_no_path, "n_unreadable": n_unreadable, **s["values"],
          "model": vdet.MODELS[ARCH]["label"], "min_size": MIN_SIZE, "score_threshold": SCORE}

# %% Artifacts: the boxes and masks table (one row per object, masks as COCO RLE) and one row per image
out = csml.out_dir("target/academy-parity/run-8142/segment.instances/defaults_small/out-python")
vbox.write(table, os.path.join(out, "boxes.parquet"))
per = pd.DataFrame([{"row": r["row"] + 1, "media_id": r["media_id"], "file": r["file"], "width": r["width"],
                     "height": r["height"], "objects": r["objects"], "covered": r["covered"]} for r in run["images"]],
                   columns=["row", "media_id", "file", "width", "height", "objects", "covered"])
per.to_parquet(os.path.join(out, "images.parquet"), index=False)

# %% Result
ov = vdet.overlay_columns(table, run["images"])
charts = [cs.chart("overlay", "image-overlay", "Object masks", {
    "image": cs.col("Image", ov["image"], "categorical"),
    "media_id": cs.col("Media id", ov["media_id"], "categorical"),
    "x0": cs.col("x0", ov["x0"], "numeric"), "y0": cs.col("y0", ov["y0"], "numeric"),
    "x1": cs.col("x1", ov["x1"], "numeric"), "y1": cs.col("y1", ov["y1"], "numeric"),
    "label": cs.col("Class", ov["label"], "categorical"),
    "score": cs.col("Score", ov["score"], "numeric"),
    "mask": cs.col("Mask (COCO RLE)", ov["mask"], "categorical"),
    "width": cs.col("Width (px)", ov["width"], "numeric"), "height": cs.col("Height (px)", ov["height"], "numeric"),
}, controls={"threshold": SCORE})]
if len(table):
    charts.append(cs.chart("classes", "bar", "Objects by class", {
        "x": cs.col("Class", [str(v) for v in table["label"].tolist()], "categorical", s["order"])}))
assumptions = [
    {"key": "coco_classes", "label": "COCO's 80 classes", "status": "info",
     "detail": "Only COCO's everyday classes (people, vehicles, animals, household objects) can be found; anything else is missed or given the nearest class."},
    {"key": "threshold", "label": "Score threshold", "status": "info",
     "detail": f"Objects scored below {SCORE:g} are dropped. Lower it to find more objects (and more false ones)."},
    {"key": "mask_resolution", "label": "Masks at 28 × 28", "status": "info",
     "detail": "Each mask is predicted on a 28 × 28 grid inside its box and enlarged; a pixel is inside when its probability is above 0.5."},
    {"key": "domain", "label": "Photos like COCO's", "status": "info",
     "detail": "The model learned from everyday photos; drawings, microscopy, aerial or medical images need a model trained on them."},
    {"key": "people", "label": "People in images", "status": "warn" if values.get("n[person]", 0) else "pass",
     "detail": f"{values.get('images[person]', 0)} images show people. Treat them as personal data; results stay on this computer." if values.get("n[person]", 0) else "No person was detected."},
] + cs_profile.warning_rows()
image_cols = [{"key": "row", "label": "Row", "type": "integer"}, {"key": "file", "label": "File"},
              {"key": "objects", "label": "Objects", "type": "integer"}, {"key": "classes", "label": "Classes"},
              {"key": "covered", "label": "Share covered", "type": "percent"}]
class_cols = [{"key": "class", "label": "Class"}, {"key": "objects", "label": "Objects", "type": "integer"},
              {"key": "images", "label": "Images", "type": "integer"}, {"key": "mean_score", "label": "Mean score", "type": "number"},
              {"key": "max_score", "label": "Highest score", "type": "number"}]
cs.publish({
    "title": "Instance segmentation (Mask R-CNN, COCO)",
    "engine": cs.engine_info("torch", "torchvision", "numpy", "pandas"),
    "n": values["n_images"],
    "summary": f"{values['n_objects']} objects outlined in {values['n_images_with_objects']} of {values['n_images']} images, covering {values['covered_mean'] * 100:.1f}% of an image on average"
               + (f"; most common: {s['order'][0]} ({values['n[' + s['order'][0] + ']']})." if s["order"] else "."),
    "statistics": [
        {"key": "n_objects", "label": "Objects", "value": values["n_objects"], "format": "integer"},
        {"key": "n_images", "label": "Images", "value": values["n_images"], "format": "integer"},
        {"key": "n_classes", "label": "Classes found", "value": values["n_classes"], "format": "integer"},
        {"key": "covered_mean", "label": "Share covered", "value": values["covered_mean"], "format": "percent"},
    ],
    "tables": [
        {"key": "classes", "title": "Objects by class", "columns": class_cols, "rows": s["classes"]},
        {"key": "images", "title": "Objects per image", "columns": image_cols, "rows": s["images"][:200]},
    ],
    "assumptions": assumptions,
    "charts": charts,
    "values": values,
    "warnings": warnings,
    "artifacts": [{"key": "boxes", "path": os.path.join(out, "boxes.parquet"), "format": "parquet"},
                  {"key": "images", "path": os.path.join(out, "images.parquet"), "format": "parquet"}],
})

Each mask is stored as COCO run-length encodingCOCO run-length encoding (RLE)A compact text form of a mask: lengths of alternating runs of outside and inside pixels, column by column, as COCO stores them.: lengths of alternating runs of outside and inside pixels, column by column. It is compact, exact, and readable by pycocotools.

06

A class for every pixel

In the app

Semantic segmentationSemantic segmentationGiving every pixel a class (person, cat, sofa…) or background; objects of one class merge into one region. gives every pixel one of the 20 Pascal VOC classesPascal VOC classesThe 20 classes of the Pascal VOC benchmark (person, animals, vehicles, bottle, chair, dining table, sofa, TV) plus background. or background. Two cats side by side become one cat region, so it measures area, not counts. In these images background covers 55.9% of the pixels on average, and the cat covers 15.9% averaged over all images: its pixel sharePixel shareThe share of an image's pixels given to a class (or to background), averaged over the images..

Semantic segmentation (DeepLabV3, 20 classes)Recorded · Python and R agreeRecorded 2026-11-25 · 29 values compared
R

3 classes found in 3 of 5 images; background covers 55.9% of an image on average.

Images
5
Classes found
3
Regions
3
Background
55.9%

Plots

Class masksWhat did the detector or segmenter find in each image, and where exactly?
View data
Height (px)ImageClassMask (COCO RLE)Media idMean confidenceWidth (px)x0x1y0y1
160cat.pngcatQ2o2Q200000O100O1O1O1O1N2O1M3N2YOg0H8N2K5LThg0IWXXO1O0000000000O]V1NbiN9I3N3L4M2L5L3XN]OnNg0o0AgNe0V1@`Ng0]1a1M2M4^NQMm0b3N3L3N3J7J;G2M3MSk40eaeb6793ad08de630a090bbf7b187aa30acbc292e63d298d3ff0338cec02a500.966424002090160
160cup.pngdiningtableW1i3W100000O1O10000O1O100O100O1O100O1O100O100O1O1O1O1O100O1O100N200O100N200O1O100O1O1O1O100O1O100O1O1O1O100O10PRm00f2f46f52111cb7dc1a71df8df67fa7af376bf66c5304888c767b881a4c9c6a60.941324002400160
192astronaut.pngpersoniR14c0O\4T1H3L4B?I8I4K5O1N2M3O1N2M300N2O1N2O1M3O1N2N2O100N2O100O1O100O1O1O1O100N2O1N2O1N2O1N2N2N200N2O100O100O1QOQLLP41ULMk31ZLLf32^LLb32aLM_33bLL^33eLJ\35fLI[36hLGY39W100O1O1O100O1O100O1000000O100000000O100000000001O0000001O0000001O1hKO_21aM0^21`M1_2O_M5_2K_M7a2J]M8b2I[M:d2GZM:f2FZM;e2HVM<h2DWM>h2DUM>j2EPM`0n2DlL?S3EfL`0X3X1L1O2N1SOXM`Nh2^1[MaNf2\1\MdNd2Y1bMRNF;i2`1lMZNX2d1S1M4N2M3L4M4M3L3N3N3J5N2M5J3N2M]P:f37291cf2c47100683468e90bd3810c1f03d64d8eb9c51f8972c9160a9de5d220.939219251387192
150shapes.png——fb6409af86ab2ef69eff6ef058e1227929f5a75ad407435a729a370097b2578c—200————
48flat.png——81d0ef9f87003b2a8f4726bd99d84744e070a37fc2ba0a63f1537fd951587a11—64————
Images showing each classHow often does each category occur?
View data
Class
cat
diningtable
person

Assumptions

  • 20 Pascal VOC classes — Pixels of anything outside the 20 classes become background or the nearest class.
  • One class per pixel — Overlapping objects of the same class merge into one region; use instance segmentation to count objects.
  • Labeled at the segmentation size — Classes are decided with the short side at 256 px and enlarged to each image by nearest neighbor.
  • Photos like COCO's — The model learned from everyday photos; other kinds of images need a model trained on them.

Classes

ClassImagesMean share of pixelsMean confidence
cat115.9%0.9664
diningtable119.4%0.9413
person18.8%0.9392

Classes per image

RowFileRegionsClassesBackground
1cat.png1cat20.3%
2cup.png1diningtable3.2%
3astronaut.png1person55.9%
4shapes.png0100.0%
5flat.png0100.0%
  • 1 rows have no path and are left out.
  • 1 files could not be decoded and are left out.
The exact R script · R R version 4.5.1 (2025-06-13)
# Semantic segmentation (DeepLabV3, 20 classes)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method segment.semantic 1.0.0 · spec fd2703dc572f68f7
# Dataset: img3_photos (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.

# %% Setup
library(codesplashr)

ARCH <- "deeplabv3_resnet50"
# %% Images listed in the path column
PATH <- "path"
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/img3_photos.parquet", col_select = PATH))
if (!nrow(df)) cs_error("CS_E_NO_ROWS")
warnings <- character(0)
# %% Media files (image column path)
# In the app the files were decoded once into float32 arrays (media.json in the run folder). Elsewhere they are
# decoded here the same way: PNG and WAV give the app's values; JPEG, MP3 and other lossy files can differ slightly.
media <- cs_media_setup(jsonlite::fromJSON("{\"ids_column\":\"media_id\",\"kind\":\"image\",\"path_column\":\"path\",\"role\":\"image\",\"transform\":{\"filter\":\"triangle\",\"fit\":\"within\",\"mode\":\"rgb\",\"normalize\":\"none\",\"size\":[1333,1333]}}", simplifyVector = FALSE), "target/academy-parity/run-8142/segment.semantic/defaults_small/out-r", df,
                        "tests/parity/fixtures/img3_photos.parquet")
media_ids <- cs_media_ids(media, df)

text_ <- function(v) { v <- as.character(v); v[!is.na(v) & !nzchar(v)] <- NA_character_; v }
paths_ <- text_(df[[PATH]])
has_id <- which(!is.na(media_ids) & !is.na(paths_))
if (!length(has_id)) cs_error("CS_E_ALL_MISSING", column = PATH)
status_ <- cs_media_status(media, media_ids[has_id])
ok <- has_id[is.na(status_)]
n_no_path <- nrow(df) - length(has_id)
n_unreadable <- length(has_id) - length(ok)
if (!length(ok)) cs_error("CS_E_INVALID_VALUES", column = PATH, requirement = "an image file that can be decoded", count = length(has_id))
if (n_no_path) warnings <- c(warnings, sprintf("%d rows have no path and are left out.", n_no_path))
if (n_unreadable) warnings <- c(warnings, sprintf("%d files could not be decoded and are left out.", n_unreadable))
items <- lapply(ok, function(k) list(media_id = media_ids[k], file = basename(paths_[k]), row = k - 1L))

# One decoded image (3, h, w) on 0-1 and its size before decoding (orientation applied).
load_image <- function(mid) {
  a <- cs_media_load(media, mid)
  list(image = array(a, dim = dim(a)[-1]), size = cs_media_source_size(media, mid)[[1]])
}

# %% Pretrained model and compute profile
cs_deep_profile_configure(list(profile = "parity"))
cs_deep_torch()
model <- cs_vis_load(ARCH, dtype = cs_deep_profile_current()$dtype)

# %% Label every pixel (torchvision DeepLabV3 on the converted weights, 20 Pascal VOC classes)
SIZE <- 256
CLASSES <- unlist(c())
run <- cs_vis_segment_images(model, items, load_image, size = SIZE, classes = CLASSES, min_share = 0)
table <- run$table
s <- cs_vis_summarize(table, run$images, semantic = TRUE)
values <- c(list(n_rows = nrow(df), n_no_path = n_no_path, n_unreadable = n_unreadable), s$values,
            list(model = cs_vis_model_info(ARCH)$label, size = SIZE))

# %% Artifacts: one row per image and class (mask as COCO RLE) and one row per image
out <- cs_ml_out_dir("target/academy-parity/run-8142/segment.semantic/defaults_small/out-r")
cs_boxes_write(table, file.path(out, "boxes.parquet"))
per <- data.frame(row = vapply(run$images, function(r) r$row + 1L, 0L),
                  media_id = vapply(run$images, function(r) r$media_id, ""),
                  file = vapply(run$images, function(r) r$file, ""),
                  width = vapply(run$images, function(r) r$width, 0L),
                  height = vapply(run$images, function(r) r$height, 0L),
                  regions = vapply(run$images, function(r) as.integer(r$objects), 0L),
                  background = vapply(run$images, function(r) r$background, 0), stringsAsFactors = FALSE)
nanoparquet::write_parquet(per, file.path(out, "images.parquet"))

# %% Result
ov <- cs_vis_overlay_columns(table, run$images)
charts <- list(cs_chart("overlay", "image-overlay", "Class masks", list(
  image = cs_col("Image", ov$image, "categorical"),
  media_id = cs_col("Media id", ov$media_id, "categorical"),
  x0 = cs_col("x0", ov$x0, "numeric"), y0 = cs_col("y0", ov$y0, "numeric"),
  x1 = cs_col("x1", ov$x1, "numeric"), y1 = cs_col("y1", ov$y1, "numeric"),
  label = cs_col("Class", ov$label, "categorical"),
  score = cs_col("Mean confidence", ov$score, "numeric"),
  mask = cs_col("Mask (COCO RLE)", ov$mask, "categorical"),
  width = cs_col("Width (px)", ov$width, "numeric"), height = cs_col("Height (px)", ov$height, "numeric")
), controls = list(boxes = FALSE)))
if (nrow(table)) {
  charts[[length(charts) + 1L]] <- cs_chart("classes", "bar", "Images showing each class", list(
    x = cs_col("Class", as.character(table$label), "categorical", s$order)))
}
assumptions <- c(list(
  list(key = "voc_classes", label = "20 Pascal VOC classes", status = "info",
       detail = "Pixels of anything outside the 20 classes become background or the nearest class."),
  list(key = "one_label", label = "One class per pixel", status = "info",
       detail = "Overlapping objects of the same class merge into one region; use instance segmentation to count objects."),
  list(key = "resolution", label = "Labeled at the segmentation size", status = "info",
       detail = sprintf("Classes are decided with the short side at %d px and enlarged to each image by nearest neighbor.", as.integer(SIZE))),
  list(key = "domain", label = "Photos like COCO's", status = "info",
       detail = "The model learned from everyday photos; other kinds of images need a model trained on them.")
), cs_deep_profile_warning_rows())
image_cols <- list(list(key = "row", label = "Row", type = "integer"), list(key = "file", label = "File"),
                   list(key = "objects", label = "Regions", type = "integer"), list(key = "classes", label = "Classes"),
                   list(key = "background", label = "Background", type = "percent"))
class_cols <- list(list(key = "class", label = "Class"), list(key = "images", label = "Images", type = "integer"),
                   list(key = "pixel_share", label = "Mean share of pixels", type = "percent"),
                   list(key = "mean_score", label = "Mean confidence", type = "number"))
cs_publish(list(
  title = "Semantic segmentation (DeepLabV3, 20 classes)",
  engine = cs_engine_info("torch", "torchvision", "safetensors", "nanoparquet", "codesplashr"),
  n = values$n_images,
  summary = sprintf("%d classes found in %d of %d images; background covers %.1f%% of an image on average.",
                    values$n_classes, values$n_images_with_objects, values$n_images, values$background_mean * 100),
  statistics = list(
    list(key = "n_images", label = "Images", value = values$n_images, format = "integer"),
    list(key = "n_classes", label = "Classes found", value = values$n_classes, format = "integer"),
    list(key = "n_objects", label = "Regions", value = values$n_objects, format = "integer"),
    list(key = "background_mean", label = "Background", value = values$background_mean, format = "percent")
  ),
  tables = list(
    list(key = "classes", title = "Classes", columns = class_cols, rows = s$classes),
    list(key = "images", title = "Classes per image", columns = image_cols, rows = s$images[seq_len(min(200L, length(s$images)))])
  ),
  assumptions = assumptions,
  charts = charts,
  values = values,
  warnings = as.list(warnings),
  artifacts = list(list(key = "boxes", path = file.path(out, "boxes.parquet"), format = "parquet"),
                   list(key = "images", path = file.path(out, "images.parquet"), format = "parquet"))
))
Python

3 classes found in 3 of 5 images; background covers 55.9% of an image on average.

Images
5
Classes found
3
Regions
3
Background
55.9%

To keep this page light, the plots are shown once, under the R tab.

Assumptions

  • 20 Pascal VOC classes — Pixels of anything outside the 20 classes become background or the nearest class.
  • One class per pixel — Overlapping objects of the same class merge into one region; use instance segmentation to count objects.
  • Labeled at the segmentation size — Classes are decided with the short side at 256 px and enlarged to each image by nearest neighbor.
  • Photos like COCO's — The model learned from everyday photos; other kinds of images need a model trained on them.

Classes

ClassImagesMean share of pixelsMean confidence
cat115.9%0.9664
diningtable119.4%0.9413
person18.8%0.9392

Classes per image

RowFileRegionsClassesBackground
1cat.png1cat20.3%
2cup.png1diningtable3.2%
3astronaut.png1person55.9%
4shapes.png0100.0%
5flat.png0100.0%
  • 1 rows have no path and are left out.
  • 1 files could not be decoded and are left out.
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Semantic segmentation (DeepLabV3, 20 classes)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method segment.semantic 1.0.0 · spec fd2703dc572f68f7
# Dataset: img3_photos (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import os

import numpy as np
import pandas as pd

import codesplash as cs
from codesplash import media as cs_media
from codesplash import ml as csml
from codesplash.deep import core as cs_core
from codesplash.deep import profile as cs_profile
from codesplash.vision import boxes as vbox
from codesplash.vision import detect as vdet

ARCH = "deeplabv3_resnet50"
# %% Images listed in the path column
PATH = "path"
df = pd.read_parquet("tests/parity/fixtures/img3_photos.parquet", columns=[PATH])
if not len(df):
    cs.cs_error("CS_E_NO_ROWS")
warnings = []
# %% Media files (image column path)
# In the app the files were decoded once into float32 arrays (media.json in the run folder). Elsewhere they are
# decoded here the same way: PNG and WAV give the app's values; JPEG, MP3 and other lossy files can differ slightly.
import json as _media_json
from codesplash import media as cs_media
media = cs_media.setup(_media_json.loads("{\"ids_column\":\"media_id\",\"kind\":\"image\",\"path_column\":\"path\",\"role\":\"image\",\"transform\":{\"filter\":\"triangle\",\"fit\":\"within\",\"mode\":\"rgb\",\"normalize\":\"none\",\"size\":[1333,1333]}}"), "target/academy-parity/run-8142/segment.semantic/defaults_small/out-python", df, "tests/parity/fixtures/img3_photos.parquet")
media_ids = cs_media.ids_of(media, df)


def _text(v):
    return None if pd.isna(v) else str(v)  # None, NaN, pd.NA


has_id = [k for k, m in enumerate(media_ids) if m is not None and _text(df[PATH].iloc[k]) not in (None, "")]
if not has_id:
    cs.cs_error("CS_E_ALL_MISSING", column=PATH)
_status = cs_media.status(media, [media_ids[k] for k in has_id])
ok = [k for k, s in zip(has_id, _status) if s is None]
n_no_path = len(df) - len(has_id)
n_unreadable = len(has_id) - len(ok)
if not ok:
    cs.cs_error("CS_E_INVALID_VALUES", column=PATH, requirement="an image file that can be decoded", count=len(has_id))
if n_no_path:
    warnings.append(f"{n_no_path} rows have no path and are left out.")
if n_unreadable:
    warnings.append(f"{n_unreadable} files could not be decoded and are left out.")
items = [{"media_id": media_ids[k], "file": os.path.basename(str(df[PATH].iloc[k])), "row": k} for k in ok]


def load_image(mid):
    """One decoded image (3, h, w) on 0–1 and its size before decoding (orientation applied)."""
    return cs_media.load(media, [mid])[0], tuple(cs_media.source_size(media, [mid])[0])


# %% Pretrained model and compute profile
cs_profile.configure({"profile": "parity"})
cs_core.torch_init()
model = vdet.load(ARCH, dtype=cs_profile.current().dtype)

# %% Label every pixel (torchvision DeepLabV3 on the converted weights, 20 Pascal VOC classes)
SIZE = 256
CLASSES = [] or None
run = vdet.segment_images(model, items, load_image, size=SIZE, classes=CLASSES, min_share=0)
table = run["table"]
s = vdet.summarize(table, run["images"], semantic=True)
values = {"n_rows": len(df), "n_no_path": n_no_path, "n_unreadable": n_unreadable, **s["values"],
          "model": vdet.MODELS[ARCH]["label"], "size": SIZE}

# %% Artifacts: one row per image and class (mask as COCO RLE) and one row per image
out = csml.out_dir("target/academy-parity/run-8142/segment.semantic/defaults_small/out-python")
vbox.write(table, os.path.join(out, "boxes.parquet"))
per = pd.DataFrame([{"row": r["row"] + 1, "media_id": r["media_id"], "file": r["file"], "width": r["width"],
                     "height": r["height"], "regions": r["objects"], "background": r["background"]} for r in run["images"]],
                   columns=["row", "media_id", "file", "width", "height", "regions", "background"])
per.to_parquet(os.path.join(out, "images.parquet"), index=False)

# %% Result
ov = vdet.overlay_columns(table, run["images"])
charts = [cs.chart("overlay", "image-overlay", "Class masks", {
    "image": cs.col("Image", ov["image"], "categorical"),
    "media_id": cs.col("Media id", ov["media_id"], "categorical"),
    "x0": cs.col("x0", ov["x0"], "numeric"), "y0": cs.col("y0", ov["y0"], "numeric"),
    "x1": cs.col("x1", ov["x1"], "numeric"), "y1": cs.col("y1", ov["y1"], "numeric"),
    "label": cs.col("Class", ov["label"], "categorical"),
    "score": cs.col("Mean confidence", ov["score"], "numeric"),
    "mask": cs.col("Mask (COCO RLE)", ov["mask"], "categorical"),
    "width": cs.col("Width (px)", ov["width"], "numeric"), "height": cs.col("Height (px)", ov["height"], "numeric"),
}, controls={"boxes": False})]
if len(table):
    charts.append(cs.chart("classes", "bar", "Images showing each class", {
        "x": cs.col("Class", [str(v) for v in table["label"].tolist()], "categorical", s["order"])}))
assumptions = [
    {"key": "voc_classes", "label": "20 Pascal VOC classes", "status": "info",
     "detail": "Pixels of anything outside the 20 classes become background or the nearest class."},
    {"key": "one_label", "label": "One class per pixel", "status": "info",
     "detail": "Overlapping objects of the same class merge into one region; use instance segmentation to count objects."},
    {"key": "resolution", "label": "Labeled at the segmentation size", "status": "info",
     "detail": f"Classes are decided with the short side at {SIZE} px and enlarged to each image by nearest neighbor."},
    {"key": "domain", "label": "Photos like COCO's", "status": "info",
     "detail": "The model learned from everyday photos; other kinds of images need a model trained on them."},
] + cs_profile.warning_rows()
image_cols = [{"key": "row", "label": "Row", "type": "integer"}, {"key": "file", "label": "File"},
              {"key": "objects", "label": "Regions", "type": "integer"}, {"key": "classes", "label": "Classes"},
              {"key": "background", "label": "Background", "type": "percent"}]
class_cols = [{"key": "class", "label": "Class"}, {"key": "images", "label": "Images", "type": "integer"},
              {"key": "pixel_share", "label": "Mean share of pixels", "type": "percent"},
              {"key": "mean_score", "label": "Mean confidence", "type": "number"}]
cs.publish({
    "title": "Semantic segmentation (DeepLabV3, 20 classes)",
    "engine": cs.engine_info("torch", "torchvision", "numpy", "pandas"),
    "n": values["n_images"],
    "summary": f"{values['n_classes']} classes found in {values['n_images_with_objects']} of {values['n_images']} images; "
               f"background covers {values['background_mean'] * 100:.1f}% of an image on average.",
    "statistics": [
        {"key": "n_images", "label": "Images", "value": values["n_images"], "format": "integer"},
        {"key": "n_classes", "label": "Classes found", "value": values["n_classes"], "format": "integer"},
        {"key": "n_objects", "label": "Regions", "value": values["n_objects"], "format": "integer"},
        {"key": "background_mean", "label": "Background", "value": values["background_mean"], "format": "percent"},
    ],
    "tables": [
        {"key": "classes", "title": "Classes", "columns": class_cols, "rows": s["classes"]},
        {"key": "images", "title": "Classes per image", "columns": image_cols, "rows": s["images"][:200]},
    ],
    "assumptions": assumptions,
    "charts": charts,
    "values": values,
    "warnings": warnings,
    "artifacts": [{"key": "boxes", "path": os.path.join(out, "boxes.parquet"), "format": "parquet"},
                  {"key": "images", "path": os.path.join(out, "images.parquet"), "format": "parquet"}],
})
07

The boxes and masks table

Read

All three methods save the same boxes and masks tableBoxes and masks tableOne row per object: image id, box corners in pixels, class, score, mask (COCO RLE), area and source (annotation or prediction).: one row per object or region, with the image's id, the box corners in the original image's pixels, the class, the score and the mask. Save it as a dataset to count objects per image, compare groups of images, or score the predictions against your own annotations with Evaluate detections.

08

Check your understanding

Checkpoint

Check yourself

You lower the score threshold from 0.5 to 0.2. What happens to the boxes?

Show the answer

Answer: a

The threshold only decides which candidates are kept. Lowering it keeps the less certain ones, which include missed objects and mistakes.

Check yourself

Your photos show welding seams. The detector finds nothing, or calls a seam a "knife". Why?

Show the answer

Answer: a

A pretrained COCO detector only knows its 80 classes. Other objects need a model trained on labeled examples of them.

Check yourself

You need the area of each cell in a microscope-like image, not just where it is. Which output gives it?

Show the answer

Answer: a

A box includes background around the object; the mask's pixel count is the object's own area. (For real microscopy you'd also need a model trained on cells.)

Check yourself

A COCO RLE mask string arrives without the image's width and height. What can you still do with it?

Show the answer

Answer: a

The runs say how many pixels are inside, so the area is known. Placing them needs the height, because runs go down each column; the table stores the size beside every mask.

Check yourself

You want to count people in each photo. Which method fits?

Show the answer

Answer: a

Semantic segmentation merges touching people into one region, so its regions are not people. Detection and instance segmentation return each person separately.

Check yourself

The average pixel share of "person" is 20% across your photos. What does that say?

Show the answer

Answer: a

A pixel share is about area: the share of pixels labeled with the class, averaged over the images. How many images show the class is a separate count.

09

Recap

Recap
  • Detection returns boxes, classes and scores; instance segmentation adds a pixel mask per object; semantic segmentation gives every pixel a class.
  • The pretrained models know COCO's 80 classes (DeepLabV3: 20 VOC classes); other objects need a trained model.
  • Scores rank confidence; the threshold trades misses against false alarms.
  • All three save one boxes and masks table (COCO RLE) to count, measure and evaluate.

Concepts in this lesson