Configuration
The Blur container provides different modes of usage:
- CLI - As a Command Line Application processing a folder of images
- Server - As a server exposing a REST API.
note
CLI is the default run mode, To start the container as a server:
- You must include this option in the run command
-e SERVER=1
- The server listens on port 8001 so might need to map it to a desired port on the HOST (add
-p 3000:8001
) or maintain the port by using host networking (add--net=host
)
#
Common ParametersThese parameters apply when running both as CLI or Server
#
-e KEY=pass (required)Specify the container password
Format: -e KEY=passcode
Example: -e KEY=password123
#
-e BLUR= (optional)Control the blur intensity applied. Default is 4.
- Min Blur -e BLUR=10
- Max Blur -e BLUR=1
#
-e LOGO= (optional)Use a different image to cover the plate area instead of blurring.
Examples:
- Default logo(Platerecognizer):
-e LOGO=
- Custom logo:
- Share your logos directory by adding this option to the run command:
-v /tmp/logos:/logos
- Any file named logo.png in your logos directory will act as the default
- If there is no default you should specify a different file like so
-e LOGO=’/logos/logo2.png’
- Share your logos directory by adding this option to the run command:
#
-e FACES= (optional)Used with -e BLUR
. Also blur faces in the images.
#
-e REGIONS= (optional)Specify the regions used in detection.
Format: -e REGIONS=<region1,region2,region3>
Example: -e REGIONS=gb
Example: -e REGIONS=in,us
#
-e REGION_STRICT= (optional)Used with -e REGIONS
. Blur only plates that match the region's format.
Format: -e REGION_STRICT=
#
-e DETECTION_STRICT= (optional)Blur only plates that have a vehicle bounding box.
Format: -e DETECTION_STRICT=
#
-e SHAPE= (optional)Used with -e FACES
. Specify the shape used for blurring.
Format: -e SHAPE=<shape>
Shape can be any of the below options
- ellipse (default)
- circle
- square
Example: -e SHAPE=circle
#
-e SDK_URL= (optional)Use Snapshot SDK rather than CloudAPI (default).
Format: -e SDK_URL=’<protocol>://<host>:<port>’
Example: -e SDK_URL='http://localhost:8080'
Full Example:
docker run \ -it \ -e KEY=password123 \ -v /home/brian/images:/images \ -e TOKEN=MY_TOKEN \ -e SDK_URL='http://localhost:8080' \ platerecognizer/skew-correction
#
-e TOKEN= (optional if using OnPremise Snapshot SDK)Provide the Cloud API Token
Format: -e TOKEN=###########
Example: -e TOKEN=22333f3e33r3##################
Full Example:
docker run \ -it \ -e KEY=password123 \ -v /home/brian/images:/images \ -e TOKEN=MY_TOKEN \ -e BLUR=10 \ platerecognizer/skew-correction
#
-e PLATE_DETECTION_THRESHOLD=t (optional)Specify a threshold for plate confidence to be included in the results.
Format -e PLATE_DETECTION_THRESHOLD=<t>
The value t should be between 0.1 and 1
Example -e PLATE_DETECTION_THRESHOLD=0.7
#
-e FACE_DETECTION_THRESHOLD=t (optional)Specify a threshold for face confidence to be included in the results.
Format -e FACE_DETECTION_THRESHOLD=<t>
The value t should be between 0.1 and 1
Example -e FACE_DETECTION_THRESHOLD=0.7
#
-e SKIP_REGEXP=regex1,regex2 (optional)Exclude plates that match a list of regexes from the results.
Example -e SKIP_REGEXP=adwdwd,3344ff,sds33
#
CLI ParametersThese parameters apply when running as a CLI Application
#
-vSpecify the directory containing the images.
Format: -v path-to-images-folder:/images
Example: -v /home/brian/VehicleLicensePlates:/images
#
Server ParametersThese parameters apply when running as a Server
The server exposes a single API endpoint at the root of the server (e.g http://localhost:8001/)
The allowed request method is POST.
tip
If you need a param set for all requests, considering using it's common equivalent.
e.g Blur all uploaded images by adding -e BLUR=4
to the run command instead of adding blur=4
to each request.
#
uploadImage file to process
#
blurBlur intesity of the upload
.
Example blur=3
Exclude this param if you are only interested in the unskewed bounding box (the default).
#
detection_rule_strictOnly consider plates that have a vehicle bb detected
#
regionsRegions to format plates in.
This param can be specified multiple times
#
region_strictOnly consider plates that match regions format.
When specified, -e REGIONS=
or regions
param must also be specified.
#
skip_regexpSkip plates that match these regexes, can be specified multiple times.
This param can be specified multiple times
Example:
Detected plate = KAXZ 7226882
Regexes that will exclude this plate:
KAXZ 7226882KAXK7226882Z 72268
Regexes that won't exclude this plate:
KXZKAXZ 7226882555AX 82
#
facesProcess faces too, Exclude if you are only interestade in plates (the default).
Example faces=true
#
logoUse a logo for blurring.
Example logo=1
#
threshold_dSkip any detection whose confidence is lower.
Specifying any of these params overrides any set as an env var in the run command.
The response is in JSON format. Check for error
key existence in responses to verify success of the request.
#
Command ExamplesProviding a different Snapshot SDK URL:
docker run \ -it \ -e KEY=password123 \ -v /home/brian/images:/images \ -e TOKEN=MY_TOKEN \ -e SDK_URL='http://localhost:8080' \ platerecognizer/skew-correction
Example of providing blur intensity of 7:
docker run \ -it \ -e KEY=password123 \ -v /home/brian/images:/images \ -e TOKEN=MY_TOKEN \ -e BLUR=7 \ platerecognizer/skew-correction
Example of running as a server and uploading images using the REST API. Note: that this only gives back the unskewed bounding box(s) and so you’ll need to perform blurring externally.
docker run \ -it \ -p 3000:8001 \ -e KEY=password123 \ -e SERVER=1 \ platerecognizer/skew-correction
Example of using CURL to send an image to blur for the skew-corrected bounding box.
curl -F 'upload=@/tmp/car.jpg' http://localhost:3000/
Sample API response:
{"faces": [],"results": [ { "polygon": [ [ 157.375, 494.484375 ], [ 272.546875, 544.453125 ], [ 268.890625, 581.625 ], [ 153.109375, 531.65625 ] ], "result": { "box": { "xmax": 276, "xmin": 146, "ymax": 576, "ymin": 481 }, "candidates": [ { "plate": "nhk552", "score": 0.899 } ], "dscore": 0.9252, "plate": "nhk552", "region": { "code": "gb", "score": 0.985 }, "score": 0.899, "vehicle": { "box": { "xmax": 914, "xmin": 68, "ymax": 643, "ymin": 103 }, "score": 0.834, "type": "Sedan" } } }]}
When using the API, Face bounding boxes won't be included by default. Use any of these 2 options to include them:
- Include the env variable -e FACES=1 when running the container
- Include this param faces=true when making an API call
Sample API response with faces:
{"faces": [ { "box": { "xmax": 326, "xmin": 300, "ymax": 137, "ymin": 100 }, "score": 0.7088521122932434 }, { "box": { "xmax": 104, "xmin": 90, "ymax": 100, "ymin": 83 }, "score": 0.6313210725784302 }, { "box": { "xmax": 52, "xmin": 39, "ymax": 114, "ymin": 98 }, "score": 0.5979868769645691 }, { "box": { "xmax": 37, "xmin": 20, "ymax": 113, "ymin": 93 }, "score": 0.5521909594535828 }, { "box": { "xmax": 518, "xmin": 502, "ymax": 135, "ymin": 117 }, "score": 0.5192767381668091 }, { "box": { "xmax": 10, "xmin": 0, "ymax": 97, "ymin": 85 }, "score": 0.3350403606891632 }],"results": [ { "polygon": [ [ 157.375, 494.484375 ], [ 272.546875, 544.453125 ], [ 268.890625, 581.625 ], [ 153.109375, 531.65625 ] ], "result": { "box": { "xmax": 276, "xmin": 146, "ymax": 576, "ymin": 481 }, "candidates": [ { "plate": "nhk552", "score": 0.899 } ], "dscore": 0.9252, "plate": "nhk552", "region": { "code": "gb", "score": 0.985 }, "score": 0.899, "vehicle": { "box": { "xmax": 914, "xmin": 68, "ymax": 643, "ymin": 103 }, "score": 0.834, "type": "Sedan" } } }]}