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
Research code for Arxiv paper "Camera Motion Agnostic 3D Human Pose Estimation"

GMR(Camera Motion Agnostic 3D Human Pose Estimation) This repo provides the source code of our arXiv paper: Seong Hyun Kim, Sunwon Jeong, Sungbum Park

Seong Hyun Kim 1 Feb 07, 2022
Demo code for ICCV 2021 paper "Sensor-Guided Optical Flow"

Sensor-Guided Optical Flow Demo code for "Sensor-Guided Optical Flow", ICCV 2021 This code is provided to replicate results with flow hints obtained f

10 Mar 16, 2022
Coded illumination for improved lensless imaging

CodedCam Coded Illumination for Improved Lensless Imaging Paper | Supplementary results | Data and Code are available. Coded illumination for improved

Computational Sensing and Information Processing Lab 1 Nov 29, 2021
🚀 An end-to-end ML applications using PyTorch, W&B, FastAPI, Docker, Streamlit and Heroku

🚀 An end-to-end ML applications using PyTorch, W&B, FastAPI, Docker, Streamlit and Heroku

Made With ML 82 Jun 26, 2022
Activity image-based video retrieval

Cross-modal-retrieval Our approach is focus on Activity Image-to-Video Retrieval (AIVR) task. The compared methods are state-of-the-art single modalit

BCMI 75 Oct 21, 2021
Augmented CLIP - Training simple models to predict CLIP image embeddings from text embeddings, and vice versa.

Train aug_clip against laion400m-embeddings found here: https://laion.ai/laion-400-open-dataset/ - note that this used the base ViT-B/32 CLIP model. S

Peter Baylies 55 Sep 13, 2022
Simple is not Easy: A Simple Strong Baseline for TextVQA and TextCaps[AAAI2021]

Simple is not Easy: A Simple Strong Baseline for TextVQA and TextCaps Here is the code for ssbassline model. We also provide OCR results/features/mode

ZephyrZhuQi 51 Nov 18, 2022
Galileo library for large scale graph training by JD

近年来,图计算在搜索、推荐和风控等场景中获得显著的效果,但也面临超大规模异构图训练,与现有的深度学习框架Tensorflow和PyTorch结合等难题。 Galileo(伽利略)是一个图深度学习框架,具备超大规模、易使用、易扩展、高性能、双后端等优点,旨在解决超大规模图算法在工业级场景的落地难题,提

JD Galileo Team 128 Nov 29, 2022
Create Data & AI apps in 20 lines of code with Shimoku

Install with: pip install shimoku-api-python Start with: from os import getenv import shimoku_api_python.client as Shimoku

Shimoku 5 Nov 07, 2022
PyTorch Implementation of DSB for Score Based Generative Modeling. Experiments managed using Hydra.

Diffusion Schrödinger Bridge with Applications to Score-Based Generative Modeling This repository contains the implementation for the paper Diffusion

James Thornton 50 Jan 03, 2023
Source code for "Interactive All-Hex Meshing via Cuboid Decomposition [SIGGRAPH Asia 2021]".

Interactive All-Hex Meshing via Cuboid Decomposition Video demonstration This repository contains an interactive software to the PolyCube-based hex-me

Lingxiao Li 131 Dec 05, 2022
Code for one-stage adaptive set-based HOI detector AS-Net.

AS-Net Code for one-stage adaptive set-based HOI detector AS-Net. Mingfei Chen*, Yue Liao*, Si Liu, Zhiyuan Chen, Fei Wang, Chen Qian. "Reformulating

Mingfei Chen 45 Dec 09, 2022
Model Zoo for AI Model Efficiency Toolkit

We provide a collection of popular neural network models and compare their floating point and quantized performance.

Qualcomm Innovation Center 137 Jan 03, 2023
My take on a practical implementation of Linformer for Pytorch.

Linformer Pytorch Implementation A practical implementation of the Linformer paper. This is attention with only linear complexity in n, allowing for v

Peter 349 Dec 25, 2022
PyTorch implementation of DeepUME: Learning the Universal Manifold Embedding for Robust Point Cloud Registration (BMVC 2021)

DeepUME: Learning the Universal Manifold Embedding for Robust Point Cloud Registration [video] [paper] [supplementary] [data] [thesis] Introduction De

Natalie Lang 10 Dec 14, 2022
Catalyst.Detection

Accelerated DL R&D PyTorch framework for Deep Learning research and development. It was developed with a focus on reproducibility, fast experimentatio

Catalyst-Team 12 Oct 25, 2021
Look Who’s Talking: Active Speaker Detection in the Wild

Look Who's Talking: Active Speaker Detection in the Wild Dependencies pip install -r requirements.txt In addition to the Python dependencies, ffmpeg

Clova AI Research 60 Dec 08, 2022
Graph Neural Networks with Keras and Tensorflow 2.

Welcome to Spektral Spektral is a Python library for graph deep learning, based on the Keras API and TensorFlow 2. The main goal of this project is to

Daniele Grattarola 2.2k Jan 08, 2023
Dungeons and Dragons randomized content generator

Component based Dungeons and Dragons generator Supports Entity/Monster Generation NPC Generation Weapon Generation Encounter Generation Environment Ge

Zac 3 Dec 04, 2021
scalingscattering

Scaling The Scattering Transform : Deep Hybrid Networks This repository contains the experiments found in the paper: https://arxiv.org/abs/1703.08961

Edouard Oyallon 78 Dec 21, 2022