Tensorflow lite object detection values on raspberry pi

Is there any way to make it so the percentages with the detected object output into a .txt file? I am using a Raspberry Pi 4 (4gb) to run Tensorflow lite, but I need to actually use the values that are displayed, E.G Tree, 89% certainty.

I want to convert the percentage into an integer to make a very basic self-flying ai that just avoids certain detected objects. I know there are easier ways of doing this but I want to learn how to do this with object detection regardless.

I am just going to make a separate code that constantly runs and checks for certain objects, then if it does see an object, if the percentage is above a certain threshold then it will just turn.

Currently, I am using raspbian but I have a spare 32gb micro sd card if a different OS is required or better