Updated Blocks Sample TensorFlow Object Detection Op Mode (markdown)

FTC Engineering
2020-10-27 12:41:39 -04:00
parent f8d237ba71
commit 8e2d486d8c

@ -6,7 +6,7 @@ You can use the sample "ConceptTensorFlowObjectDetection" as a template to creat
Press "OK" to create the new op mode.
<p align="center">[[/images/Blocks-Sample-TensorFlow-Object-Detection-Op-Mode/blocksConceptTensorFlowWebcam.png]]<br/>Create an Op Mode with ConceptTensorFlowObjectDetection as its template.<p>
<p align="center">[[/images/Blocks-Sample-TensorFlow-Object-Detection-Op-Mode/blocksConceptTensorFlowWebcam.png]]<br/>Create an op mode with ConceptTensorFlowObjectDetection as its template.<p>
Your new op mode should appear in the editing pane of the Blocks Development Tool screen.
@ -36,7 +36,7 @@ The origin of the coordinate system is in the upper left-hand corner of the imag
In the landscape image above, the approximate coordinate values for the Left, Top, Right, and Bottom boundaries are 455, 191, 808, and 547 respectively (pixel coordinates). The width and height for the landscape image above is 1280 and 720 respectively.
### Activating TensorFlow
In this example, the Op Mode activates the TensorFlow object detector before waiting for the start command from the Driver Station. This is done so that the user can access the "Camera Stream" preview from the Driver Station menu while it waits for the start command. Also note that in this example, the op mode does not activate the Vuforia tracking feature, it only activates TensorFlow object detection. If you want to incorporate Vuforia image detection and tracking you will also need to activate (and later deactivate when you are done) the Vuforia tracking feature.
In this example, the op mode activates the TensorFlow object detector before waiting for the start command from the Driver Station. This is done so that the user can access the "Camera Stream" preview from the Driver Station menu while it waits for the start command. Also note that in this example, the op mode does not activate the Vuforia tracking feature, it only activates TensorFlow object detection. If you want to incorporate Vuforia image detection and tracking you will also need to activate (and later deactivate when you are done) the Vuforia tracking feature.
<p align="center">[[/images/Blocks-Sample-TensorFlow-Object-Detection-Op-Mode/blocksTensorFlowActivate.png]]<br/>Activate TensorFlow.<p>
@ -61,7 +61,7 @@ If the list is empty (i.e., if no objects were detected) the op mode sends a tel
If the list is not empty, then the op mode iterates through the list and calls a function "displayInfo" to display information via telemetry about each detected object.
### Modifying the Sample Op Mode to display Target Zone
Let's modify the sample Blocks Op Mode so it will indicate which target zone the robot should drive to. Using the Blocks editor, modify the conditional clause for an empty list (i.e., no targets detected) so that a telemetry message indicating that zone A should be targeted by the robot (see screenshot below).
Let's modify the sample Blocks op mode so it will indicate which target zone the robot should drive to. Using the Blocks editor, modify the conditional clause for an empty list (i.e., no targets detected) so that a telemetry message indicating that zone A should be targeted by the robot (see screenshot below).
<p align="center">[[/images/Blocks-Sample-TensorFlow-Object-Detection-Op-Mode/targetZoneA.png]]<br/>If the list is empty indicate target zone A.<p>
@ -102,7 +102,7 @@ Note that Android devices can be locked into Portrait Mode so that the screen im
<p align="center">[[/images/Blocks-Sample-TensorFlow-Object-Detection-Op-Mode/autorotate.png]]<br/>Auto-rotate must be enabled in order to operate in Landscape mode.<p>
### Deactivating TensorFlow
When the example Op Mode is no longer active (i.e., when the user has pressed the stop button on the Driver Station) the Op Mode will attempt to deactivate the TensorFlow library before it's done. It's important to deactivate the library to free up system resources.
When the example op mode is no longer active (i.e., when the user has pressed the stop button on the Driver Station) the op mode will attempt to deactivate the TensorFlow library before it's done. It's important to deactivate the library to free up system resources.
<p align="center">[[/images/Blocks-Sample-TensorFlow-Object-Detection-Op-Mode/blocksTensorFlowDeactivate.png]]<br/>Deactivate TensorFlow.<p>