Table of Contents

confidence()

Function Definition: confidence(object = 1)

Parameters

NameTypeDescriptionExpected ValuesDefault Value
objectintThe object number for which the expression is required.1-1001

Description

This function is used to get the confidence (accuracy) of object detection, 0 being low confidence and 1 being high confidence.

Example

The example demonstrates how to run an object detection on the stage and show all the objects with confidence.

Code

sprite = Sprite('Square Box')
obj = ObjectDetection()

obj.disablebox()
obj.setthreshold(0.5)
obj.analysestage()

sprite.gotoxy(0, 0)
sprite.setsize(100)
sprite.say(str(obj.count()) + " Object Detected", 2)

for object in range(1, obj.count() + 1):
  sprite.setx(obj.x(object))
  sprite.sety(obj.y(object))
  sprite.setsize(obj.width(object))
  sprite.say(obj.classname(object) + " with " + str(obj.confidence(object)), 2)

Output

  1. Detection at 0.3
  2. Detection at 0.5
  3. Detection at 0.8
Read More
All articles loaded
No more articles to load