Skip to main content
Version: v1.4.0

Predictions download formats: Image instance segmentation

Overview

When you download predictions in H2O Hydrogen Torch, which comes in a zip file, the format and content of the file first depends on the problem type of the predictions, and then it depends on how you generate them. On the point of "how you generate them," there are two scenarios.

  • Scenario 1: Predictions from a completed experiment

    Predictions downloaded from a completed experiment on the View experiments card are packaged in a zip file. This zip file contains the following files:

    1. validation_predictions.csv: This is a structured dataframe in CSV format, presenting the final predictions for the provided validation dataframe.

    2. validation_raw_predictions.pkl: This is a Pickle file, which is essentially a pickled Python dictionary. It contains raw predictions for the provided validation dataframe.

      If the experiment included a test dataframe, H2O Hydrogen Torch also includes two additional files in the same zip file:

    3. test_predictions.csv: This is another structured dataframe in CSV format, displaying the final predictions for the provided test dataframe.

    4. test_raw_predictions.pkl: Similar to the validation set, this is a Pickle file with raw predictions for the provided test dataframe.

  • Scenario 2: Predictions generated by scoring on new data

    Predictions generated by scoring on new data through the H2O Hydrogen Torch UI (on the Predict data card) are downloaded in a zip file. This zip file includes the following files:

    1. test_predictions.csv: This is a structured dataframe in CSV format, showing the final predictions for the provided test dataframe.
    2. test_raw_predictions.pkl: This is a Pickle file, a pickled Python dictionary containing raw predictions for the provided test dataframe.

Formats

The Pickle file, contains the following keys:

  • raw_probabilities
    • A 4-dimensional NumPy array that contains pixel-wise probabilities. The shape of the array is as follows: number_of_observations x number_of_classes + 2 x {image_height} x {image_width}. Two additional channels (+ 2) are added to the number_of_classes corresponding to individual instance borders and borders between instances
      Note

      You can define the {image_height} and {image_width} under the Image settings section when building an image instance segmentation experiment.

      caution

      Raw probabilities are available only if the following setting was set to True when running an image instance segmentation experiment: Save prediction probabilities.

  • instance_predictions
    • A list of 3-dimensional NumPy arrays containing instance predictions, where each instance is represented as a separate integer starting from 1 for each class. The length of the list is number_of_observations and the shape of each array is as follows: original_image_height x original_image_width x number_of_classes, where original_image_height and original_image_width are height and width of the corresponding input image
  • confidences
    • A list of dictionaries containing prediction confidences for each instance; the length of the list is N (number_of_observations). Each element of the list is a dictionary with keys representing the class names and values representing the confidences for each instance ID (starting from 1)
  • class_names
    • The class_names refer to a list containing all the class names. The class names follow the order of the class names in the 4-dimensional Numpy raw_probabilities array and the 4-dimensional NumPy instance_predictions array
  • [image_column]
    • A 1-dimensional NumPy array that contains input image names. The name of the key is [image_column] where image_column refers to the name of the image column in the train dataframe
      Note

      You can define the [image_column] under the Dataset settings section when building an image semantic segmentation experiment.

Note

To learn how to open the csv and Pickle files, see Open CSV and Pickle files with Python.

Open CSV and Pickle files with Python

Using Python, a csv or Pickle file containing predictions can be open as follows:

import pickle
import pandas as pd

df = pd.read_csv('text_classification/validation_predictions.csv')

with open('text_classification/validation_raw_predictions.pkl', 'rb') as f:
out = pickle.load(f)
print(out.keys())
dict_keys(['predictions', 'comment_text', 'labels'])
print(df.head(1))
idcomment_textlabel_toxiclabel_severe_toxiclabel_obscenelabel_threatlabel_insultlabel_identity_hatefoldpred_label_toxicpred_label_severe_toxicpred_label_obscenepred_label_threatpred_label_insultpred_label_identity_hate
000103f0d9cfb60fD'aww! He matches this background colour I'm s...00000000.000410.0001680.0003280.0001420.0002470.000155

Feedback