# Simple Object Detection Action

Perform object detection on images directly in Soracom.

The Simple Object Detection Action detects objects in a still image and sends the object information to the destination channel.

By default, the action counts detected objects for the following 6 default classes: Person, Car, Bus, Truck, Cat, and Dog. In addition, all detected objects (including other classes) are included in the `objects` array.

You can optionally configure **Target Object Classes** to specify which object classes to include in the detection results. When configured, the action filters detections so that only the specified object classes are included in the `objects` array, and the output still returns count fields only for the 6 default classes.

## Configuration

In the **Action Condition** input field, you can specify the conditions under which the action will be executed using the values (Message or Context) from the event source to the channel.

### Configuring Simple Object Detection Action

The **Image URL** field supports [expressions](https://docs.soracom.io/en/services/flux/action-expressions).

- **Image URL**: Specify the URL of the still image to be used for simple object detection.
  - Example expression: `${event.payload.presignedUrls.get}` (to perform simple object detection on a file uploaded to Soracom Harvest Files).
- **Target Object Classes**: Specify the object classes to include in the detection results. If no selection is made, all supported object classes will be targeted for detection. You can select multiple object classes. For a full list, refer to [Supported Object Classes](https://docs.soracom.io/en/services/flux/simple-object-detection/#supported-object-classes).

### Output

Set up how the action's output data will be processed. Refer to [Enable Republishing of Action Output](https://docs.soracom.io/en/services/flux/action-output#enable-republishing-of-action-output) for more details.

## Output Data of the Action

By default, the output data includes the count for each of the 6 default classes and an `objects` array containing all detected objects. The `objects` array includes objects from both the default classes and other supported classes. The following example shows a person and a cup detected in the image:

```json
{
  "person": 1,
  "car": 0,
  "bus": 0,
  "truck": 0,
  "cat": 0,
  "dog": 0,
  "objects": [
    {
      "location": [
        0.42561606168746946,
        0.3883926073710124,
        0.5880238652229309,
        0.8953371047973633
      ],
      "score": 0.6473677158355713,
      "label": "person",
      "ts": "2024-06-17T05:28:24Z"
    },
    {
      "location": [
        0.3454461991786957,
        0.6387763867775599,
        0.39976382851600645,
        0.739234521985054
      ],
      "score": 0.5285048484802246,
      "label": "cup",
      "ts": "2024-06-17T05:28:24Z"
    }
  ]
}
```

> [!WARNING]
>
> The count fields are provided only for the 6 default classes. Other detected object classes are included in the `objects` array but are not counted in separate fields.

When **Target Object Classes** is configured (e.g., `truck`), the action filters the detection results so that only objects belonging to the specified object classes are included in the `objects` array. The response still contains count fields only for the 6 default classes. These counts reflect detections of those default classes within the filtered results. For example, when a truck is detected:

```json
{
  "person": 0,
  "car": 0,
  "bus": 0,
  "truck": 1,
  "cat": 0,
  "dog": 0,
  "objects": [
    {
      "location": [
        0.04083414,
        0.21190794,
        0.4107799,
        0.8861815
      ],
      "score": 0.91171336,
      "label": "truck",
      "ts": "2026-03-16T23:39:13Z"
    }
  ]
}
```

When no objects matching the specified object classes are detected:

```json
{
  "person": 0,
  "car": 0,
  "bus": 0,
  "truck": 0,
  "cat": 0,
  "dog": 0,
  "objects": []
}
```

The output data includes the following attributes:

| Field | Description |
| - | - |
| `person` | Number of detected people. |
| `car` | Number of detected cars. |
| `bus` | Number of detected buses. |
| `truck` | Number of detected trucks. |
| `cat` | Number of detected cats. |
| `dog` | Number of detected dogs. |
| `objects[]` | Information about the objects detected by the Simple Object Detection Action. |
| `objects[].location` | The position of the detected object within the still image. |
| `objects[].score` | Confidence score indicating the accuracy of the detected object. |
| `objects[].label` | Detected object label. |
| `objects[].ts` | Date and time when the object was detected. |

## Supported Object Classes

| Class Label | ID | Class Label | ID |
| - | - | - | - |
| Airplane | airplane | Microwave | microwave |
| Apple | apple | Motorcycle | motorcycle |
| Backpack | backpack | Mouse | mouse |
| Banana | banana | Orange | orange |
| Baseball Bat | baseball bat | Oven | oven |
| Baseball Glove | baseball glove | Parking Meter | parking meter |
| Bear | bear | Person | person |
| Bed | bed | Pizza | pizza |
| Bench | bench | Potted Plant | potted plant |
| Bicycle | bicycle | Refrigerator | refrigerator |
| Bird | bird | Remote | remote |
| Boat | boat | Sandwich | sandwich |
| Book | book | Scissors | scissors |
| Bottle | bottle | Sheep | sheep |
| Bowl | bowl | Sink | sink |
| Broccoli | broccoli | Skateboard | skateboard |
| Bus | bus | Skis | skis |
| Cake | cake | Snowboard | snowboard |
| Car | car | Spoon | spoon |
| Carrot | carrot | Sports Ball | sports ball |
| Cat | cat | Stop Sign | stop sign |
| Cell Phone | cell phone | Suitcase | suitcase |
| Chair | chair | Surfboard | surfboard |
| Clock | clock | Teddy Bear | teddy bear |
| Couch | couch | Tennis Racket | tennis racket |
| Cow | cow | Tie | tie |
| Cup | cup | Toaster | toaster |
| Dining Table | dining table | Toilet | toilet |
| Dog | dog | Toothbrush | toothbrush |
| Donut | donut | Traffic Light | traffic light |
| Elephant | elephant | Train | train |
| Fire Hydrant | fire hydrant | Truck | truck |
| Fork | fork | TV | tv |
| Frisbee | frisbee | Umbrella | umbrella |
| Giraffe | giraffe | Vase | vase |
| Hair Drier | hair drier | Wine Glass | wine glass |
| Handbag | handbag | Zebra | zebra |
| Horse | horse | | |
| Hot Dog | hot dog | | |
| Keyboard | keyboard | | |
| Kite | kite | | |
| Knife | knife | | |
| Laptop | laptop | | |
