Table of Contents

detectedcount()

Function Definition: detectedcount(object_name = "person")

Parameters

NameTypeDescriptionExpected ValuesDefault Value
object_namestringThe class name of the object."person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck", "boat", "traffic", "fire", "stop", "parking", "bench", "bird", "cat", "dog", "horse", "sheep", "cow", "elephant", "bear", "zebra", "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee", "skis", "snowboard", "sports", "kite", "baseball", "baseball", "skateboard", "surfboard", "tennis", "bottle", "wine", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange", "broccoli", "carrot", "hot", "pizza", "donut", "cake", "chair", "couch", "potted", "bed", "dining", "toilet", "tv", "laptop", "mouse", "remote", "keyboard", "cell", "microwave", "oven", "toaster", "sink", "refrigerator", "book", "clock", "vase", "scissors", "teddy", "hair", or "toothbrush""person"

Description

The function returns whether the number of objects identified with the specified object class.

Example

The example demonstrates how to detect persons on the stage with different confidence thresholds.

Code

sprite = Sprite('Tobi')
obj = ObjectDetection()

obj.enablebox()
sprite.gotoxy(-180, -110)
sprite.setsize(100)

obj.setthreshold(0.3)
obj.analysestage()
sprite.say(str(obj.detectedcount("person")) + " Person Detected at 0.3 Threshold", 2)

obj.setthreshold(0.5)
obj.analysestage()
sprite.say(str(obj.detectedcount("person")) + " Person Detected at 0.5 Threshold", 2)

obj.setthreshold(0.9)
obj.analysestage()
sprite.say(str(obj.detectedcount("person")) + " Person Detected at 0.9 Threshold", 2)

Output

Read More
All articles loaded
No more articles to load