Implementation

This section only covers working with Image Moderation in the Catalyst console. Refer to the SDK and API documentation sections for implementing Image Moderation in your application’s code.

As mentioned earlier, you can access the code templates that will enable you to integrate Image Moderation in your Catalyst application from the console, and also test the feature by uploading images and obtaining the results.

Access Image Moderation

To access Image Moderation in your Catalyst console:

  1. Navigate to Zia Services in the left pane of the Catalyst console and click Image Moderation.
    image-moderation-updated

  2. Click Try a Demo in the Image Moderation feature page.
    catalyst_imgmod_index_page
    This will open the Image Moderation feature.
    catalyst_imgmod_test_page

Test Image Moderation in the Catalyst Console

You can test Image Moderation by either selecting a sample image from Catalyst or by uploading your own image.

To scan a sample image and view the result:

  1. Click Select a Sample Image in the box.
    catalyst_imgmod_sample

  2. Select an image from the samples provided.
    catalyst_imgmod_select_sample
    Image Moderation will scan the image for inappropriate content of all criteria in the advanced mode, and display the probability of each detected criteria as percentage values.
    catalyst_imgmod_sample_scanned
    The colors in the response bars indicate the safety of the image in the following way: red indicates that the image is unsafe to use, orange indicates that the image is partially safe to use, and green indicates that the image is safe to use.
    You can also view the complete JSON response, which includes the probability of each detected criteria, the prediction, and its confidence score. Click View Response to view the JSON response.
    catalyst_imgmod_sample_json
    You can refer to the API documentation to view a complete sample JSON response structure for each moderation mode.

To upload your own image and test Image Moderation:

  1. Click Upload under the Result section.
    catalyst_imgmod_upload
    If you’re opening Image Moderation after you have closed it, click Browse Files in this box.
    catalyst_imgmod_browse

  2. Upload a file from your local system.

Note: The file must be in ._jpg_/._jpeg_ or ._png_ format. The file size must not exceed 10 MB.

The console will scan the image for inappropriate content and display the results.
catalyst_imgmod_image_scanned
You can click View Photo to uncover the image.
catalyst_imgmod_image_uncovered
You can view the JSON response as well in the same way.
catalyst_imgmod_image_json

Access Code Templates for Image Moderation

You can implement Image Moderation in your Catalyst application using the code templates provided by Catalyst for Java, Node.js and Python platforms.

You can access them from the section below the test window. Click either the Java SDK or NodeJS SDK tab, and copy the code using the copy icon. You can paste this code in your web or Android application’s code wherever you require.

catalyst_imgmod_java

You can process the input file as a new File in Java. The ZCImageModerationOptions module enables you to set the moderation mode as BASIC, MODERATE, or ADVANCED using setAnalyseMode.

catalyst_imgmod_node

In Node.js, the imPromise object is used to hold the input image file and the moderation mode set for it. You can specify the mode as basic, moderate, or advanced to process the image in required mode.

catalyst_imgmod_python

In Python, you can provide a .jpg/.jpeg or .png file as the input to the open() method. This method returns the image file object as a response. In the zia.moderate_image method, you can pass the image file object,and set the moderation mode as BASIC, MODERATE, or ADVANCED optionally. The image is processed in the ADVANCED mode by default.

The response returns the probability of each criteria with their confidence scores, and the prediction of the image being safe_to_use or unsafe_to_use.

Last Updated 2023-08-25 16:55:27 +0530 +0530