Updated Using a TensorFlow Pretrained Model to Detect Everyday Objects (markdown)

FTC Engineering
2020-10-29 20:41:01 -04:00
parent c24b3acf5e
commit 940f1a25fb

@ -188,3 +188,22 @@ Call the readLabels() method to read the label map and generate the labels list.
initVuforia(); initVuforia();
initTfod(); initTfod();
``` ```
#### Load Model from a File
Modify the initTfod() method to load the inference model from a file (rather than as an app asset):
```
/**
* Initialize the TensorFlow Object Detection engine.
*/
private void initTfod() {
int tfodMonitorViewId = hardwareMap.appContext.getResources().getIdentifier(
"tfodMonitorViewId", "id", hardwareMap.appContext.getPackageName());
TFObjectDetector.Parameters tfodParameters = new TFObjectDetector.Parameters(tfodMonitorViewId);
tfodParameters.minResultConfidence = 0.6;
tfod = ClassFactory.getInstance().createTFObjectDetector(tfodParameters, vuforia);
if(labels != null) {
tfod.loadModelFromFile(TFOD_MODEL_FILE, labels);
}
}
```