Read number plates with https://platerecognizer.com/

Overview

HASS-plate-recognizer

Read vehicle license plates with https://platerecognizer.com/ which offers free processing of 2500 images per month. You will need to create an account and get your API token.

This integration adds an image processing entity where the state of the entity is the number of license plates found in a processed image. Information about the vehicle which has the license plate is provided in the entity attributes, and includes the license plate number, region/country, vehicle type, and confidence (in a scale 0 to 1) in this prediction. For each vehicle an platerecognizer.vehicle_detected event is fired, containing the same information just listed. Additionally, statistics about your account usage are given in the Statistics attribute, including the number of calls_remaining out of your 2500 monthly available.

Note this integration does NOT automatically process images, it is necessary to call the image_processing.scan service to trigger processing.

Home Assistant setup

Place the custom_components folder in your configuration directory (or add its contents to an existing custom_components folder). Then configure as below:

image_processing:
  - platform: platerecognizer
    api_token: your_token
    regions:
      - gb
      - ie
    save_file_folder: /config/images/platerecognizer/
    save_timestamped_file: True
    always_save_latest_file: True
    source:
      - entity_id: camera.yours

Configuration variables:

  • api_key: Your api key.
  • regions: (Optional) A list of regions/countries to filter by. Note this may return fewer, but more specific predictions.
  • save_file_folder: (Optional) The folder to save processed images to. Note that folder path should be added to whitelist_external_dirs
  • save_timestamped_file: (Optional, default False, requires save_file_folder to be configured) Save the processed image with the time of detection in the filename.
  • always_save_latest_file: (Optional, default False, requires save_file_folder to be configured) Always save the last processed image, no matter there were detections or not.
  • source: Must be a camera.

Video of usage

Checkout this excellent video of usage from Everything Smart Home

