Updated Using a TensorFlow Pretrained Model to Detect Everyday Objects (markdown)
@ -187,4 +187,23 @@ Call the readLabels() method to read the label map and generate the labels list.
|
||||
// first.
|
||||
initVuforia();
|
||||
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);
|
||||
}
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user