No announcement yet.

Tensorflow-adjusting confidence level?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Tensorflow-adjusting confidence level?

    Hi Everyone,

    We have implemented Tensorflow with marginal success. We can get it to work in some situations with certain lighting, and with blue tape around the depot, but not red. I have heard that the confidence level can be adjusted, but can't find anything on the forums about where to find the code to do this. Does anybody know where this chunk of code is located? Can it be added?


  • #2

    Wherever I found this on the forum said the default is 0.40. I didn't see that it made much difference so I commented it back out.

    In the initTFOD -
    TFObjectDetector.Parameters tfodParameters = new TFObjectDetector.Parameters(tfodMonitorViewId); tfodParameters.minimumConfidence = 0.10; tfod = ClassFactory.getInstance().createTFObjectDetector( tfodParameters, vuforia);


    • #3
      FTC12961 Can you report back what camera you're using, what lighting environments cause problems (and if there are any that don't), and what angle the phone is at (i.e., is it very low to the ground, or high up on the robot looking down)? When looking for the minerals with the camera, are the minerals completely surrounded by the gray tiles in the camera's images, or is some of the crater also directly behind the minerals? Are the problems that minerals aren't being seen, or that extra minerals are showing up? Do you have similar problems with both gold and silver minerals? Are you using the default code that requires seeing all 3 minerals (and only 3 minerals) to work, or have you customized it?

      One team I mentor was successful using TensorFlow by changing the default code to only look for gold minerals, and by looking repeatedly from a fixed robot position for a second or two instead of looking only once (as sometimes the gold wouldn't be seen in a single image but it was always seen within a second or so).
      CHEER4FTC website and facebook online FTC resources.
      Providing support for FTC Teams in the Charlottesville, VA area and beyond.


      • #4
        Cheer4FTC , thanks for your response. We are using the Moto G4 Play. The phone is pretty low about 4 inches up to the camera lens. It is angled down a bit, maybe 10-15 degrees. It is placed so that the minerals appear as close to the center of the frame in landscape mode as possible. We primarily have issues when there is red tape in view... any red tape, whether minimized or not. The point of failure is that it is detecting three objects, but does not identify the correct position of the gold. We are using the default code to detect three minerals.

        The crater seems to disrupt everything, whether red or blue tape is involved. We have tried angling the phone downward to avoid having minerals in the background, but it didn't help. I wasn't present for these tests, so I don't know whether it was detecting more than, or less than 3 objects, or was just not determining the correct position of the gold.

        Our lighting levels are good. There are LED "fluorescent" style tube fixtures above that I think are 5200 Kelvin color temperature. We are giving it a good long time to take a sample and make its decision, up to 5 seconds. That also doesn't seem to make much difference.

        We have considered changing it to get closer to two minerals and infer the position of the gold based on what it senses. The thought being that the more of the frame that is filled with the minerals, the more accurately it will be in detecting them. The problem is, neither we (the coaches/mentors) or the team members have enough coding chops to find where this code lives in Android Studio. If we knew where to look, we might be able to bend it to our will.


        • #5
          3805Mentor Thanks for the landmarks. We will have a look and see if we can find it.


          • #6
            FTC12961 Have you tried using telemetry messages to report back where the minerals are? This can help detect some issues.

            A student writeup on TFOD for mineral detection from one of the teams I mentor is at this link.

            That team's robot uses a Moto E4 front facing camera and has the phone high up and towards the back of the robot. The view shows some of the crater at the top of the image but the code only looks at detected minerals below a certain Y threshold in the image, essentially ignoring minerals in the crater. The doc has a link to the github code so you can peruse at your leisure. That team's sampling was 9/9 at their only event so far.
            CHEER4FTC website and facebook online FTC resources.
            Providing support for FTC Teams in the Charlottesville, VA area and beyond.


            • #7
              On a related note, is there a way to "reset" what is being seen? We noticed issues when initializing Tensorflow in init for autonomous while hanging. It can see the field and picked up the initial locations. It seems to retain those positions and then when the randomization occured, we'd get a second position for gold (assuming it moved), i.e. there are two reported, one at the original location and one at the new location. For now the programmers are just initializing in Start but that takes some time from what I understand. There should be a way to tell Tensorflow to start fresh, isn't there?
              Technical Coach, Newton Busters FTC 10138, FLL 3077
              Chicago 'burbs, IL


              • #8
                Originally posted by gof View Post
                On a related note, is there a way to "reset" what is being seen?
                Do not perform tensorflow.activateTfod() until your driver presses "Start". All other setup/initializations can be done after "Init".