Comments
  • Empty pictures when using nest camera

    Empty pictures when using nest camera

    Hi

    I’m using outdoor nest cameras that are 24/7 powered. I have setup the integration correctly but when start the image proccessing the png saved doesn’t have a picture. The file is there in the confit folder but there is no picture, it’s just white

    I don’t have a car to test with this evening, does a car need to be in the frame of the camera for the image processing event to generate a picture?

    opened by henrikrox 5
  • This worked once but now I'm getting an error in the HA log.

    This worked once but now I'm getting an error in the HA log.

    Any idea's what is causing this?

    Logger: homeassistant.helpers.entity Source: custom_components/platerecognizer/image_processing.py:124 First occurred: 16:24:45 (10 occurrences) Last logged: 17:07:22

    Update for image_processing.platerecognizer_driveway_top fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update raise exc File "/usr/src/homeassistant/homeassistant/components/image_processing/init.py", line 132, in async_update await self.async_process_image(image.content) File "/usr/src/homeassistant/homeassistant/components/image_processing/init.py", line 112, in async_process_image return await self.hass.async_add_executor_job(self.process_image, image) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/platerecognizer/image_processing.py", line 124, in process_image self._image = Image.open(io.BytesIO(bytearray(image))) File "/usr/local/lib/python3.8/site-packages/PIL/Image.py", line 2958, in open raise UnidentifiedImageError( PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7fa2e30c20>

    opened by healeydave 5
  • get_orientations error: 'orientation'

    get_orientations error: 'orientation'

    Getting following error get_orientations error: 'orientation'. Getting this everytime a platrecognizer is triggered

    Source: custom_components/platerecognizer/image_processing.py:94

    Running release 1.1.0 of Plate and HA 2021.5.2

    opened by greberg 4
  • Watched Plates Sensor Issue

    Watched Plates Sensor Issue

    I can get plate recognizer to work with my home assistant however I am having issue when adding watched plates sensor

    Below is my sensor code

    sensor:

    • platform: template sensors: plate_recognizer: friendly_name: "abc12d" value_template: "{{ state_attr('image_processing.platerecognizer_1', 'watched_plates').abc12d }}"

    Home Assistant having this warning in the log image

    When I scan plate-recognizer, it can detect my license plate but the sensor does not change state. My home assistant version is core-2021.9.0b6.

    opened by htiennhan 3
  • All attributes missing from image_processing entity

    All attributes missing from image_processing entity

    Since updating to 2022.4.b0 All attributes missing from image_processing entity. State works OK and is showing the number of plates.

    Set logging to debug and only shows this:

    2022-03-31 17:38:12 DEBUG (SyncWorker_17) [custom_components.platerecognizer.image_processing] Config: {"detection_rule": "strict", "region": "False"}

    opened by holdestmade 2
  • Coordinates of detected plate box

    Coordinates of detected plate box

    Looking on Platerecognizer's website, it says it returns coordinates of the detected plate box, is this possible to add ?

    The centre of the box would suffice, I would like to check where each plate is detected (drive or road)

    results/box | Bounding box for the license plate. Coordinates in pixel of the top left and bottom right corners of the plate. -- | --

    opened by holdestmade 2
  • Thank you /

    Thank you /

    Hey Rob

    Firstly, thank you so much for this. We live on a large rural property in Australia and are using this to work out who is at our gate and automatically open the gate if we like them :)

    I wondered if you had considered allowing the intergration to connect to a on-premise instance of plate recogniser (running in a docker container).

    https://app.platerecognizer.com/sdk/

    I wish I knew how to code, in which case I would raise a PR and not an issue.

    Please keep up the great work.

    P.S. I have been working with Plate Recogniser to get a more affordable plan for plan for us all. The new plan pricing will work for Cloud and SDK licenses.

    opened by dalewright 2
  • [Feature Request] - Url or file as source instead of camera

    [Feature Request] - Url or file as source instead of camera

    It would be great to be able to use an url or a file for source instead of camera.

    Use case I'm using Frigate as NVR- software and when using the official HA-component for Frigate it creates all cameras in HA with a max height of 277px. I've found that that is a little bit to small for my setup when running plates. It would be great to be able to set an url directly to my Frigate instance where I can access a full resolution image of the camera feed.

    opened by thrawnarn 2
  • SUGGESTION: Change /config/images/platerecognizer/ to /config/www/images/platerecognizer/ in readme

    SUGGESTION: Change /config/images/platerecognizer/ to /config/www/images/platerecognizer/ in readme

    Love the integration, but in my opinion this would be a better default location, because then you can create local file cameras, and otherwise you can't do things like send the latest image in a notification via automation.

    opened by shanem2004 2
  • Add watched_plate arg

    Add watched_plate arg

    Parallels https://github.com/robmarkcole/HASS-Sighthound/issues/22

    Add a watched_plate arg that is a list of plates to watch for, allowing fuzzy matching. I.e. a matched plate will be detected when there is a good match of characters using regex. For each plate an attribute is exposed which is a binary sensor indicating if the plate was in the last scanned imaged or not. Add a watched_plate event as well?

    opened by robmarkcole 2
  • Issue plate start with number

    Issue plate start with number

    My country plate start with number like

    29a12345

    if I put this in template

    plate_recognizer: friendly_name: "29a12345" value_template: "{{ state_attr('image_processing.platerecognizer_frontgate', 'watched_plates').29a12345}}"

    will error

    Invalid config for [sensor.template]: invalid template (TemplateSyntaxError: expected name or number) for dictionary value @ data['sensors']['plate_recognizer']['value_template']. Got "{{ state_attr('image_processing.platerecognizer_frontgate', 'watched_plates').'29a12345' }}". (See ?, line ?).

    opened by chimcanhcut1112 1
  • Can i use multiple camera entity sources?

    Can i use multiple camera entity sources?

    Also, can i put image_processing in a file rather then configuration.yaml ?

    Finally, is the sensor configuration new style or old style?

    Thanks for your help!

    opened by atv2016 1
  • Update for image_processing.platerecognizer_doorbell_main_proxy fails

    Update for image_processing.platerecognizer_doorbell_main_proxy fails

    Any idea what would cause this?

    This error originated from a custom integration.

    Logger: homeassistant.helpers.entity
    Source: custom_components/platerecognizer/image_processing.py:224
    Integration: platerecognizer (documentation)
    First occurred: 16 November 2022 at 21:27:27 (884 occurrences)
    Last logged: 16:02:06
    
    Update for image_processing.platerecognizer_doorbell_main_proxy fails
    Traceback (most recent call last):
      File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 971, in json
        return complexjson.loads(self.text, **kwargs)
      File "/usr/local/lib/python3.10/site-packages/simplejson/__init__.py", line 525, in loads
        return _default_decoder.decode(s)
      File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 373, in decode
        raise JSONDecodeError("Extra data", s, end, len(s))
    simplejson.errors.JSONDecodeError: Extra data: line 1 column 4 - line 1 column 15 (char 3 - 14)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/config/custom_components/platerecognizer/image_processing.py", line 206, in process_image
        ).json()
      File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 975, in json
        raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    requests.exceptions.JSONDecodeError: Extra data: line 1 column 4 (char 3)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 527, in async_update_ha_state
        await self.async_device_update()
      File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 722, in async_device_update
        raise exc
      File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 163, in async_update
        await self.async_process_image(image.content)
      File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 144, in async_process_image
        return await self.hass.async_add_executor_job(self.process_image, image)
      File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/config/custom_components/platerecognizer/image_processing.py", line 224, in process_image
        _LOGGER.error(f"platerecognizer api response: {response}")
    UnboundLocalError: local variable 'response' referenced before assignment
    

    This is my config

      - platform: platerecognizer
        api_token: xxxxxxx
        regions:
          - gb
        save_file_folder: /config/images/platerecognizer/
        save_timestamped_file: True
        always_save_latest_file: True
        watched_plates:
          - xx67xxx
        mmc: True
        detection_rule: strict
        region: strict
        server: https://myhostname.com/v1/plate-reader/
        source:
          - entity_id: camera.doorbell_main_proxy
    
    opened by totalitarian 3
  • Using region no (Norway) results in error -

    Using region no (Norway) results in error - "no" is registered as boolean "false"

    Hi, Thanks for the effort.

    I am trying to use this integration with the region "no", and i get the following error message in the system log: platerecognizer api response: {'regions': ['Region "False" does not exist. List of regions: http://docs.platerecognizer.com/#countries']}

    My yaml contains the following:

    regions: - no

    Workaround is to use: regions: - dk

    opened by laabak84 1
  • build sensor last found plate (attributes not working?)

    build sensor last found plate (attributes not working?)

    I want to make an sensor where I can se the last plate found NOT known.

    here is what I have been trying.

    in developer tools:

    {{ state_attr('image_processing.platerecognizer_garage_2' , 'vehicles') }}

    output

    [{'plate': 'nkeXXXX', 'confidence': 0.683, 'region_code': 'pl', 'vehicle_type': 'Big Truck', 'box_y_centre': 116.0, 'box_x_centre': 1563.0}]

    so I want to show attribute 'plate'

    {{ state_attr('image_processing.platerecognizer_garage_2' , 'vehicles').plate }}

    output

    none

    expected output

    nkeXXXX

    is there something I am missing ?

    opened by koburg 0
  • Image filenames are very long and dont display well

    Image filenames are very long and dont display well

    Can the filenames generated be customized? I just need the format to be shorter to display neatly in my gallery browser card but the generated filename is something like platerecognizer_driveway_cam_jpg_2022-07-22_10-04-48 which is really long and messes us how things are displayed with text for thumbnails overlaying on top of each other etc.

    opened by craigueh 3
