Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public class ClassificationFrameProcessor implements FrameProcessor {
private final Interpreter interpreter;
private final List<String> labels;
private final ClassificationListener classificationListener;
private final ModelConfig modelConfig;
/* ... */
public void process(@NonNull Frame frame) {
Bitmap bitmap = ImageUtils.frameToBitmap(frame);
Bitmap toClassify = ThumbnailUtils.extractThumbnail(
bitmap, modelConfig.getInputWidth(), modelConfig.getInputHeight()
ByteBuffer byteBufferToClassify = bitmapToModelsMatchingByteBuffer(toClassify);
float[][] result = new float[1][labels.size()];, result);
/* ... */
public interface ClassificationListener {
void onClassifiedFrame(List<ClassificationResult> classificationResults);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.