Table of Contents

Object Detection on Stage – Python

Example Description
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