Skip to content
Open
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
12 changes: 6 additions & 6 deletions daemon/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM ubuntu:18.04
MAINTAINER Matt Hill <matthill@openalpr.com>
FROM ubuntu:22.04
LABEL maintainer="Matt Hill <matthill@openalpr.com>"


# Setup gpg key and deb repo
RUN apt-get update && apt-get install -y curl gnupg && \
curl -sSL http://deb.openalpr.com/openalpr.gpg.key | apt-key add - && \
echo "deb http://deb.openalpr.com/bionic/ bionic main" > /etc/apt/sources.list.d/openalpr.list && \
apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y --no-install-recommends curl gnupg && \
curl -sSL https://deb.openalpr.com/openalpr.gpg.key | apt-key add - && \
echo "deb https://deb.openalpr.com/jammy/ jammy main" > /etc/apt/sources.list.d/openalpr.list && \
apt-get update && apt-get install -y --no-install-recommends \
libalprstream-dev \
openalpr \
openalpr-daemon \
Expand Down
15 changes: 7 additions & 8 deletions daemon/Dockerfile.nvidia
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM nvidia/cuda:8.0-cudnn6-runtime-ubuntu16.04

MAINTAINER Matt Hill <matthill@openalpr.com>
# JetPack 4.6 — CUDA 10.4, Ubuntu 18.04 (L4T base)
FROM nvidia/cuda:10.2-runtime-ubuntu18.04
LABEL maintainer="Matt Hill <matthill@openalpr.com>"

# Setup gpg key and deb repo
RUN apt-get update && apt-get install -y wget && \
wget -qO - http://deb.openalpr.com/openalpr.gpg.key | apt-key add - && \
echo "deb http://deb.openalpr.com/xenial-commercial/ xenial main" > /etc/apt/sources.list.d/openalpr.list && \
apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y --no-install-recommends wget gnupg && \
wget -qO - https://deb.openalpr.com/openalpr.gpg.key | apt-key add - && \
echo "deb https://deb.openalpr.com/bionic/ bionic main" > /etc/apt/sources.list.d/openalpr.list && \
apt-get update && apt-get install -y --no-install-recommends \
openalpr \
openalprgpu \
openalpr-daemon \
Expand Down Expand Up @@ -40,4 +40,3 @@ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY alprd.conf /etc/openalpr/alprd.conf

CMD ["/usr/bin/supervisord"]

15 changes: 7 additions & 8 deletions daemon/Dockerfile.nvidia10
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM nvidia/cuda:10.0-runtime-ubuntu18.04

MAINTAINER Matt Hill <matthill@openalpr.com>
# JetPack 6.2.2 — CUDA 12.6, Ubuntu 22.04 (L4T base)
FROM nvidia/cuda:12.6.0-runtime-ubuntu22.04
LABEL maintainer="Matt Hill <matthill@openalpr.com>"

# Setup gpg key and deb repo
RUN apt-get update && apt-get install -y wget && \
wget -qO - http://deb.openalpr.com/openalpr.gpg.key | apt-key add - && \
echo "deb http://deb.openalpr.com/bionic/ bionic main" > /etc/apt/sources.list.d/openalpr.list && \
apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y --no-install-recommends wget gnupg && \
wget -qO - https://deb.openalpr.com/openalpr.gpg.key | apt-key add - && \
echo "deb https://deb.openalpr.com/jammy/ jammy main" > /etc/apt/sources.list.d/openalpr.list && \
apt-get update && apt-get install -y --no-install-recommends \
openalpr \
openalprgpu \
openalpr-daemon \
Expand Down Expand Up @@ -40,4 +40,3 @@ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY alprd.conf /etc/openalpr/alprd.conf

CMD ["/usr/bin/supervisord"]

12 changes: 6 additions & 6 deletions webservice/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
FROM openalpr/commercial-agent
MAINTAINER Matt Hill <matthill@openalpr.com>
LABEL maintainer="Matt Hill <matthill@openalpr.com>"


