Category

public abstract class Category


Category is a util class, that contains a category name, its display name, a float value as score, and the index of the label in the corresponding label file. Typically it's used as result of classification or detection tasks.

Summary

Public constructors

Public methods

abstract String

The label of this category object.

static Category
create(float score, int index, String categoryName, String displayName)

Creates a Category instance.

static Category
createFromProto(ClassificationProto.Classification proto)

Creates a Category object from a ClassificationProto.Classification protobuf message.

static List<Category>
createListFromProto(
    ClassificationProto.ClassificationList classificationListProto
)

Creates a list of Category objects from a ClassificationProto.ClassificationList.

abstract String

The display name of the label, which may be translated for different locales.

final boolean
final int
abstract int

The index of the label in the corresponding label file.

abstract float

The probability score of this label category.

final String

Public constructors

Category

public Category()

Public methods

categoryName

public abstract String categoryName()

The label of this category object.

create

public static Category create(float score, int index, String categoryName, String displayName)

Creates a Category instance.

Parameters
float score

the probability score of this label category.

int index

the index of the label in the corresponding label file.

String categoryName

the label of this category object.

String displayName

the display name of the label.

createFromProto

public static Category createFromProto(ClassificationProto.Classification proto)

Creates a Category object from a ClassificationProto.Classification protobuf message.

Parameters
ClassificationProto.Classification proto

the ClassificationProto.Classification protobuf message to convert.

createListFromProto

public static List<Category> createListFromProto(
    ClassificationProto.ClassificationList classificationListProto
)

Creates a list of Category objects from a ClassificationProto.ClassificationList.

Parameters
ClassificationProto.ClassificationList classificationListProto

the ClassificationProto.ClassificationList protobuf message to convert.

Returns
List<Category>

A list of Category objects.

displayName

public abstract String displayName()

The display name of the label, which may be translated for different locales. For example, a label, "apple", may be translated into Spanish for display purpose, so that the display name is "manzana".

equals

public final boolean equals(Object o)

hashCode

public final int hashCode()

index

public abstract int index()

The index of the label in the corresponding label file. Returns -1 if the index is not set.

score

public abstract float score()

The probability score of this label category.

toString

public final String toString()