# Object detection ((pro))

imgproxy can detect objects in the image and use them for smart cropping, bluring the detections, or drawing the detections. You can also [fetch the detected objects info](../usage/getting_info.mdx#detect-objects).

For object detection purposes, imgproxy uses the [Darknet YOLO](https://github.com/AlexeyAB/darknet) model. We provide Docker images with a model trained for face detection, but you can use any Darknet YOLO model found in the [zoo](https://github.com/AlexeyAB/darknet/wiki/YOLOv4-model-zoo) or you can train your own model by following this [guide](https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects).

## Configuration

You need to define four config variables to enable object detection:

* `IMGPROXY_OBJECT_DETECTION_CONFIG`: a path to the neural network config
* `IMGPROXY_OBJECT_DETECTION_WEIGHTS`: a path to the neural network weights
* `IMGPROXY_OBJECT_DETECTION_CLASSES`: a path to the text file with the classes names, one per line
* `IMGPROXY_OBJECT_DETECTION_NET_SIZE`: the size of the neural network input. The width and the heights of the inputs should be the same, so this config value should be a single number. Default: 416

Read the [configuration options guide](../configuration/options.mdx#object-detection) for more config values info.

## Usage examples
### Object-oriented crop

You can [crop](../usage/processing.mdx#crop) your images and keep objects of desired classes in frame:

```imgproxy_url
.../crop:256:256/g:obj:face/...
```

### Bluring detections

You can [blur objects](../usage/processing.mdx#blur-detections) of desired classes, thus making anonymization or hiding NSFW content possible:

```imgproxy_url
.../blur_detections:7:face/...
```

### Draw detections

You can make imgproxy [draw bounding boxes](../usage/processing.mdx#draw-detections) for the detected objects of the desired classes (this is handy for testing your models):

```imgproxy_url
.../draw_detections:1:face/...
```

### Fetch the detected objects info

You can [fetch the detected objects info](../usage/getting_info.mdx#detect-objects) using the `/info` endpoint:

```imgproxy_url
.../info/detect_objects:1/...
```

---

## Navigation

- [Getting started](/3.23.x/getting_started)
- [imgproxy Pro](https://imgproxy.net#pro)
- [Installation](/3.23.x/installation)
- [Configuration](/3.23.x/category/configuration)
  - [Configuration options](/3.23.x/configuration/options)
  - [Loading environment variables](/3.23.x/configuration/loading_environment_variables)
- [Usage](/3.23.x/category/usage)
  - [Processing an image](/3.23.x/usage/processing)
  - [Getting an image info](/3.23.x/usage/getting_info)
  - [Signing a URL](/3.23.x/usage/signing_url)
  - [Encrypting a source URL](/3.23.x/usage/encrypting_source_url)
  - [Presets](/3.23.x/usage/presets)
- [Features](/3.23.x/category/features)
  - [Watermark](/3.23.x/features/watermark)
  - [Object detection](/3.23.x/features/object_detection)
  - [Autoquality](/3.23.x/features/autoquality)
  - [Best format](/3.23.x/features/best_format)
  - [Chained pipelines](/3.23.x/features/chained_pipelines)
- [Image sources](/3.23.x/category/image-sources)
  - [Serving local files](/3.23.x/image_sources/local_files)
  - [Serving files from Amazon S3](/3.23.x/image_sources/amazon_s3)
  - [Serving files from Google Cloud Storage](/3.23.x/image_sources/google_cloud_storage)
  - [Serving files from Azure Blob Storage](/3.23.x/image_sources/azure_blob_storage)
  - [Serving files from OpenStack Object Storage ("Swift")](/3.23.x/image_sources/openstack_swift)
- [Monitoring](/3.23.x/category/monitoring)
  - [New Relic](/3.23.x/monitoring/new_relic)
  - [Prometheus](/3.23.x/monitoring/prometheus)
  - [Datadog](/3.23.x/monitoring/datadog)
  - [OpenTelemetry](/3.23.x/monitoring/open_telemetry)
  - [Amazon CloudWatch](/3.23.x/monitoring/cloud_watch)
- [Image formats support](/3.23.x/image_formats_support)
- [About the processing pipeline](/3.23.x/about_processing_pipeline)
- [Health check](/3.23.x/healthcheck)
- [Memory usage tweaks](/3.23.x/memory_usage_tweaks)

## Other versions

- [4.0.x (current)](/features/object_detection)
- [latest (unstable)](/latest/features/object_detection)
- [3.31.x](/3.31.x/features/object_detection)
- [3.30.x](/3.30.x/features/object_detection)
- [3.29.x](/3.29.x/features/object_detection)
- [3.28.x](/3.28.x/features/object_detection)
- [3.27.x](/3.27.x/features/object_detection)
- [3.26.x](/3.26.x/features/object_detection)
- [3.25.x](/3.25.x/features/object_detection)
- [3.24.x](/3.24.x/features/object_detection)
- [3.22.x](/3.22.x/features/object_detection)
- [3.21.x](/3.21.x/features/object_detection)
- [3.20.x](/3.20.x/features/object_detection)
- [3.19.x](/3.19.x/features/object_detection)
