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
Low-code/No-code approach for deep learning inference on devices

EzEdgeAI A concept project that uses a low-code/no-code approach to implement deep learning inference on devices. It provides a componentized framewor

On-Device AI Co., Ltd. 7 Apr 05, 2022
Near-Optimal Sparse Allreduce for Distributed Deep Learning (published in PPoPP'22)

Near-Optimal Sparse Allreduce for Distributed Deep Learning (published in PPoPP'22) Ok-Topk is a scheme for distributed training with sparse gradients

Shigang Li 9 Oct 29, 2022
Model Quantization Benchmark

Introduction MQBench is an open-source model quantization toolkit based on PyTorch fx. The envision of MQBench is to provide: SOTA Algorithms. With MQ

500 Jan 06, 2023
CBKH: The Cornell Biomedical Knowledge Hub

Cornell Biomedical Knowledge Hub (CBKH) CBKG integrates data from 18 publicly available biomedical databases. The current version of CBKG contains a t

44 Dec 21, 2022
using yolox+deepsort for object-tracker

YOLOX_deepsort_tracker yolox+deepsort实现目标跟踪 最新的yolox尝尝鲜~~(yolox正处在频繁更新阶段,因此直接链接yolox仓库作为子模块) Install Clone the repository recursively: git clone --rec

245 Dec 26, 2022
PyTorch Implementation of Region Similarity Representation Learning (ReSim)

ReSim This repository provides the PyTorch implementation of Region Similarity Representation Learning (ReSim) described in this paper: @Article{xiao2

Tete Xiao 74 Jan 03, 2023
Simple command line tool for text to image generation using OpenAI's CLIP and Siren (Implicit neural representation network)

Deep Daze mist over green hills shattered plates on the grass cosmic love and attention a time traveler in the crowd life during the plague meditative

Phil Wang 4.4k Jan 03, 2023
YKKDetector For Python

YKKDetector OpenCVを利用した機械学習データをもとに、VRChatのスクリーンショットなどからYKKさん(もとい「幽狐族のお姉様」)を検出できるソフトウェアです。 マニュアル こちらから実行環境のセットアップから解説する詳細なマニュアルをご覧いただけます。 ライセンス 本ソフトウェア

あんふぃとらいと 5 Dec 07, 2021
Code for Temporally Abstract Partial Models

Code for Temporally Abstract Partial Models Accompanies the code for the experimental section of the paper: Temporally Abstract Partial Models, Khetar

DeepMind 19 Jul 13, 2022
A Pytree Module system for Deep Learning in JAX

Treex A Pytree-based Module system for Deep Learning in JAX Intuitive: Modules are simple Python objects that respect Object-Oriented semantics and sh

Cristian Garcia 216 Dec 20, 2022
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
Parallel Latent Tree-Induction for Faster Sequence Encoding

FastTrees This repository contains the experimental code supporting the FastTrees paper by Bill Pung. Software Requirements Python 3.6, NLTK and PyTor

Bill Pung 4 Mar 29, 2022
Akshat Surolia 2 May 11, 2022
ESP32 python application to read data from a Tilt™ Hydrometer for homebrewing

TitlESP32 ESP32 MicroPython application to read and log data from a Tilt™ Hydrometer. Requirements A board with an ESP32 chip USB cable - USB A / micr

IoBeer 5 Dec 01, 2022
A Low Complexity Speech Enhancement Framework for Full-Band Audio (48kHz) based on Deep Filtering.

DeepFilterNet A Low Complexity Speech Enhancement Framework for Full-Band Audio (48kHz) based on Deep Filtering. libDF contains Rust code used for dat

Hendrik Schröter 292 Dec 25, 2022
Pytorch implementation of the paper "Optimization as a Model for Few-Shot Learning"

Optimization as a Model for Few-Shot Learning This repo provides a Pytorch implementation for the Optimization as a Model for Few-Shot Learning paper.

Albert Berenguel Centeno 238 Jan 04, 2023
Projects of Andfun Yangon

AndFunYangon Projects of Andfun Yangon First Commit We can use gsearch.py to sea

Htin Aung Lu 1 Dec 28, 2021
Towards Interpretable Deep Metric Learning with Structural Matching

DIML Created by Wenliang Zhao*, Yongming Rao*, Ziyi Wang, Jiwen Lu, Jie Zhou This repository contains PyTorch implementation for paper Towards Interpr

Wenliang Zhao 75 Nov 11, 2022
A collection of random and hastily hacked together scripts for investigating EU-DCC

A collection of random and hastily hacked together scripts for investigating EU-DCC

Ryan Barrett 8 Mar 01, 2022
WRENCH: Weak supeRvision bENCHmark

🔧 What is it? Wrench is a benchmark platform containing diverse weak supervision tasks. It also provides a common and easy framework for development

Jieyu Zhang 176 Dec 28, 2022