Skip to content

Commit

Permalink
Merge pull request FIRST-Tech-Challenge#77 from IsaccBarker/milobanks…
Browse files Browse the repository at this point in the history
…/integrate-base-tensorflow

Basic tensorflow implementation
  • Loading branch information
Isacc Barker committed Nov 20, 2021
2 parents 2820112 + d52004f commit 4582332
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.rowlandhall.arc.detection;

import org.tensorflow.lite.Interpreter;

import java.util.Map;
import java.util.HashMap;
import java.io.File;

public class ObjectDetection {
Interpreter interpreter;
Map<String, Object> inputs = new HashMap<>();
Map<String, Object> outputs = new HashMap<>();

public ObjectDetection() {
File model = new File("future_model_location.tflite");
interpreter = new Interpreter(model);
}

public void run(long[] frame) {
inputs.put("frame", frame);

// TODO: Figure out what these outputs should be
// TODO: after we train the model.

interpreter.runSignature(inputs, outputs);
}

// NOTE: This will be finished after we, again, figure out
// NOTE: what the outputs should be.
/* public UNKNOWN get_detected_boundaries() {
// Query the output map
} */
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.opencv.imgproc.Imgproc;
import org.openftc.easyopencv.OpenCvPipeline;

import org.rowlandhall.arc.detection.ObjectDetection;

/** The OpenCV pipeline for the webcam; what all the frames go through
* to get processed. */
public class WebcamPipeline extends OpenCvPipeline {
Expand Down
3 changes: 3 additions & 0 deletions build.dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ dependencies {

// Roadrunner dependency
implementation 'com.acmerobotics.dashboard:dashboard:0.4.3'

// Tensorflow lite
implementation 'org.tensorflow:tensorflow-lite:2.7.0'
}

0 comments on commit 4582332

Please sign in to comment.