Celantur Container API Examples

Start the server

Start the server with all object types (-a face -a license-plate -a person -a vehicle) that you want to anonymise through the API. You can select specific objects for individual images using API calls.

bash celantur.sh --api --api-endpoint http://localhost:7000/ -a face -a license-plate -a person -a vehicle --format whole

Check server status

curl -i -X GET 'http://127.0.0.1:8000/v1/file/status'
{
    "status": "RUNNING"
}  

Upload image for anonymisation

Pixelate face

curl -i -X POST 'http://127.0.0.1:8000/v1/file?method=pixelate&face=True' -F 'fileobject=@/path/to/original-image.jpg'

Pixelated face

Blur whole person and show bounding box (for debugging)

Method should be entered everytime as it is a required parameter, here (blur) method is given.

curl -i -X POST 'http://127.0.0.1:8000/v1/file?method=blur&debug=True&person=True' -F 'fileobject=@/path/to/original-image.jpg'

Blured face

Post method returns image id with GET request links.

{
    "content-type": "image/jpeg",
    "id": "{image_id}",
    "metadata-url": "http://localhost:8000/v1/file/{image_id}/metadata",
    "binary-mask-url": "http://localhost:8000/v1/file/{image_id}/binary-mask",
    "instance-mask-url": "http://localhost:8000/v1/file/{image_id}/instance-mask",
    "anonymised-url": "http://localhost:8000/v1/file/{image_id}/anonymised"
}    

Download anonymised image

curl -X GET http://127.0.0.1:8000/v1/file/{image_id}/anonymised --output /path/to/anonymised-image.jpg

Download segmentation mask

curl -X GET http://127.0.0.1:8000/v1/file/{image_id}/binary-mask --output /path/to/binary-mask.png

Segmentation mask

Download instance segmentation mask

curl -X GET http://127.0.0.1:8000/v1/file/{image_id}/instance-mask --output /path/to/instance-mask.png

Download downscaled instance segmentation mask

curl -X GET http://127.0.0.1:8000/v1/file/{image_id}/instance-mask?mask-scale=50 --output /path/to/instance-mask.png

Instance segmentation

Download metadata

curl -X GET http://127.0.0.1:8000/v1/file/{image_id}/metadata
{
    "id": "omar-lopez-rwF_pJRWhAI-unsplash.jpg",
    "detections": [
        {
            "id": 0,
            "parent_image": "omar-lopez-rwF_pJRWhAI-unsplash.jpg",
            "offset": [
                1560,
                744
            ],
            "bbox": [
                1957,
                744,
                3003,
                1855
            ],
            "type": 103,
            "score": 0.9993754029273987,
            "is_anonymised": true,
            "type_label": "face",
            "color": null
        },
        {
            "id": 0,
            "parent_image": "omar-lopez-rwF_pJRWhAI-unsplash.jpg",
            "offset": [
                2682,
                760
            ],
            "bbox": [
                3091,
                760,
                4078,
                1680
            ],
            "type": 103,
            "score": 0.9989292025566101,
            "is_anonymised": true,
            "type_label": "face",
            "color": null
        },
        {
            "id": 0,
            "parent_image": "omar-lopez-rwF_pJRWhAI-unsplash.jpg",
            "offset": [
                3736,
                712
            ],
            "bbox": [
                4015,
                758,
                4777,
                1520
            ],
            "type": 103,
            "score": 0.9988161325454712,
            "is_anonymised": true,
            "type_label": "face",
            "color": null
        }
    ],
    "size": [
        3456,
        5184
    ],
    "duration": 1.8533296539999355,
    "filename": "omar-lopez-rwF_pJRWhAI-unsplash.jpg",
    "folder": null
}

Credits

Photo by Omar Lopez on Unsplash