Skip to content
Merged
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
10 changes: 5 additions & 5 deletions homeassistant/components/image_processing/demo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Support for the demo image processing.

For more details about this component, please refer to the documentation at
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/demo/
"""
from homeassistant.components.image_processing import ATTR_CONFIDENCE
Expand All @@ -12,7 +12,7 @@


def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the demo image_processing platform."""
"""Set up the demo image processing platform."""
add_devices([
DemoImageProcessingAlpr('camera.demo_camera', "Demo Alpr"),
DemoImageProcessingFace(
Expand All @@ -21,10 +21,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):


class DemoImageProcessingAlpr(ImageProcessingAlprEntity):
"""Demo alpr image processing entity."""
"""Demo ALPR image processing entity."""

def __init__(self, camera_entity, name):
"""Initialize demo alpr."""
"""Initialize demo ALPR image processing entity."""
super().__init__()

self._name = name
Expand Down Expand Up @@ -61,7 +61,7 @@ class DemoImageProcessingFace(ImageProcessingFaceEntity):
"""Demo face identify image processing entity."""

def __init__(self, camera_entity, name):
"""Initialize demo alpr."""
"""Initialize demo face image processing entity."""
super().__init__()

self._name = name
Expand Down
10 changes: 5 additions & 5 deletions homeassistant/components/image_processing/dlib_face_detect.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Component that will help set the dlib face detect processing.
Component that will help set the Dlib face detect processing.

For more details about this component, please refer to the documentation at
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/image_processing.dlib_face_detect/
"""
import logging
Expand All @@ -21,7 +21,7 @@


def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the Microsoft Face detection platform."""
"""Set up the Dlib Face detection platform."""
entities = []
for camera in config[CONF_SOURCE]:
entities.append(DlibFaceDetectEntity(
Expand All @@ -35,7 +35,7 @@ class DlibFaceDetectEntity(ImageProcessingFaceEntity):
"""Dlib Face API entity for identify."""

def __init__(self, camera_entity, name=None):
"""Initialize Dlib."""
"""Initialize Dlib face entity."""
super().__init__()

self._camera = camera_entity
Expand All @@ -62,7 +62,7 @@ def process_image(self, image):
import face_recognition

fak_file = io.BytesIO(image)
fak_file.name = "snapshot.jpg"
fak_file.name = 'snapshot.jpg'
fak_file.seek(0)

image = face_recognition.load_image_file(fak_file)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Component that will help set the dlib face detect processing.
Component that will help set the Dlib face detect processing.

For more details about this component, please refer to the documentation at
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/image_processing.dlib_face_identify/
"""
import logging
Expand Down Expand Up @@ -29,7 +29,7 @@


def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the Microsoft Face detection platform."""
"""Set up the Dlib Face detection platform."""
entities = []
for camera in config[CONF_SOURCE]:
entities.append(DlibFaceIdentifyEntity(
Expand All @@ -43,7 +43,7 @@ class DlibFaceIdentifyEntity(ImageProcessingFaceEntity):
"""Dlib Face API entity for identify."""

def __init__(self, camera_entity, faces, name=None):
"""Initialize Dlib."""
"""Initialize Dlib face identify entry."""
# pylint: disable=import-error
import face_recognition
super().__init__()
Expand Down Expand Up @@ -77,7 +77,7 @@ def process_image(self, image):
import face_recognition

fak_file = io.BytesIO(image)
fak_file.name = "snapshot.jpg"
fak_file.name = 'snapshot.jpg'
fak_file.seek(0)

image = face_recognition.load_image_file(fak_file)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Component that will help set the microsoft face detect processing.
Component that will help set the Microsoft face detect processing.

For more details about this component, please refer to the documentation at
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/image_processing.microsoft_face_detect/
"""
import asyncio
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Component that will help set the microsoft face for verify processing.
Component that will help set the Microsoft face for verify processing.

For more details about this component, please refer to the documentation at
https://home-assistant.io/components/image_processing.microsoft_face_identify/
Expand Down Expand Up @@ -62,20 +62,20 @@ class ImageProcessingFaceEntity(ImageProcessingEntity):

def __init__(self):
"""Initialize base face identify/verify entity."""
self.faces = [] # last scan data
self.total_faces = 0 # face count
self.faces = []
self.total_faces = 0

@property
def state(self):
"""Return the state of the entity."""
confidence = 0
state = STATE_UNKNOWN

# no confidence support
# No confidence support
if not self.confidence:
return self.total_faces

# search high confidence
# Search high confidence
for face in self.faces:
if ATTR_CONFIDENCE not in face:
continue
Expand Down Expand Up @@ -128,7 +128,7 @@ def async_process_faces(self, faces, total):

This method must be run in the event loop.
"""
# send events
# Send events
for face in faces:
if ATTR_CONFIDENCE in face and self.confidence:
if face[ATTR_CONFIDENCE] < self.confidence:
Expand All @@ -139,7 +139,7 @@ def async_process_faces(self, faces, total):
self.hass.bus.async_fire, EVENT_DETECT_FACE, face
)

# update entity store
# Update entity store
self.faces = faces
self.total_faces = total

Expand Down Expand Up @@ -200,7 +200,7 @@ def async_process_image(self, image):
_LOGGER.error("Can't process image on Microsoft face: %s", err)
return

# parse data
# Parse data
knwon_faces = []
total = 0
for face in detect:
Expand All @@ -220,5 +220,4 @@ def async_process_image(self, image):
ATTR_CONFIDENCE: data['confidence'] * 100,
})

# process data
self.async_process_faces(knwon_faces, total)
2 changes: 1 addition & 1 deletion homeassistant/components/image_processing/opencv.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Component that performs OpenCV classification on images.

For more details about this component, please refer to the documentation at
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/image_processing.opencv/
"""
from datetime import timedelta
Expand Down