Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade numpy to 1.15.4 #18506

Merged
merged 1 commit into from Nov 16, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/binary_sensor/trend.py
Expand Up @@ -22,7 +22,7 @@
from homeassistant.helpers.event import async_track_state_change
from homeassistant.util import utcnow

REQUIREMENTS = ['numpy==1.15.3']
REQUIREMENTS = ['numpy==1.15.4']

_LOGGER = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/image_processing/opencv.py
Expand Up @@ -16,7 +16,7 @@
from homeassistant.core import split_entity_id
import homeassistant.helpers.config_validation as cv

REQUIREMENTS = ['numpy==1.15.3']
REQUIREMENTS = ['numpy==1.15.4']

_LOGGER = logging.getLogger(__name__)

Expand Down
59 changes: 28 additions & 31 deletions homeassistant/components/image_processing/tensorflow.py
@@ -1,5 +1,5 @@
"""
Component that performs TensorFlow classification on images.
Support for performing TensorFlow classification on images.

For a quick start, pick a pre-trained COCO model from:
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md
Expand All @@ -8,8 +8,8 @@
https://home-assistant.io/components/image_processing.tensorflow/
"""
import logging
import sys
import os
import sys

import voluptuous as vol

Expand All @@ -20,52 +20,49 @@
from homeassistant.helpers import template
import homeassistant.helpers.config_validation as cv

REQUIREMENTS = ['numpy==1.15.3', 'pillow==5.2.0', 'protobuf==3.6.1']
REQUIREMENTS = ['numpy==1.15.4', 'pillow==5.2.0', 'protobuf==3.6.1']

_LOGGER = logging.getLogger(__name__)

ATTR_MATCHES = 'matches'
ATTR_SUMMARY = 'summary'
ATTR_TOTAL_MATCHES = 'total_matches'

CONF_AREA = 'area'
CONF_BOTTOM = 'bottom'
CONF_CATEGORIES = 'categories'
CONF_CATEGORY = 'category'
CONF_FILE_OUT = 'file_out'
CONF_MODEL = 'model'
CONF_GRAPH = 'graph'
CONF_LABELS = 'labels'
CONF_MODEL_DIR = 'model_dir'
CONF_CATEGORIES = 'categories'
CONF_CATEGORY = 'category'
CONF_AREA = 'area'
CONF_TOP = 'top'
CONF_LEFT = 'left'
CONF_BOTTOM = 'bottom'
CONF_MODEL = 'model'
CONF_MODEL_DIR = 'model_dir'
CONF_RIGHT = 'right'
CONF_TOP = 'top'

AREA_SCHEMA = vol.Schema({
vol.Optional(CONF_TOP, default=0): cv.small_float,
vol.Optional(CONF_LEFT, default=0): cv.small_float,
vol.Optional(CONF_BOTTOM, default=1): cv.small_float,
vol.Optional(CONF_RIGHT, default=1): cv.small_float
vol.Optional(CONF_LEFT, default=0): cv.small_float,
vol.Optional(CONF_RIGHT, default=1): cv.small_float,
vol.Optional(CONF_TOP, default=0): cv.small_float,
})

CATEGORY_SCHEMA = vol.Schema({
vol.Required(CONF_CATEGORY): cv.string,
vol.Optional(CONF_AREA): AREA_SCHEMA
vol.Optional(CONF_AREA): AREA_SCHEMA,
})

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_FILE_OUT, default=[]):
vol.All(cv.ensure_list, [cv.template]),
vol.Required(CONF_MODEL): vol.Schema({
vol.Required(CONF_GRAPH): cv.isfile,
vol.Optional(CONF_LABELS): cv.isfile,
vol.Optional(CONF_MODEL_DIR): cv.isdir,
vol.Optional(CONF_AREA): AREA_SCHEMA,
vol.Optional(CONF_CATEGORIES, default=[]):
vol.All(cv.ensure_list, [vol.Any(
cv.string,
CATEGORY_SCHEMA
)])
vol.All(cv.ensure_list, [vol.Any(cv.string, CATEGORY_SCHEMA)]),
vol.Optional(CONF_LABELS): cv.isfile,
vol.Optional(CONF_MODEL_DIR): cv.isdir,
})
})

