This function is used to get the confidence (accuracy) of object detection, 0 being low confidence and 1 being high confidence.
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
- Detection at 0.3
- Detection at 0.5
- Detection at 0.8
Read More