The Image Recognition module searches for untagged images, recognizes and tags them via either a local pre-trained neural network or an external image recognition service. The module also provides the integration of the image recognition feature with content tags.

Module structure

artifactIDDescription

magnolia-image-recognition-parent

Parent reactor.

magnolia-content-tags-integration

Provides a functionality to integrate content tags and the image recognition service using decorations.

magnolia-image-recognition-api

Provides an API to recognize images.

magnolia-image-recognition

Provides the image recognition module and service.

magnolia-amazon-image-recognition

Provides a functionality to recognize images via Amazon Rekognition.

Installing

Maven is the easiest way to install the modules. Add the following  dependencies to your webapp. All the other necessary dependencies will be brought in automatically:

<dependency>
  <groupId>info.magnolia.ai.image</groupId>
  <artifactId>magnolia-image-recognition</artifactId>
  <version>1.2.5</version>
</dependency>

<dependency>
  <groupId>info.magnolia.ai.image</groupId>
  <artifactId>magnolia-content-tags-integration</artifactId>
  <version>1.2.5</version>
</dependency>

<dependency>
  <groupId>info.magnolia.ai.image</groupId>
  <artifactId>magnolia-image-recognition-api</artifactId>
  <version>1.2.5</version>
</dependency>

<dependency>
  <groupId>info.magnolia.ai.image</groupId>
  <artifactId>magnolia-amazon-image-recognition</artifactId>
  <version>1.2.5</version>
</dependency>

<dependency>
  <groupId>info.magnolia.ai.image</groupId>
  <artifactId>magnolia-local-image-recognition</artifactId>
  <version>1.2.5</version>
</dependency>

Pre-built jars are also available for download. See Installing a module for help.

Libraries for Amazon Rekognition

Your running instance should contain the latest version available of the following JARs:

Local image recognition

You can use the magnolia-local-image-recognition module, which provides a functionality to recognize images locally via a pre-trained neural network based on:

This is an independent module offered as an add-on for EE users.

artifactIDDescription

magnolia-local-image-recognition

Provides a functionality to recognize images locally via a pre-trained neural network.


Maven is the easiest way to install the module. Add the following dependency to your webapp. All the other necessary dependencies will be brought in automatically:

<dependency>
  <groupId>info.magnolia.ai.image</groupId>
  <artifactId>magnolia-local-image-recognition</artifactId>
  <version>1.2.5</version>
</dependency>

Pre-built jars are also available for download. See Installing a module for help.

Configuration

In the module configuration you can:

  • Specify which recognition service should be used.
  • Adjust the minConfidence property for the local recognition service
  • Fine-tune the performance of parallel image recognition.

Choosing a recognition service

In the configuration of the image-recognition you can define which recognition service should be used. Define the service as the value of the class property under the /modules/image-recognition/currentImageRecognitionService node:

PropertyDescription
class

required, default is info.magnolia.ai.image.NoopImageRecogniser

Specifies which service should be used for image recognition. The default value doesn't recognize images, it is just a placeholder.

Other values:

  • info.magnolia.ai.image.local.LocalImageRecogniser for Magnolia's own image recognition service, offered as an add-on.
  • info.magnolia.ai.image.amazon.AmazonImageRecogniser for Amazon Rekognition. See also the configuration options for this service.

Recognition confidence

For recognition confidence of the Amazon Rekognition service, see Image recognition via Amazon Rekognition: Configuration options.

For recognition confidence of the local image recognizer, set it with the minConfidence property under /modules/local-image-recognition/config.

PropertyDescription
minConfidence

optional, default is 30

The confidence score of recognition.

An integer value between 0-100. The filter drops the tags with confidence lower than the value of this property. Setting the value higher usually results in fewer image results, but a higher confidence that the image is recognized accurately.

Parallel recognition threads

Image recognition can be a very intensive process in terms of CPU resources. One of the functions of our implementation of image recognition is that the recognition process can be delegated to several parallel threads. With more threads working you can obtain the results faster.

You can specify the number of parallel image recognition threads for the image recognition service provided by the  image-recognition-api  submodule. Set the number in the  magnolia.properties  configuration file through a Magnolia property called  magnolia.image.recognition.thread

For example, magnolia.image.recognition.thread=3 enables three recognition threads. If the property is not set in the file, the default number of threads used by the system is five.

Using other image recognition services

You can implement another image recognition service or integrate your app with another third-party image recognition service using the info.magnolia.ai.image.ImageRecogniser interface provided by the image-recognition-api submodule:

    /**
     * Takes image bytes as parameter and returns a {@link Collection collection}
     * of {@link ImageLabel Image label}s as output.
     *
     * <p>
     *     Returns empty collection for the cases below:
     *     <li>Upon exception</li>
     *     <li>Image couldn't be recognised</li>
     * </p>
     */
    Collection<ImageLabel> recognise(byte[] imageBytes);

Usage

For general usage information, see the Image recognition page.

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))