Look like your model don't contain any metadata as the embed model has.
May be the easiest way is to just remove this block:
try (BufferedReader br =
new BufferedReader(
new InputStreamReader(
metadata.getAssociatedFile(labelFilename), Charset.defaultCharset()))) {
String line;
while ((line = br.readLine()) != null) {
Log.w(TAG, line);
d.labels.add(line);
}
}
And just read the d.labels from the lableFilename (labelmap.txt in the assets folder).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…