TensorFlowInferenceInterface во флаттереAndroid

Форум для тех, кто программирует под Android
Ответить
Anonymous
 TensorFlowInferenceInterface во флаттере

Сообщение Anonymous »

У меня есть код обнаружения объектов в Android, я хочу преобразовать его во Flutter, чтобы использовать его и для IOS

Код: Выделить всё

public static Classifier create(
AssetManager assetManager,
String modelFilename,
String[] labels,
int inputSize,
int imageMean,
float imageStd,
String inputName,
String outputName) {
final TensorFlowImageClassifier c = new TensorFlowImageClassifier();
c.inputName = inputName;
c.outputName = outputName;

// Read the label names into memory.
Collections.addAll(c.labels, labels);

c.inferenceInterface = new TensorFlowInferenceInterface(assetManager, modelFilename);

// The shape of the output is [N, NUM_CLASSES], where N is the batch size.
final Operation operation = c.inferenceInterface.graphOperation(outputName);
final int numClasses = (int) operation.output(0).shape().size(1);

// Ideally, inputSize could have been retrieved from the shape of the input operation.  Alas,
// the placeholder node for input in the graphdef typically used does not specify a shape, so it
// must be passed in as a parameter.
c.inputSize = inputSize;
c.imageMean = imageMean;
c.imageStd = imageStd;

// Pre-allocate buffers.
c.outputNames = new String[]{outputName};
c.intValues = new int[inputSize * inputSize];
c.floatValues = new float[inputSize * inputSize * 3];
c.outputs = new float[numClasses];

return c;
}
Вызывается:

Код: Выделить всё

create(
getAssets(),
"file:///android_asset/xxx",
getResources().getStringArray(R.array.yyy),
INPUT_SIZE,
128,
128,
"input",
"InceptionV3/Predictions/Reshape_1")
org.tensorflow.contrib.android.TensorFlowInferenceInterface
Этот класс не найден во флаттере, чем его заменить?

Подробнее здесь: https://stackoverflow.com/questions/786 ... in-flutter
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»