Expand Down Expand Up @@ -93,7 +90,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):

# Make sure locations exist
if not os.path.isdir(model_dir) or not os.path.exists(labels):
_LOGGER.error("Unable to locate tensorflow models or label map.")
_LOGGER.error("Unable to locate tensorflow models or label map")
return

# append custom model path to sys.path
Expand All @@ -118,9 +115,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
# pylint: disable=unused-import,unused-variable
import cv2 # noqa
except ImportError:
_LOGGER.warning("No OpenCV library found. "
"TensorFlow will process image with "
"PIL at reduced resolution.")
_LOGGER.warning(
"No OpenCV library found. TensorFlow will process image with "
"PIL at reduced resolution")

# setup tensorflow graph, session, and label map to pass to processor
# pylint: disable=no-member
Expand Down Expand Up @@ -241,23 +238,23 @@ def _save_image(self, image, matches, paths):
# Draw custom global region/area
if self._area != [0, 0, 1, 1]:
draw_box(draw, self._area,
img_width, img_height,
"Detection Area", (0, 255, 255))
img_width, img_height, "Detection Area", (0, 255, 255))

for category, values in matches.items():
# Draw custom category regions/areas
if (category in self._category_areas
and self._category_areas[category] != [0, 0, 1, 1]):
label = "{} Detection Area".format(category.capitalize())
draw_box(draw, self._category_areas[category], img_width,
img_height, label, (0, 255, 0))
draw_box(
draw, self._category_areas[category], img_width,
img_height, label, (0, 255, 0))

# Draw detected objects
for instance in values:
label = "{0} {1:.1f}%".format(category, instance['score'])
draw_box(draw, instance['box'],
img_width, img_height,
label, (255, 255, 0))
draw_box(
draw, instance['box'], img_width, img_height, label,
(255, 255, 0))

for path in paths:
_LOGGER.info("Saving results image to %s", path)
Expand Down
11 changes: 6 additions & 5 deletions homeassistant/components/sensor/pollen.py
Expand Up @@ -4,21 +4,22 @@
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.pollen/
"""
import logging
from datetime import timedelta
import logging
from statistics import mean

import voluptuous as vol

import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_ATTRIBUTION, ATTR_STATE, CONF_MONITORED_CONDITIONS)
from homeassistant.helpers import aiohttp_client
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle

REQUIREMENTS = ['numpy==1.15.3', 'pypollencom==2.2.2']
REQUIREMENTS = ['numpy==1.15.4', 'pypollencom==2.2.2']

_LOGGER = logging.getLogger(__name__)

ATTR_ALLERGEN_AMOUNT = 'allergen_amount'
Expand Down Expand Up @@ -401,8 +402,8 @@ async def async_update(self):
await self._get_data(
self._client.disease.extended, TYPE_DISEASE_FORECAST)

_LOGGER.debug('New data retrieved: %s', self.data)
_LOGGER.debug("New data retrieved: %s", self.data)
except InvalidZipError:
_LOGGER.error(
'Cannot retrieve data for ZIP code: %s', self._client.zip_code)
"Cannot retrieve data for ZIP code: %s", self._client.zip_code)
self.data = {}
2 changes: 1 addition & 1 deletion requirements_all.txt
Expand Up @@ -686,7 +686,7 @@ nuheat==0.3.0
# homeassistant.components.image_processing.opencv
# homeassistant.components.image_processing.tensorflow
# homeassistant.components.sensor.pollen
numpy==1.15.3
numpy==1.15.4

# homeassistant.components.google
oauth2client==4.0.0
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Expand Up @@ -123,7 +123,7 @@ mficlient==0.3.0
# homeassistant.components.image_processing.opencv
# homeassistant.components.image_processing.tensorflow
# homeassistant.components.sensor.pollen
numpy==1.15.3
numpy==1.15.4

# homeassistant.components.mqtt
# homeassistant.components.shiftr
Expand Down