OnBot Java ftc-ml_manual Documentation Fix

We use OnBot Java for development and followed the directions in section 6.2 of the ftc-ml_manual to try loading and using our first custom TensorFlow model via the ConceptTensorFlowObjectDetectionWebcam OpMode.

Step 7 of section 6.2 had us change tfod.loadModelFromAsset to tfod.loadModelFromFile. This is done because the uploaded .tflite file cannot be built in as an asset as is done when using Android Studio. Unfortunately, following the instructions in steps 6 and 7 of section 6.2 causes this error to be displayed on OpMode initialization in the Driver’s Station:

RuntimeException - TFObjectDetector loadModelFromFile failed.

We weren’t sure why this was failing so we used OnBot Java’s ability to download logs and found the exception backtrace. The cause given was (somewhat as expected):

java.io.FileNotFoundException: model_20211105_174224.tflite (No such file or directory)

We then found a version of the Javadoc for TFObjectDetector.loadModelFromFile here.

The first parameter is described this way:

absoluteFileName - the full path to the .tflite model file to load

So based on the instructions in steps 6 and 7 of the ftc-ml_manual, we knew that only the filename was being passed and not the full path. So the question now was: What is the correct full path on the Robot Controller’s file system?

We found this article (the section entitled “Specifying the Filepath & Changing the Labels”) which told us that the full path is: “/sdcard/FIRST/tflitemodels/”.

We prepended that path to our .tflite filename and all was well.

So we’re suggesting changing step 6 of section 6.2 of the ftc-ml_manual to show the full path that is required so that models will be found and loaded successfully using OnBot Java:

private static final String TFOD_MODEL_ASSET = "/sdcard/FIRST/tflitemodels/FreightFrenzy_BCDM.tflite";

We don’t know if this also affects the Blocks instructions in section 6.3 but wanted to mention them just in case.


Confidential Robotics - Team 13243, Eagan, Minnesota

1 Like

Thank you very much! I will update the manual with this correction.


The ftc-ml manual has been updated. Thanks again!


1 Like

We did it in blocks and was able to just specify the file name without the extended path.