Object Detection

Extension Description
AI to identify objects from images. It also tells the location and size of the objects identified.

Introduction

Object detection is used to locate and identify multiple objects in digital photographs. It is a computer vision technique that helps to detect objects as well as classify them. The object class may appear once or several times in the image. For example, in the following image, object detection assists us to locate the objects and classify them accordingly to the known set of objects.

Object Detection

One of the applications of Object detection includes Self-driving vehicles which detect objects in real-time and act accordingly.

The object detection extension in PictoBlox allows you to detect the following 90 objects:

IDOBJECT (PAPER)SUPER CATEGORY
1personperson
2bicyclevehicle
3carvehicle
4motorcyclevehicle
5airplanevehicle
6busvehicle
7trainvehicle
8truckvehicle
9boatvehicle
10traffic lightoutdoor
11fire hydrantoutdoor
12street signoutdoor
13stop signoutdoor
14parking meteroutdoor
15benchoutdoor
16birdanimal
17catanimal
18doganimal
19horseanimal
20sheepanimal
21cowanimal
22elephantanimal
23bearanimal
24zebraanimal
25giraffeanimal
26hataccessory
27backpackaccessory
28umbrellaaccessory
29shoeaccessory
30eye glassesaccessory
31handbagaccessory
32tieaccessory
33suitcaseaccessory
34frisbeesports
35skissports
36snowboardsports
37sports ballsports
38kitesports
39baseball batsports
40baseball glovesports
41skateboardsports
42surfboardsports
43tennis racketsports
44bottlekitchen
45platekitchen
46wine glasskitchen
47cupkitchen
48forkkitchen
49knifekitchen
50spoonkitchen
51bowlkitchen
52bananafood
53applefood
54sandwichfood
55orangefood
56broccolifood
57carrotfood
58hot dogfood
59pizzafood
60donutfood
61cakefood
62chairfurniture
63couchfurniture
64potted plantfurniture
65bedfurniture
66mirrorfurniture
67dining tablefurniture
68windowfurniture
69deskfurniture
70toiletfurniture
71doorfurniture
72tvelectronic
73laptopelectronic
74mouseelectronic
75remoteelectronic
76keyboardelectronic
77cell phoneelectronic
78microwaveappliance
79ovenappliance
80toasterappliance
81sinkappliance
82refrigeratorappliance
83blenderappliance
84bookindoor
85clockindoor
86vaseindoor
87scissorsindoor
88teddy bearindoor
89hair drierindoor
90toothbrushindoor
91hair brushindoor

Accessing Object Detection in Block Coding

Following is the process to add Object Detection capability to the PictoBlox Project.

  1. Open PictoBlox and create a new file.
  2. Select the coding environment as appropriate Coding Environment.
  3. Next, click on the Add Extension button and add the Object Detection extension.
  4. The object detection models will be downloaded, which may take a few seconds to load.
    Downloading Models
  5. Once downloaded you will get a message saying “Model loaded successfully”.
  6. You can find the object detection blocks available in the project.

Accessing Object Detection in Python Coding

Following is the process to add Object Detection capability to the PictoBlox Project.

  1. Open PictoBlox and create a new file.
  2. Select the coding environment as Block Coding.
  3. Next, click on the Add Modules/Libraries button and add the Face Detection extension.
  4. To access the library functions, you have to add the object declaration.
    od = ObjectDetection()

Python Functions

The function is used to control the state of the camera.
Syntax: video(video_state = “on”, transparency = 1)
The function enables the automatic display of the box on object detection on the stage.
Syntax: enablebox()
The function disables the automatic display of the box on object detection on the stage.
Syntax: disablebox()
This function is used to set the threshold for the confidence (accuracy) of object detection, 0 being low confidence and 1 being high confidence.
Syntax: setthreshold(threshold = 0.5)
This function is used to analyze the image received as input from the camera, for objects.
Syntax: analysecamera()
This function is used to analyze the image received as input from the stage, for objects.
Syntax: analysestage()
This function returns the total number of objects detected in the camera feed or the stage.
Syntax: count()
This function returns the x position of the object detected. You can specify the object for which the value is needed. The position is mapped with the stage coordinates.
Syntax: x(object = 1)
This function returns the y position of the object detected. You can specify the object for which the value is needed. The position is mapped with the stage coordinates.
Syntax: y(object = 1)
This function returns the width of the object detected. You can specify the object for which the value is needed. The position is mapped with the stage coordinates.
Syntax: width(object = 1)
This function returns the height of the object detected. You can specify the object for which the value is needed. The position is mapped with the stage coordinates.
Syntax: height(object = 1)
This function is used to get the class name of the analyzed object.
Syntax: classname(object = 1)
This function is used to get the confidence (accuracy) of object detection, 0 being low confidence and 1 being high confidence.
Syntax: confidence(object = 1)
The function returns whether the specified object is detected in the analysis or not. 
Syntax: isdetected(object_name = “person”)
The function returns whether the number of objects identified with the specified object class.
Syntax: detectedcount(object_name = “person”)
All articles loaded
No more articles to load

Python Coding Examples

PictoBlox Blocks

turn () video on stage with () % transparency block controls the control the camera feed on the stage.
The block enables or disables the automatic display of the box on object detection on the stage. This is useful when you want to see if the object detection happens during the analysis or not.
This block is used to set the threshold for the confidence (accuracy) of object detection, 0 being low confidence and 1 being high confidence. With the threshold value, you can set the level of confidence required for object detection.
The block analyses the image and saves the face information locally, which can be accessed using other blocks.
Once you have analyzed the images, you can use the get # of objects block to get the number of objects recognized in the image.
The () of object () block reports the following attributes of the object: class, x position, y position, width, height, and confidence.
The is () detected? block checks whether the selected class has been detected or not. If the class is detected, then the block returns true; else, false.
The block returns the number of objects identified with the specified object class.
All articles loaded
No more articles to load

Block Coding Examples

Table of Contents