Concepts / Flags
Concepts

Flags

The categories a Detectivision moderation check looks for, such as hate, insults, sexual content and scams, and how to get your account's own list.

On this page

A flag is a category a check looks for. Results list the flags raised in flags, and every flag that was looked for in checked. Use the flag keys in your code; a flag keeps its key.

Your flags#

There is no fixed list of flags. They depend on your plan, some are set up for one account only, and they change as models are added and updated. So these pages do not list them: ask the API.

curl https://api.detectivision.ai/api/v1/flags \
  -H "Api-Key: $DETECTIVISION_API_KEY"

The answer has, per moderation type, every flag your account may send, with its name and whether it can be checked right now. For example:

{
  "text_moderation": [
    { "key": "hate", "name": "Hate", "available": true },
    { "key": "insult", "name": "Insult", "available": true }
  ],
  "image_moderation": [{ "key": "scam", "name": "Scam", "available": true }]
}
  • Read it, don't copy it. Fetch the list when your app starts, or keep it for a while, rather than writing flag keys into your code. A change shows in it at once.
  • Types. A type your account cannot use is left out.
  • Anything else is refused. A flag that is not in your list is refused with 400 invalid_flags before anything is charged, and the message names the flags you may send.
  • Without a key. The public status endpoint shows the flags the service offers on its plans, and whether each works right now. Your plan may not have all of them.
  • In the dashboard. The playground shows your flags for each type.

Choosing flags#

By default a check looks for every flag of its type. To look for some only, name them in flags, with keys from your list:

{
  "type": "text_moderation",
  "input": "a text to check",
  "flags": ["hate", "insult"]
}

Only those flags are checked, and only they appear in checked and flags. A flag you leave out is never reported: the models that feed none of your flags are not run at all, and a model that feeds some of yours and some others reports only yours. So a narrow request answers faster.

  • Price. It never goes up with fewer flags. capture and censor cost one credit more than detect only when one of your flags has positions (see below); if none of them has, they cost what detect costs. Text and image flags have no positions. See Credits.
  • Live sessions. They take flags when they start and keep them for every frame; the session shows them in flags (null means every flag).
  • Playground. Its categories set flags for you, and its Code view shows the same request with them.

Positions#

Note

Text and image flags judge the whole text or image: answers have no positions, and capture and censor return what detect returns, at the same price.

A flag with positions says where it was found: a box (bbox) in images, a box and a time in videos and streams, a span (start, end) in text. A flag that judges the content as a whole has no position. Marking (capture) and censoring (censor) can only show flags with positions; with the others they have nothing to show. See Modes and censoring.

How a flag is raised#

A flag is raised when the models find something in its category with enough confidence. Each flag has a threshold, 0.5 by default; findings below it are left out. The flag's confidence is the strongest finding's.

confidence is a score from 0 to 1, not a probability you can compare across flags. Start by acting on flagged and the flag keys, then tune: for example, send results with confidence between 0.5 and 0.7 to human review.

A flag can be briefly unavailable. Then a result says so: the flag is in unchecked, not missing silently, and the result's status is partial (and free). See Responses.

Model labels#

Each detection also has a label: the model's own name for what it saw, which can be more specific than its flag. For text and image flags it is the flag's own key. Labels are informational and may change when models are updated; build on flags.