LabelUtil

公開類別 LabelUtil

標籤作業公用程式

公用方法

static List<String>
mapValueToLabels(TensorBuffer tensorBuffer、List<String> 標籤、 int 偏移)
將 int 值張量對應至字串標籤清單。

繼承的方法

公用方法

公開 static List<String> mapValueToLabels (TensorBuffer tensorBuffer, List<String> 標籤、 int 偏移)

將 int 值張量對應至字串標籤清單。這會將字串陣列做為字典。範例:如果指定的張量為 [3, 1, 0],而特定標籤為 ["background"、 "apple"、"banana"、"cherry"、"date"],則結果將會是 ["date", "banana", "apple"]。

參數
tensorBuffer 含索引值的張量。這個值應為非負整數,每個值 x 都會轉換為 labels[x + offset]。如果張量是以浮點 TensorBuffer 的形式提供,值將轉換為整數。超出範圍的所有值都會對應至空字串。
標籤 字串清單,做為字典查詢。陣列元素的索引將做為索引鍵。如要提高效能,請使用實作 RandomAccess 的物件,例如 ArrayList
碳補償 labels 中查詢 int 值時的偏移值。
傳回
擲回
IllegalArgumentException 如果 tensorBufferlabels 為空值。