Integrating PowerAI Vision Training and Inference with Maximo Asset Monitor

Maximo® Asset Monitor. Maximo Asset Monitor is a cloud service that enables users to remotely monitor devices at the edge. For example, it can help you notice manufacturing irregularities and take action. This integration allows PowerAI Vision to send inference results to the Maximo Asset Monitor cloud platform for further analysis.

PowerAI Vision Training and Inference must be installed and running before following these steps. For details about working with Maximo Asset Monitor, refer to the Maximo Asset Monitor Knowledge Center.

  1. Verify that PowerAI Vision can connect to the internet.
  2. Verify that all files that are in the bundle (except the custom_py directory) are on PowerAI Vision and ensure that you have the IBM Watson IoT™ Platform Organization ID available. If you do not know the ID, log in to the Watson IoT™ Platform . The ID is below your user name.
  3. In PowerAI Vision, set up users for Maximo Asset Monitor. It is recommend that you do not use the admin user. Follow these guidelines when creating your user name and password. See Managing users for instructions.
    • The credentials need to be valid for retrieving the token from Maximo Asset Monitor.
    • The same user name and password must be set in custom.py and during Maximo Asset Monitor.
    • You cannot change these credentials later.
  4. Create a project in PowerAI Vision and add a data set and model to the project.
  5. Configure the Watson IoT Platform instance. Use the Watson IoT Platform Service dashboard to create a new API key and authentication token pair:
    1. In the Service dashboard, navigate to Apps > Browse API Keys.
    2. Click Generate API Key.
    3. Add a comment to identify the API key in the dashboard, for example: Key for enabling Edge support.
    4. In the Permissions modal, set Role to Operations Application.
    5. Click Generate Key.
      Important: You must record the API key and token pair. You will need these to invoke the script enableEdge.sh later. The authentication tokens are non-recoverable.
      Examples:
      • API key (test_api_key): a-9ixbbq-a84ps90Ajs
      • API token (test_api_token): MP$08VKz!8rXwnR-Q*
    6. Click Close.
  6. Enable integration functionality on the platform by running the enableEdge.sh script on the PowerAI Vision server. The values for apiKey and apiToken were recorded in the previous step:
    bash enableEdge.sh -o <orgID> -k '<apiKey>' -t '<apiToken>'
    Example:
    bash enableEdge.sh -o k5nf9d -k 'a-9ixbbq-a84ps90Ajs' -t 'MP$08VKz!8rXwnR-Q*'
    Example output:
     
    Enable Edge in Watson IoT Platform organization for Edge Solution
    
    
    WIoTP Organization ID : k5nf9d
    WIoTP API Key         : a-9ixbbq-a84ps90Ajs
    WIoTP API Token       : MP$08VKz!8rXwnR-Q*
    Edge Solution         : IoTCore
    WIoTP API Endpoint    : k5nf9d.internetofthings.ibmcloud.com
    
    Edge is enabled for the specified or default (IoTCore) solution
  7. Use the Watson IoT Platform Service dashboard to configure the Gateway Type and Device ID for connecting the server to the platform instance. The edge solution will run on all the edge gateways of this type. Follow these steps to create a gateway device, noting the Device type, Device ID, and the token associated with it.
    1. In the Overview dashboard, select Devices from the menu pane, then select Device Types.
    2. From Device Type page, click Add Device Type, then fill out these fields:
      • Select Gateway and enter the gateway type name.
      • Add a description.
      • Enable Edge Solution.
      • From the drop down list, select Architecture, then click Next.
    3. On the Device Information modal, enter the gateway type attributes, then click Next.
    4. On the Edge Solutions modal, click Add Edge Solution.
    5. On the Add Edge Solution window, hover over the solution to be configured on Edge devices, click Select Solution, then click Done.
    6. Click Finish.
  8. Register the edge device.
    1. In the Overview dashboard, navigate to Devices > Add Device.
    2. In the Identity model, select Device Type and select the gateway type registered in step 7.
    3. Enter the device ID and click Next.
    4. In the Device Information modal, enter the device attributes and click Next.
    5. In the Permissions, specify the appropriate role and click Next.
    6. In the Security modal, enter the authentication token and click Next.
    7. Verify the information in the Summary page, then click Finish.
    8. In the Device details page, record the device credentials.
  9. Ensure that the ports required by Maximo Asset Monitor are available. The following ports are required:
    • Ports used by IoT Core containers: 1883, 8883
    • Port used by Event Creation Service container: 9088
    • The containers will be in a docker network called: wiot-core-net
    1. Log on to PowerAI Vision and run the following command for each required port. If the command returns "1", the port is available.
      sudo nc localhost <port> < /dev/null; echo $?
      Example:
      $ sudo nc localhost 9088 < /dev/null;echo$?
    2. If any ports are not available, contact your system administrator.
  10. In a terminal session, navigate to the directory where the Maximo Asset Monitor integration bundle files are located and run ls to verify that the files from the bundle are available.
  11. Log in as root and run the setup script general_setup.sh, which uses the following variables and parameters:
    -h, --h
    Display the usage message and exit.
    -un, --uninstall
    Uninstall Integration containers and images.
    -o, --orgid
    Watson IoT Platform organization ID.
    -dt, --devicetype
    Device type from Watson IoT Platform .
    -di, --deviceid
    Device ID from Watson IoT Platform .
    -dt, --devicetoken
    Device token from Watson IoT Platform .
    -u, --username
    User name that will be used in the custom.py file.
    -p, --password
    Password that will be used in the custom.py file.
    1. Run the general_setup.sh script:
      general_setup.sh -o <orgid> -dt <device_type> -di <device-id> -t <device-token> -u <username> -p <password>
      Example:
      general_setup.sh -o k5nf9d -dt Hardware -di hardware1 -t testPassw0rd -u admin -p masterpassword
    2. Review the output. Find the line "Test connection to Event Creation Service" and verify that no errors are listed.
      If the test was successful, you will see {"status": "success"} in the terminal. The following container versions should be listed:
      • edge-broker: latest
      • edge-connector: latest
      • event-service: 1.0.1
  12. Modify the provided custom.py script:
    • Change the base URL for an API to point to Maximo Asset Monitor. For example, if PowerAI Vision is installed at https://server.ibm.com/powerai-vision then the API is https://server.ibm.com/powerai-vision/api.
    • Add the data set's UUID. To determine the UUID, navigate to the data set's details page in PowerAI Vision. The UUID is all the text after the final forward slash ( / ) in the URL.
    • Insert the appropriate user ID and password
    Example custom.py script:
    #
    # These are the system credentials that need to be updated
    # InferenceSystemURL: The URL to your PowerAI Vision instance
    # InferenceResultsDatasetID: The ID of the data set where you want to store your inferenced images
    #username: User ID for making the API call to PowerAI Vision to persist image and inference results
    #password: Password for making API calls to PowerAI Vision to persist image and inference results
    #
    # TODO fill this out:
    InferenceSystemURL = "https://my_instance_url"
    # TODO fill this out:
    InferenceResultsDatasetID = "data_set_id"
    
    
    # This will be exposed in the code, please don't use an administrator user name
    username = "non-admin_username"  # TODO fill this out
    # This will be exposed in the code, please don't use an administrator password
    password = "non-admin_password"  # TODO fill this out
    
    
    # If you want to save the images in a data set, set this variable to True. Otherwise, choose False.
    SaveResults = True
    # If you want to send the data to the Maximo Asset Monitoring dashboard, set this variable to True.  Otherwise, choose False
    SendToMAM = True
  13. Create a file named requirements.txt and list any packages (and their versions) that are required in addition to the packages listed in custom.py. Any packages listed in this file will be installed during deploy.
  14. Compress custom.py and requirements.txt into one zip file.
  15. In PowerAI Vision, navigate to the Custom Assets page, drag the zipped configuration file to the "Import custom asset .zip file" area, and choose Custom inference script.
  16. Deploy a model from the project with the Maximo custom asset.
    1. From the Projects page, open your project.
    2. Open the model to deploy and click Deploy model. On the Deploy model window, from the Custom inference script drop down, select the configuration file, then click Deploy.