Manual Installation Steps
You can go through the steps below to manually install USDOT OCR On Premise with Docker.
For the commands below, make sure to replace XXXXX with the License Key and YYYYY with your API Token. Get your token and license key. Please use On-Premise Licenses.
List of Docker Images
The Docker image is available for linux/amd64 architecture. The image structure is:
platerecognizer/usdot:<version>
<version>
: leave blank for latest.- To see the list of tags, select the USDOT image from Docker Hub and then click "Tags".
Examples:
- Specific version:
platerecognizer/usdot:0.1.4
- Latest version:
platerecognizer/usdot:latest
orplaterecognizer/usdot
Installation
Installation on an Intel CPU
Abbreviated installation steps below. For a detailed, step-by-step guide, see the Install Docker and SDK on Windows and the associated FAQ.
- Sign up and log in.
- Subscribe to a USDOT OCR On Premise plan.
- Install Docker on your local machine. See requirements.
- Get our On Premise image:
docker pull platerecognizer/usdot
- Install and run the docker container:
docker run --restart="unless-stopped" -t -p 8001:8001 -v license:/license -e TOKEN=YYYYY -e LICENSE_KEY=XXXXX platerecognizer/usdot
Testing the API
Once the container is running, you can test it by sending a sample image.
- Linux
- Windows
# Get a sample picture
curl -o /tmp/usdot.jpg https://app.platerecognizer.com/static/usdot_demo.jpg
# Read USDOT information
curl -F 'image=@/tmp/usdot.jpg' http://localhost:8001/predict/
# Get a sample picture
curl -o usdot.jpg https://app.platerecognizer.com/static/usdot_demo.jpg
# Read USDOT information
curl -F "[email protected]" http://localhost:8001/predict/
If successful, you will receive a JSON response with the extracted DOT number and details. See the output format documentation.
Consuming the API
The On-Premise app also exposes Swagger UI at:
http://localhost:8001/docs
From Swagger UI, you can explore endpoints, test parameters, and review available fields.
Example with Parameters
- cURL
- Python
- JavaScript
curl -F '[email protected]' -F 'min_detection_score=0.2' -F 'min_ocr_score=0.6' -F 'camera_id=1' -F 'timestamp=2023-01-01T12:00:00' http://localhost:8001/predict/
import requests
url = "http://localhost:8001/predict/"
files = {"image": open("usdot.jpg", "rb")}
data = {
"min_detection_score": 0.2,
"min_ocr_score": 0.6,
"camera_id": 1,
"timestamp": "2023-01-01T12:00:00"
}
response = requests.post(url, files=files, data=data)
print(response.json())
const fs = require("fs");
const fetch = require("node-fetch");
const FormData = require("form-data");
const form = new FormData();
form.append("image", fs.createReadStream("usdot.jpg"));
form.append("min_detection_score", "0.2");
form.append("min_ocr_score", "0.6");
form.append("camera_id", "1");
form.append("timestamp", "2023-01-01T12:00:00");
fetch("http://localhost:8001/predict/", { method: "POST", body: form })
.then((res) => res.json())
.then((json) => console.log(json));