> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/developer/rest-api/model-evaluations/performance-by-class.md).

# Performance by Class

Returns per-class headline metrics for one split. The response shape depends on the evaluation's task type:

* **Object detection / instance segmentation** - per-class `map50`, `map50_95`, `map75`, precision, recall, F1, and optimal threshold.
* **Semantic segmentation** - per-class `iou`, precision, recall, F1, and optimal threshold (pixel-level).

The `taskType` field in the response indicates which shape to expect.

This is the data the **performance by class** panel in the app reads.

```url
https://api.roboflow.com/:workspace/model-evals/:evalId/performance-by-class
```

```bash
curl "https://api.roboflow.com/my-workspace/model-evals/$EVAL_ID/performance-by-class?api_key=$ROBOFLOW_API_KEY&split=test"
```

## Query parameters

| Parameter | Type | Description                                                                                                                        |
| --------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `split`   | enum | One of `train`, `valid`, `test`. Default `test`. `all` is **not** valid here - per-class metrics are not aggregable across splits. |

## Response (object detection / instance segmentation)

```json
{
    "taskType": "object-detection-like",
    "split": "test",
    "classes": [
        {
            "className": "Car-rims",
            "map50": 0.9239650566041828,
            "map50_95": 0.7555258345429926,
            "map75": 0.9239650566041828,
            "precision": 0.85,
            "recall": 0.85,
            "f1": 0.85,
            "optimalThreshold": 0.37
        },
        {
            "className": "music-note",
            "map50": null,
            "map50_95": null,
            "map75": null,
            "precision": 0,
            "recall": 0,
            "f1": 0,
            "optimalThreshold": 0.5
        }
    ]
}
```

## Response (semantic segmentation)

```json
{
    "taskType": "semantic-segmentation",
    "split": "test",
    "classes": [
        {
            "classID": 3,
            "className": "multi",
            "iou": 0.816,
            "precision": 0.938,
            "recall": 0.862,
            "f1": 0.898,
            "optimalThreshold": 0.0
        }
    ]
}
```

## Notes

* `taskType` discriminates the per-class field set. Detection classes include `map50`/`map50_95`/`map75`; semantic segmentation classes include `iou` and `classID` instead.
* `optimalThreshold` is the per-class F1-optimal confidence threshold from the confidence sweep.
* `precision`, `recall`, and `f1` are reported at that per-class optimal threshold.
* For detection, mAP fields are `null` when the split has no instances of that class.
* For semantic segmentation, all metrics are pixel-level. An `optimalThreshold` of `0.0` is valid.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/developer/rest-api/model-evaluations/performance-by-class.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
