sfw

sfw / VideoNudityDetection / 0.2.1

README.md

Table of Contents

Introduction

This algorithm detects partial and explicit nudity in videos.

It works by wrapping around the Video Metadata Extraction algorithm, and passes each frame of the source video into the Nudity Detection i2v algorithm, which detects if the video contains any nude scenes.

I/O

Input

{  
   "source":String,
   "section_settings":{  
      "minimum_duration":Float,
      "minimum_confidence":Float,
      "maximum_delta":Float
   },
   "timeout":Int,
   "fps":Float
}
  • source - (required) - The source input video file, can be a data uri (data://, s3://, dropbox://, etc) or http:// url.
  • section_settings - (optional) - The json object that defines sectioning parameters. if missing, leaves all sectioning parameters with default values.
  • minimum_duration - (optional) - Checks each section output for duration, if shorter than this parameter, it's removed from the output results, units are seconds. Defaults to 0.1
  • minimum_confidence - (optional) - Acts as a limiting threshold that removes sections that contain elements with confidence values lower than this minimum, ranges between 0 and 1. Defaults to 0.1
  • timeout - (optional) - If you change the timeout for any Video Nudity Detection api call from the default, please change this parameter to match. Defaults to 300
  • fps - (optional) - The frames per second you'd like to sample your video file with, a lower value means it'll process faster but with lower resolution, vice versa for a higher value. Defaults to 3.

Output

{
  "sections": [
    {
      "average_confidence": Float,
      "start_time": Float,
      "stop_time": Float
      },
    ...
  ]
}
  • sections - the main list of detected nude/not-nude sections.
  • average_confidence - the average confidence/accuracy that this section contains nudity.
  • start_time - the start time for this section, in seconds from the start of the video.
  • stop_time - the stop time for this section, in seconds from the start of the video.

Examples

Nudity Example (WARNING NSFW CONTENT)

{  
   "source":"data://sfw/test/accidentalNudity.webm",
   "section_settings":{  
      "minimum_confidence":0.3,
      "minimum_duration":0.005
   }
}
{  
   "sections":[  
      {  
         "average_confidence":1,
         "label":true,
         "start_time":6.218181818181817,
         "stop_time":6.545454545454545
      }
   ]
}

Non-nude Example

{  
   "source":"data://media/videos/game_of_thrones.mp4",
   "fps":6,
   "section_settings":{  
      "minimum_confidence":0.3
   }
}
{"sections":[]}