read_locations¶

read_locations(input_table)[source]¶

Read annotations as pandas DataFrame.

Parameters:

input_table (PathLike | np.ndarray | pd.DataFrame`) – Path to csv, npy or json. Input can also be a numpy.ndarray or pandas.DataFrame. First column in the table represents x position, second column represents y position. The third column represents the class. If the table has headers, the header should be x, y & class. Json should have x, y and class fields.

Returns:

DataFrame with x, y location and class type.

Return type:

pd.DataFrame

Raises:

FileNotSupportedError – If the path to input table is not of supported type.

Examples

>>> from tiatoolbox.utils.misc import read_locations
>>> labels = read_locations('./annotations.csv')