-
Notifications
You must be signed in to change notification settings - Fork 6k
Using a Custom TensorFlow Model with Blocks
The Blocks Development Tool includes a sample op mode that demonstrates how a user can load a custom inference model. In this example, we will load a TensorFlow inference model from a prior FIRST Tech Challenge season.
The Robot Controller allows you to load an inference model that is in the form of a TensorFlow Lite (.tflite) file. If you are a very advanced user, you can use Google's TensorFlow Object Detection API to create your own custom inference model. In this example, however, we will use a .tflite file from a prior season (Skystone).
The inference model is available on GitHub at the following link:
Press the "Download" button to download the file from GitHub to your local device.
Press the Download button to download the .tflite file.
Once you have the file downloaded to your laptop, you need to upload it to the Robot Controller. Connect your laptop to your Robot Controller's wireless network and navigate to the "Manage" page of the system:
Connect to the Robot Controller's wireless network and navigate to the Manage page.
Scroll towards the bottom of the screen, and click on the "Select TensorflowLite Model File" button to open a dialog box that you can use to select your .tflite file.
Press the "Select TensorflowLite Model File" button.
Use the dialog box to browse for and to select the .tflite file.
Use the dialog box to find and select your .tflite file.
Press the "Upload" button to upload the file to the Robot Controller. The words "Tensorflow Lite model upload complete" will appear if the upload was successful.
Press the "Upload" button to upload the file to the Robot Controller.
Click on the "Blocks" tab at the top of the screen to navigate to the Blocks Programming page. Click on the Create New Op Mode Button to display the Create New Op Mode dialog box. Specify a name for your new op mode. Select "ConceptTensorFlowObjectDetectionCustomModel" as the sample op mode that will be used as a template for your new op mode. Note that if you do not have a webcam configured for your Robot Controller, the dialog box might display a warning message. You can ignore this warning message. Press "OK" to create your new op mode.
Use "ConceptTensorFlowObjectDetectionCustomModel" as the template for your new op mode.
The new op mode should appear in edit mode in your browser. By default, the sample op mode assumes that you are using the smartphone camera with your robot controller. If you are using a webcam, disable the phone-specific initialization block and enable the webcam-specific block.
Use the appropriate initialization block for the type of camera used on your robot.
-
TensorFlow 2023-2024