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

FTC Engineering
2020-10-30 07:42:35 -04:00
parent 62dbd31914
commit 6579a2fb6b

@ -192,7 +192,7 @@ Call the readLabels() method to read the label map and generate the labels list.
```
#### Load Model from a File
Modify the initTfod() method to load the inference model from a file (rather than as an app asset):
Modify the initTfod() method to load the inference model from a file (rather than as an app asset). Include the array of labels that you generated from the label map when you load the custom model file.
```
/**
@ -211,7 +211,7 @@ Modify the initTfod() method to load the inference model from a file (rather tha
```
### Run the Op Mode
Once you have made the changes to the sample op mode, rebuild the OnBot Java op modes and run the op mode to test it. The robot controller should now be able to detect everyday objects such as a cell phone, a teddy bear, a clock, a computer mouse, and a keyboard and will draw boundary boxes around recognized objects on the robot controller. You can get a full list of known objects by looking at the contents of the label map text file.
Once you have made these changes to the sample op mode, rebuild the OnBot Java op modes and run the op mode to test it. The robot controller should now be able to detect everyday objects such as a cell phone, a teddy bear, a clock, a computer mouse, and a keyboard. The op mode will draw boundary boxes around recognized objects on the preview screen of the robot controller. You can get a full list of the objects that the model was trained to recognize by looking at the contents of the label map text file.
<p align="center">[[/images/Using-a-TensorFlow-Pretrained-Model-to-Detect-Everyday-Objects/tfodRC.png]]<br/>TensorFlow will recognize everyday objects like a cell phone.<p>
@ -222,7 +222,7 @@ The op mode will also display label information on the driver station (using tel
### Using Android Studio or the Blocks Development Tool
You can also use Android Studio to build and deploy this example op mode if you prefer. The same op mode you would use for OnBot Java can be built using Android Studio.
Note that it is also possible to use this mobilenet .tflite model to detect common objects using a Blocks op mode. The one limitation of the Blocks development tool is that it does not currently have support for reading in the labels from the label map file. Instead, a Blocks programmer would have to specify the labels in a list using the "makeListFromText" programming block.
You can also use this mobilenet TensorFlow model to detect common objects using a Blocks op mode. However, currently the Blocks development tool does not have support for reading in labels from the label map file. Instead, a Blocks programmer must specify the labels in a list using the "makeListFromText" programming block.
<p align="center">[[/images/Using-a-TensorFlow-Pretrained-Model-to-Detect-Everyday-Objects/makeListFromText.png]]<br/>A Blocks programmer would have to manually enter in the label values using the makeListFromText block.<p>