Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2680,6 +2680,46 @@ if __name__ == '__main__':
cv2.imwrite(RESULT_IMAGE_FILE_PATH, img)
```

## Model Monitoring
### Create Request Results
You can integrate the results of model endpoint calls,
which are targeted for aggregation in model monitoring, from an external source.


```python
from datetime import datetime
import pytz
import fastlabel
client = fastlabel.Client()

jst = pytz.timezone("Asia/Tokyo")
dt_jst = datetime(2023, 5, 8, 12, 10, 53, tzinfo=jst)

client.create_model_monitoring_request_results(
name="model-monitoring-name", # The name of your model monitoring name
results=[
{
"status": "success", # success or failed
"result": [
{
"annotationIndex": 0, # The index of the inference class returned by your model
"value": "person", # The value of the inference class returned by your model
"points": [
12.98,
23.84,
140.83,
165.82,
], # [x_min, y_min, x_max,y_max]
"confidenceScore": 0.92, # 0 ~ 1
}
],
"resultSchema": "object_detection_base", # Currently, only 'object_detection_base' can be selected.
"requestAt": dt_jst.isoformat(), # The time when your endpoint accepted the request
}
],
)
```

## API Docs

Check [this](https://api.fastlabel.ai/docs/) for further information.
16 changes: 16 additions & 0 deletions fastlabel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3633,3 +3633,19 @@ def execute_endpoint(
"file": utils.base64_encode(file_path),
}
return self.api.post_request(endpoint, payload=payload)

def create_model_monitoring_request_results(
self,
name: str,
results: list = [],
) -> str:
"""
Create model monitoring request results.
name is an unique identifier of model monitoring setting in your workspace (Required).
results is a list of request result to be set (Required).
"""
endpoint = "model-monitorings/create"

payload = {"name": name, "results": results}

return self.api.post_request(endpoint, payload=payload)