The engine.data module contains classes representing different types of data.
Bases: abc.ABC
Data abstract class allows for representing different types of data.
This class serves as the basis for more complicated data types.
For data classes, conversion from (using the constructor) and to NumPy arrays (using the numpy()
method) will be supported to make the library compliant with the standard pipelines used by the computer vision and robotics communities.
This class provides abstract methods for returning a NumPy compatible representation of data numpy()
.
The Data class has the following public methods:
Return the data argument. This method returns the internal representation of the data, which might not be a NumPy array.
Return a NumPy-compatible representation of data.
This is an abstract method that returns a numpy.ndarray
object.
Bases: engine.data.Data
A class used for representing multidimensional timeseries data.
The Timeseries class has the following public methods:
Construct a new Timeseries object based from data. data is expected to be a 2-D array that can be casted into a 2-D NumPy array, where the first dimension corresponds to time and the second to the features.
Return data argument. Return type is float32 NumPy array.
Set the internal data argument. data is expected to be a 2-D array that can be casted into a 2-D NumPy array, where the first dimension corresponds to time and the second to the features.
Return a NumPy-compatible representation of data.
Given that data argument is already internally stored in NumPy-compatible format, this method is equivalent to data()
.
Bases: engine.data.Data
A class used for representing multidimensional vector data.
The Vector class has the following public methods:
Construct a new Vector object based from data. data is expected to be a 1-D array that can be casted into a 1-D NumPy array.
Return data argument. Return type is float32 NumPy array.
Set the internal data argument. data is expected to be a 1-D array that can be casted into a 1-D NumPy array.
Return a NumPy-compatible representation of data.
Given that data argument is already internally stored in NumPy-compatible format, this method is equivalent to data()
.
Bases: engine.data.Data
A class used for representing image data.
The Image class has the following public methods:
Construct a new Image object based on data. data is expected to be a 3-D array that can be casted into a 3-D NumPy array. dtype is expected to be a NumPy data type. guess_format if set to True, then tries to automatically infer whether an OpenCV image was supplied and then automatically converts it into OpenDR format. Note that the OpenDR framework assumes an NCHW/RGB ordering.
Return data argument. Return type is uint8 NumPy array.
Set the internal data argument. data is expected to be a 3-D array that can be casted into a 3-D NumPy array, where the dimensions can be organized as e.g. (channels, width, height).
Return a NumPy-compatible representation of data.
Given that data argument is already internally stored in NumPy-compatible format, this method is equivalent to data()
.
Return an OpenCV-compatible representation of data. This method transforms the internal CHW/RGB representation into HWC/BGR used by OpenCV.
Construct a new Image object from the given image file.
Return the data in channels first/last format using either 'rgb' or 'bgr' ordering. format is expected to be of str type (either 'channels_first' or 'channels_last') channel_order is expected to be of str type (either 'rgb' or 'bgr') Returns an image (as NumPy array) with the appropriate format
Bases: engine.data.Image
A class used for representing image data with a list of detections. This class is used for methods that rely on an external object detector such as DeepSort for 2D object tracking.
The ImageWithDetections class has the following public methods:
Construct a new ImageWithDetections object based on provided data.
- image is expected to be an Image or a 3-D array that can be casted into a 3-D NumPy array.
- boundingBoxList is expected to be a BoundingBoxList.
Return data argument. Return type is uint8 NumPy array.
Set the internal data argument. data is expected to be a 3-D array that can be casted into a 3-D NumPy array, where the dimensions can be organized as e.g. (channels, width, height).
Bases: engine.data.Data
A class used for representing video data.
The Video class has the following public methods:
Construct a new Video object based on data. data is expected to be a 4-D array of shape (channels, time_steps, height, width).
Return data argument. Return type is a float32 NumPy array.
Set the internal data argument. data is expected to be a 4-D array that can be casted into a 4-D NumPy array, where the dimensions can be organized as e.g. (channels, width, height).
Return a NumPy-compatible representation of data.
Given that data argument is already internally stored in NumPy-compatible format, this method is equivalent to data()
.
Bases: engine.data.Data
A class used for representing point cloud data.
The PointCloud class has the following public methods:
Construct a new PointCloud object based on data. data is expected to be a 2-D array that can be casted into a 2-D NumPy array.
Return data argument. Return type is float32 NumPy array.
Set the internal data argument. data is expected to be a 2-D array that can be casted into a 2-D NumPy array, where the dimensions can be organized as e.g. (number_of_points, channels).
Return a NumPy-compatible representation of data.
Given that data argument is already internally stored in NumPy-compatible format, this method is equivalent to data()
.
Bases: engine.data.PointCloud
A class used for representing point cloud data with a corresponding lidar-camera callibration data.
The PointCloudWithCalibration class has the following public methods:
Construct a new PointCloudWithCalibration object based on data.
data is expected to be a 2-D array that can be casted into a 2-D NumPy array.
calib is expected to be a dictionary with P
, R0_rect
, Tr_velo_to_cam
and Tr_imu_to_velo
matrices in NumPy-compatible format.
P[x]
matrices project a point in the rectified referenced camera coordinate to thecamera[x]
image.R0_rect
is the rectifying rotation for reference coordinate system.Tr_velo_to_cam
maps a point in point cloud coordinate system to reference coordinate system.Tr_imu_to_velo
maps a point in IMU coordinate system t0 point cloud coordinate system.
Return data argument. Return type is float32 NumPy array.
Set the internal data argument. data is expected to be a 2-D array that can be casted into a 2-D NumPy array, where the dimensions can be organized as e.g. (number_of_points, channels).
Return a NumPy-compatible representation of data.
Given that data argument is already internally stored in NumPy-compatible format, this method is equivalent to data()
.
Bases: engine.data.Data
A class used for representing a sequence of body skeletons in a video.
The SkeletonSequence class has the following public methods:
Construct a new SkeletonSequence object based on data. data is expected to be a 5-D array that can be casted into a 5-D NumPy array. The array's dimensions are defined as follows:
N, C, T, V, M = array.shape()
,
N
is the number of samples,C
is the number of channels for each of the body jointsT
is the number of skeletons in each sequenceV
is the number of body joints in each skeletonM
is the number of persons (or skeletons) in each frame.
Accordingly, an array of size [10, 3, 300, 18, 2]
contains 10
samples
each containing a sequence of 300
skeletons while each skeleton has 2
persons each of which has 18
joints
and each body joint has 3
channels.
Return data argument. Return type is float32 5-D NumPy array.
Set the internal data argument. data is expected to be a 5-D array that can be casted into a 5-D NumPy array, where the dimensions can be organized as e.g. (num_samples, channels, frames, joints, persons).
Return a NumPy-compatible representation of data.
Given that data argument is already internally stored in NumPy-compatible format, this method is equivalent to data()
.