Releases(1.4.1)
Owner
Robin
Physics PhD, python dev, data science and engineering, interests include deep learning & IOT
Robin
Deep Structured Instance Graph for Distilling Object Detectors (ICCV 2021)

DSIG Deep Structured Instance Graph for Distilling Object Detectors Authors: Yixin Chen, Pengguang Chen, Shu Liu, Liwei Wang, Jiaya Jia. [pdf] [slide]

DV Lab 31 Nov 17, 2022
Megaverse is a new 3D simulation platform for reinforcement learning and embodied AI research

Megaverse Megaverse is a new 3D simulation platform for reinforcement learning and embodied AI research. The efficient design of the engine enables ph

Aleksei Petrenko 191 Dec 23, 2022
A keras implementation of ENet (abandoned for the foreseeable future)

ENet-keras This is an implementation of ENet: A Deep Neural Network Architecture for Real-Time Semantic Segmentation, ported from ENet-training (lua-t

Pavlos 115 Nov 23, 2021
scikit-learn: machine learning in Python

scikit-learn is a Python module for machine learning built on top of SciPy and is distributed under the 3-Clause BSD license. The project was started

scikit-learn 52.5k Jan 08, 2023
List of all dependencies affected by node-ipc malicious commit

node-ipc-dependencies-list List of all dependencies affected by node-ipc malicious commit as of 17/3/2022 - 19/3/2022 (timestamp) Please improve upon

99 Oct 15, 2022
CS506-Spring2022 - Code and Slides for Boston University CS 506

CS 506 - Computational Tools for Data Science Code, slides, and notes for Boston

Lance Galletti 17 May 06, 2022
Diabet Feature Engineering - Predict whether people have diabetes when their characteristics are specified

Diabet Feature Engineering - Predict whether people have diabetes when their characteristics are specified

Şebnem 6 Jan 18, 2022
A Parameter-free Deep Embedded Clustering Method for Single-cell RNA-seq Data

A Parameter-free Deep Embedded Clustering Method for Single-cell RNA-seq Data Overview Clustering analysis is widely utilized in single-cell RNA-seque

AI-Biomed @NSCC-gz 3 May 08, 2022
Examples of using f2py to get high-speed Fortran integrated with Python easily

f2py Examples Simple examples of using f2py to get high-speed Fortran integrated with Python easily. These examples are also useful to troubleshoot pr

Michael 35 Aug 21, 2022
Constraint-based geometry sketcher for blender

Constraint-based sketcher addon for Blender that allows to create precise 2d shapes by defining a set of geometric constraints like tangent, distance,

1.7k Dec 31, 2022
This project aim to create multi-label classification annotation tool to boost annotation speed and make it more easier.

This project aim to create multi-label classification annotation tool to boost annotation speed and make it more easier.

4 Aug 02, 2022
A Kaggle competition: discriminate gender based on handwriting

Gender discrimination based on handwriting See http://fastml.com/gender-discrimination/ for description. prep_data.py - a first step chunk_by_authors.

Zygmunt Zając 22 Jul 20, 2022
Deploy pytorch classification model using Flask and Streamlit

Deploy pytorch classification model using Flask and Streamlit

Ben Seo 1 Nov 17, 2021
Sinkformers: Transformers with Doubly Stochastic Attention

Code for the paper : "Sinkformers: Transformers with Doubly Stochastic Attention" Paper You will find our paper here. Compat This package has been dev

Michael E. Sander 31 Dec 29, 2022
Film review classification

Film review classification Решение задачи классификации отзывов на фильмы на положительные и отрицательные с помощью рекуррентных нейронных сетей 1. З

Nikita Dukin 3 Jan 21, 2022
Geneva is an artificial intelligence tool that defeats censorship by exploiting bugs in censors

Geneva is an artificial intelligence tool that defeats censorship by exploiting bugs in censors

Kevin Bock 1.5k Jan 06, 2023
Deep Learning & 3D Convolutional Neural Networks for Speaker Verification

TensorFlow implementation of 3D Convolutional Neural Networks for Speaker Verification - Official Project Page - Pytorch Implementation This repositor

Amirsina Torfi 753 Dec 17, 2022
Official Pytorch Implementation of: "ImageNet-21K Pretraining for the Masses"(2021) paper

ImageNet-21K Pretraining for the Masses Paper | Pretrained models Official PyTorch Implementation Tal Ridnik, Emanuel Ben-Baruch, Asaf Noy, Lihi Zelni

574 Jan 02, 2023
This repository is to support contributions for tools for the Project CodeNet dataset hosted in DAX

The goal of Project CodeNet is to provide the AI-for-Code research community with a large scale, diverse, and high quality curated dataset to drive innovation in AI techniques.

International Business Machines 1.2k Jan 04, 2023
Easily benchmark PyTorch model FLOPs, latency, throughput, max allocated memory and energy consumption

⏱ pytorch-benchmark Easily benchmark model inference FLOPs, latency, throughput, max allocated memory and energy consumption Install pip install pytor

Lukas Hedegaard 21 Dec 22, 2022