MakeOneHot2D

class behavenet.data.transforms.MakeOneHot2D(y_pixels, x_pixels)[source]

Bases: Transform

Turn an array of continuous values into an array of one-hot 2D arrays.

Assumes that there are an even number of values in the input array, and that the first half are x values and the second half are y values.

For example, if y_pixels=128 and x_pixels=128 (inputs to constructor), and the input array is [64, 34, 56, 102], the output array is of shape (2, 128, 128) where all values are zero except: output[0, 56, 64] = 1 output[1, 102, 34] = 1

Methods Summary

__call__(sample)

Assumes that x-values are first half, y-values are second half.

Methods Documentation

__call__(sample)[source]

Assumes that x-values are first half, y-values are second half.

Parameters:

sample (np.ndarray) – input shape is (time, n_labels * 2)

Returns:

output shape is (time, n_labels, y_pix, x_pix)

Return type:

np.ndarray