Docker Configuration
#
Start on BootTo run the container automatically on system startup, run the container using the --restart always
option.
For a complete list of start options see Docker start on boot.
docker run \ --restart always \ -t \ -p 8080:8080 \ -v license:/license \ -e TOKEN=YYYYY \ -e LICENSE_KEY=XXXXX \ platerecognizer/alpr
danger
For the command above, make sure to change XXXXX to the License Key and YYYYY to your Plate Recognizer Token. Get your Token.
#
Networking- Add
--network=host
to use the host's networking directly. - You may use a different port if 8080 is already used. For example, to use port 8888 do
-p 8888:8080
. - Add
--detach
to run container in background.
#
Are you experiencing connection errors (Failed to establish a new connection)?After a resume from sleep or on an unstable network (lots of deconnections), the overlay network may stop working. Restarting Docker Desktop or the Docker daemon will fix this issue. Another solution is to switch to host networking (see above).
#
Speed Optimization- By default the SDK starts a single worker process. To fully use the machine's compute, you can enable multiple workers. For example, adding
-e WORKERS=2
todocker run
will start 2 worker processes.- When this is enabled, it is preferred to call the API in a multi-threaded fashion.
- When Snapshot is processing a request, 15-20% of the work is done on a single core and the rest is using all the cores. On a device with 2 cores or less changing WORKERS will not make much difference. It can be interesting to play with that knob when the device has 4-8 cores.
- When using our GPU image, you can set the environment variable
PROCESS_GPU_FRACTION
. By default it will use 100% of the GPU RAM. If set to 0.5 it will use 50%. This can be combined with theWORKERS
variable. For example, with 2 workers, you would use-e WORKERS=2 -e PROCESS_GPU_FRACTION=0.5
. - Faster inference can also be achieved using the
config
parameter. See details in our documentation. - When using a compressed image format like JPEG or PNG, the SDK will need to decode the image before processing it. To skip the decoding step, prefer an uncompressed format like BMP, PPM, PNM or SGI.