RUN apt-get update && apt-get install -y python-pip python-openalpr
RUN apt-get update && apt-get install -y --no-install-recommends python3-pip python3-openalpr && \
apt-get clean && rm -rf /var/lib/apt/lists/*

COPY src/requirements.txt /opt/openalprapi/

RUN pip install -r /opt/openalprapi/requirements.txt
RUN pip3 install --no-cache-dir -r /opt/openalprapi/requirements.txt

# send over the license key
# send over the license key
#COPY license.conf /etc/openalpr/license.conf

COPY src/webservice.py /opt/openalprapi/

EXPOSE 8080

CMD ["python", "/opt/openalprapi/webservice.py", "-p", "8080"]
CMD ["python3", "/opt/openalprapi/webservice.py", "-p", "8080"]
8 changes: 2 additions & 6 deletions webservice/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
argparse==1.2.1
backports.ssl-match-hostname==3.4.0.2
certifi==2015.04.28
futures==3.0.3
tornado==4.2.1
wsgiref==0.1.2
certifi>=2023.7.22
tornado>=6.3.0
33 changes: 17 additions & 16 deletions webservice/src/webservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
debug = options.debug

if options.threads > multiprocessing.cpu_count():
print "Warning, attempting to use %d threads when your system only has %d cores" % (options.threads, multiprocessing.cpu_count())
print("Warning, attempting to use %d threads when your system only has %d cores" % (options.threads, multiprocessing.cpu_count()))

executor = ThreadPoolExecutor(options.threads)

Expand All @@ -53,7 +53,7 @@ class AlprHandler(tornado.web.RequestHandler):
def post(self):


start = time.clock()
start = time.perf_counter()
response = {
'version': 1,
}
Expand Down Expand Up @@ -92,20 +92,20 @@ def post(self):
alpr_results = yield self.alpr_processor(jpeg_bytes, topn, state)


end = time.clock()
end = time.perf_counter()
if debug:
print "Total POST time: %.2f ms" % ((end - start) * 1000)
print("Total POST time: %.2f ms" % ((end - start) * 1000))

self.finish(json.dumps(alpr_results))

@run_on_executor(executor='executor')
def alpr_processor(self, image, topn, state):

thread_id = threading.currentThread().ident
thread_id = threading.current_thread().ident

if thread_id not in self.alpr_processes:
if debug:
print "Kicking off new ALPR process"
print("Kicking off new ALPR process")
self.alpr_processes[thread_id] = Alpr("us", "/etc/openalpr/openalpr.conf", "/usr/share/openalpr/runtime_data")
self.alpr_processes[thread_id].set_detect_region(True)

Expand All @@ -114,20 +114,21 @@ def alpr_processor(self, image, topn, state):
self.alpr_processes[thread_id].set_default_region(state)

if debug:
print "Starting alpr job"
print "back-queue size: %d" % executor._work_queue.qsize(),
print("Starting alpr job")
print("back-queue size: %d" % executor._work_queue.qsize())

print "args: topn %d, state: %s" % (topn, state)
print "Thread ID: " + str (threading.currentThread().ident)
print("args: topn %d, state: %s" % (topn, state))
print("Thread ID: " + str(threading.current_thread().ident))
try:
start = time.clock()
start = time.perf_counter()
results = self.alpr_processes[thread_id].recognize_array(image)
end = time.clock()
end = time.perf_counter()

if debug:
print "ALPR Processing time: %.2f ms" % ((end - start) * 1000)
print("ALPR Processing time: %.2f ms" % ((end - start) * 1000))
return results
except:
except Exception as e:
print("ALPR processing error: %s" % str(e))
return {'error': 'alpr_processing_error'}


Expand Down Expand Up @@ -160,8 +161,8 @@ def get(self):

if __name__ == "__main__":

print "OpenALPR Web server started on port %d" % (options.port)
print "Using %d parallel ALPR threads" % (options.threads)
print("OpenALPR Web server started on port %d" % (options.port))
print("Using %d parallel ALPR threads" % (options.threads))
application.listen(options.port)
tornado.ioloop.IOLoop.current().start()