AWS Rekognition Moderation
AWS Rekognition Moderation transformation allows users to check sensitive content in an image and detect content that is inappropriate, unwanted, or offensive. It uses machine learning algorithms to detect inappropriate or unwanted content in images, such as nudity, violence, or offensive language. The service can be used to automatically filter out such content from user-generated content or to ensure that an image uploaded to a platform complies with the platform's guidelines.
Installing the AWS Rekognition add-on is a must for using this transformation.
Params
Minimum Confidence (c
)
This parameter helps to determine the minimum level of confidence that AWS Rekognition Moderation
must have in its prediction before it considers an image inappropriate.
Available values are from 0
to 99
. The default value is 55
.
By default, the minimum confidence parameter is set to 55%
, which means that Rekognition will only flag an image as inappropriate if it is at least 55%
confident in its prediction.
However, this parameter can be adjusted by the user based on their specific needs. For example, if the user wants to be more conservative in their moderation, they may set a higher minimum confidence threshold (e.g. 80%
) to reduce the chances of false positives. Conversely, if the user wants to be more permissive, they may set a lower minimum confidence threshold (e.g. 30%
) to allow more content through.
Instead of getting the output in a traditional CDN URL, you will get a JSON output from the Context API while the CDN URL will return the original image without any modifications.
- Input Image
- Context API Response
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/middle-finger.jpeg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [],
filePath: "images/transformation/middle-finger.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/middle-finger.jpeg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [],
filePath: "images/transformation/middle-finger.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/middle-finger.jpeg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [],
"filePath": "images/transformation/middle-finger.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/middle-finger.jpeg
package main
import (
"fmt"
"github.com/pixelbin-dev/pixelbin-go/v2/sdk/utils/url"
)
func main() {
obj := map[string]interface{}{
"cloudName": "dummy-cloudname",
"zoneSlug": "FIDrmb",
"version": "v2",
"transformations": []map[string]interface{}{
},
"filePath": "images/transformation/middle-finger.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
"options": map[string]interface{}{},
}
urlstring, err := url.ObjToUrl(obj)
if err != nil {
fmt.Println(err)
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/middle-finger.jpeg
import com.pixelbin.url.UrlObj
import com.pixelbin.Utils
import com.pixelbin.transformation.TransformationObj
fun main(){
val obj = UrlObj(
cloudName = "dummy-cloudname",
zone = "FIDrmb",
version = "v2",
transformation = arrayListOf(
),
filePath = "images/transformation/middle-finger.jpeg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/middle-finger.jpeg
using System;
using System.Collections.Generic;
using System.IO;
using Pixelbin.Utils;
namespace ExampleNamespace
{
class ExampleClass
{
static void Main(string[] args)
{
UrlObj obj = new UrlObj(
version: "v2",
cloudName: "dummy-cloudname",
filePath: "images/transformation/middle-finger.jpeg",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/middle-finger.jpeg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
],
"filePath" => "images/transformation/middle-finger.jpeg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/middle-finger.jpeg
?>
The response for an API call with the above request body can look like this.
{
"ModerationLabels": [
{
"Confidence": 94.83995819091797,
"Name": "Middle Finger",
"ParentName": "Rude Gestures"
},
{
"Confidence": 94.83995819091797,
"Name": "Rude Gestures",
"ParentName": ""
}
]
}
The Context API Response tab includes a JSON object that contains the following information:
Property | Description |
---|---|
ModerationLabels | An array of moderation labels, where each label is represented by a JSON object. |
Name | A string value that represents the name of the moderation label detected in the image. |
Confidence | A float value between 0 and 100 represents the level of confidence that the label is present in the image. |
ParentName | A string value that represents the name of the parent moderation label, if any. |
Overall, the Context API Response
provides information about any inappropriate or unsafe content detected in the image, along with their confidence levels and any parent categories. This information can be used to determine whether the image is safe for viewing and take appropriate actions, such as flagging or removing the image.
To learn more about this transformation, click here.