Updated Blocks Sample TensorFlow Object Detection Op Mode (markdown)
@ -56,17 +56,9 @@ The op mode will then iterate until a Stop command is received. At the beginnin
|
|||||||
|
|
||||||
<p align="center">[[/images/Blocks-Sample-TensorFlow-Object-Detection-Op-Mode/whileLoop.png]]<br/>The op mode gets a list of recognized objects with each iteration of the while loop.<p>
|
<p align="center">[[/images/Blocks-Sample-TensorFlow-Object-Detection-Op-Mode/whileLoop.png]]<br/>The op mode gets a list of recognized objects with each iteration of the while loop.<p>
|
||||||
|
|
||||||
If the number of detected objects equals three (i.e., if three Minerals are in the camera's field of view) then the op mode will loop through the list of recognized objects and look at the label for each recognized object. If an object has a label that indicates it's a Gold Mineral, then the "Left" coordinate value of its bounding box will be assigned to the variable "goldMineralX". Similarly, if the other two objects in the list have labels that indicate that they are Silver Minerals, then their Left coordinate values will be assigned to the variables "silverMineral1X" and "silverMineral2X".
|
If the list is empty (i.e., if no objects were detected) the op mode sends a telemetry message to the Driver Station indicating that no items were detected.
|
||||||
|
|
||||||
<p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/tensorflow/images/blocksFindingLeftValues.png" width="600"><br/>Keep track of the Left coordinate values of the detected objects.<p>
|
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.
|
||||||
|
|
||||||
The Op Mode then checks to see if it has three valid X (or Left) coordinate values for the Gold and two Silver Minerals. If it does have three valid values, then it compares the Gold X coordinate value with the other two values:
|
|
||||||
|
|
||||||
* If the Gold X value is the lowest (i.e., leftmost) of the three, then the Gold Mineral is in the "Left" position.
|
|
||||||
* If the Gold X value is the highest (i.e., rightmost) of the three, then the Gold Mineral is in the "Right" position.
|
|
||||||
* Otherwise, the Gold Mineral is in the "Center" position.
|
|
||||||
|
|
||||||
<p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/tensorflow/images/blocksCompareLeftValues.png" width="600"><br/>Compare the Left or X coordinate values to determine Gold's relative location.<p>
|
|
||||||
|
|
||||||
### Important Note Regarding Image Orientation
|
### Important Note Regarding Image Orientation
|
||||||
The system interprets images based on the phone's orientation (Portrait or Landscape) at the time that the TensorFlow object detector was created and initialized. In our example, if you execute the TensorFlowObjectDetection.initialize block while the phone is in Portrait mode, then the images will be processed in Portrait mode.
|
The system interprets images based on the phone's orientation (Portrait or Landscape) at the time that the TensorFlow object detector was created and initialized. In our example, if you execute the TensorFlowObjectDetection.initialize block while the phone is in Portrait mode, then the images will be processed in Portrait mode.
|
||||||
|
Reference in New Issue
Block a user