ContentDetectorFunction

ContentDetectorFunction[]

represents a function generated by TrainImageContentDetector or TrainTextContentDetector that localizes and classifies contents in a piece of text or an image.

Details

  • Content detection, also known as entity tagging and object detection, is the process of finding and classifying subparts of images or text similar to those that the content detector was originally trained on.
  • ContentDetectorFunction[] is a function that can be applied to an image or a string and returns position, class and other classification properties of the detected contents.
  • ContentDetectorFunction[][expr] returns detected contents in expr.
  • ContentDetectorFunction[][{expr1,expr2,}] detects contents in all expri.
  • ContentDetectorFunction[][expr,prop] returns the specified property; available properties include:
  • "Class"the class of the detected object
    "Position"the position of the detected object
    "Probability"estimated probability that the detection is correct
    "Properties"a list of the available properties
    {prop1,}a list of property specifications
  • In addition, text detectors can return the following properties:
  • "HighlightedSnippet"a snippet with the detected string highlighted
    "Snippet"a snippet around the detected string
    "String"string of the identified text
  • Image detectors can return the following properties:
  • "BoundingBox"the subimage bounding box given as a Rectangle
    "Image"the identified subimage
  • ContentDetectorFunction[][expr,,opts] specifies that the detector should use the options opts when applied to expr.
  • The following options can be given:
  • AcceptanceThreshold Automaticidentification acceptance threshold
    TargetDevice"CPU"the target device on which to compute
  • Base on the detector type, other options might be available:
  • MaxFeaturesAutomaticmaximum number of contents to return
    MaxOverlapFractionAutomaticmaximum bounding box overlap

Examples

open allclose all

Basic Examples  (2)

Train a simple object detector on text tags:

Apply the detector on new texts:

Train an object detector that works on images:

Apply the detector on a new image:

Highlight the detection on the input image:

Options  (3)

AcceptanceThreshold  (1)

By default, the detected objects are automatically filtered by a probability threshold:

Use AcceptanceThresholdt to return only detections with strength greater than t:

Using a low threshold might give more low-quality detections:

MaxFeatures  (1)

By default, all the detections above the acceptance threshold are returned:

Use MaxFeaturesn to return only the n strongest detections:

MaxOverlapFraction  (1)

By default, the detections are returned regardless of their overlapping:

Find only non-overlapping objects:

Allow up to 10 percent of overlap:

Wolfram Research (2021), ContentDetectorFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/ContentDetectorFunction.html.

Text

Wolfram Research (2021), ContentDetectorFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/ContentDetectorFunction.html.

CMS

Wolfram Language. 2021. "ContentDetectorFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ContentDetectorFunction.html.

APA

Wolfram Language. (2021). ContentDetectorFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ContentDetectorFunction.html

BibTeX

@misc{reference.wolfram_2023_contentdetectorfunction, author="Wolfram Research", title="{ContentDetectorFunction}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/ContentDetectorFunction.html}", note=[Accessed: 19-April-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_contentdetectorfunction, organization={Wolfram Research}, title={ContentDetectorFunction}, year={2021}, url={https://reference.wolfram.com/language/ref/ContentDetectorFunction.html}, note=[Accessed: 19-April-2024 ]}