plugins.ai package

Modules to classify files using AI techniques

class plugins.ai.GenerateVideoSnapshots(config, section=None, local_config=None, from_module=None)

Bases: base.job.BaseModule

Generate snapshots for a video. These snapshots can be analysed later.

This module depends on the external programs fmpeg and mediainfo.

Module description:
  • path: Absolute path of the video file. If it is not absolute, assume it is relative to the casedir.

  • from_module: ignored

  • **yields*: {path (relative to casedir), preview=[list of paths relative to casedir]}

Configuration:
  • outdir: the output directory for the snapshots.

read_config()

Read options from the configuration section.

This method should set default values for all available configuration options. The other module function will safely assume these options have correct values.

run(path)

Run the job on a path

Parameters

path (str) – the path to check.

Yields

If any, an iterable of elements with the output.

class plugins.ai.NudeNetClassify(config, section=None, local_config=None, from_module=None)

Bases: base.job.BaseModule

Classify an image using a NudeNet and a classifier model.

Module description:
  • path: A path to an image, either relative to casedir or absolute

  • from_module: ignored

  • **yields*: {path:relative_to_casedir, aiclassify{classifier, results{safe, unsafe}, is_nude}, preview}

Configuration:
  • model: absolute path to the classifier model. Read INSTALL.md.

  • threshold: thresshold to consider a class as matched. Default 0.5.

read_config()

Read options from the configuration section.

This method should set default values for all available configuration options. The other module function will safely assume these options have correct values.

run(path)

Classify an image using NudeNet.

class plugins.ai.NudeNetClassifyVideo(config, section=None, local_config=None, from_module=None)

Bases: plugins.ai.NudeNetClassify

Classify an image using a NudeNet and a classifier model.

Module description:
  • path: A path to a video, either relative to casedir or absolute

  • from_module: a module chain containing aiclassify.GenerateVideoSnapshots: preview must be defined.

  • **yields*: {path:relative_to_casedir, aiclassify{classifier, results{safe, unsafe}, is_nude}, preview}.

    Results is the result of the image with a larger unsafe percentage.

Configuration:
  • model: absolute path to the classifier model. Read INSTALL.md.

  • threshold: thresshold to consider a class as matched. Default 0.5.

  • threshold_preview: The percentage of preview images that must be classified as nude to classify as nude. 0 means “any”

read_config()

Read options from the configuration section.

This method should set default values for all available configuration options. The other module function will safely assume these options have correct values.

run(path)

Classify a video using NudeNet.

plugins.ai.load_plugin(config)

Submodules

plugins.ai.classify module