forked from keras-team/keras-preprocessing
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 97dbdc0
Showing
16 changed files
with
3,709 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[report] | ||
fail_under = 85 | ||
show_missing = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.DS_Store | ||
*.pyc | ||
dist/* | ||
build/* | ||
tags | ||
Keras_Preprocessing.egg-info | ||
|
||
# test-related | ||
.coverage | ||
.cache | ||
.pytest_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
sudo: required | ||
dist: trusty | ||
language: python | ||
matrix: | ||
include: | ||
- python: 2.7 | ||
env: KERAS_BACKEND=tensorflow TEST_MODE=PEP8 | ||
- python: 3.6 | ||
env: KERAS_BACKEND=tensorflow TEST_MODE=DOC | ||
- python: 2.7 | ||
env: KERAS_BACKEND=tensorflow | ||
- python: 3.6 | ||
env: KERAS_BACKEND=tensorflow | ||
install: | ||
# code below is taken from http://conda.pydata.org/docs/travis.html | ||
# We do this conditionally because it saves us some downloading if the | ||
# version is the same. | ||
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then | ||
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh; | ||
else | ||
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; | ||
fi | ||
- bash miniconda.sh -b -p $HOME/miniconda | ||
- export PATH="$HOME/miniconda/bin:$PATH" | ||
- hash -r | ||
- conda config --set always_yes yes --set changeps1 no | ||
- conda update -q conda | ||
# Useful for debugging any issues with conda | ||
- conda info -a | ||
|
||
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION pytest pandas | ||
- source activate test-environment | ||
- pip install --only-binary=numpy,scipy numpy nose scipy | ||
|
||
# set library path | ||
- export LD_LIBRARY_PATH=$HOME/miniconda/envs/test-environment/lib/:$LD_LIBRARY_PATH | ||
|
||
# install PIL for image tests | ||
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then | ||
conda install pil; | ||
elif [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then | ||
conda install Pillow; | ||
fi | ||
|
||
- pip install -e .[tests] | ||
|
||
# install TensorFlow (CPU version). | ||
- pip install tensorflow==1.7 | ||
|
||
# command to run tests | ||
script: | ||
- if [[ "$TEST_MODE" == "PEP8" ]]; then | ||
PYTHONPATH=$PWD:$PYTHONPATH py.test --pep8 -m pep8 -n0; | ||
elif [[ "$TEST_MODE" == "DOC" ]]; then | ||
PYTHONPATH=$PWD:$PYTHONPATH py.test tests/test_documentation.py; | ||
else | ||
PYTHONPATH=$PWD:$PYTHONPATH py.test tests/ --cov-config .coveragerc --cov=keras tests/; | ||
fi |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
COPYRIGHT | ||
|
||
Copyright (c) 2015 - 2018, the respective contributors. | ||
All rights reserved. | ||
|
||
Each contributor holds copyright over their respective contributions. | ||
The project versioning (Git) records all such contribution source information. | ||
|
||
LICENSE | ||
|
||
The MIT License (MIT) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Keras Preprocessing | ||
|
||
Keras Preprocessing is the data preprocessing | ||
and data augmentation module of the Keras deep learning library. | ||
It provides utilities for working with image data, text data, | ||
and sequence data. | ||
|
||
Read the documentation at: https://keras.io/ | ||
|
||
Keras Preprocessing may be imported directly | ||
from an up-to-date installation of Keras: | ||
|
||
``` | ||
from keras import preprocessing | ||
``` | ||
|
||
Keras Preprocessing is compatible with Python 2.7-3.6 | ||
and is distributed under the MIT liense. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""Enables dynamic setting of underlying Keras module. | ||
""" | ||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
_KERAS_MODULE = None | ||
|
||
|
||
def keras_module(): | ||
global _KERAS_MODULE | ||
if _KERAS_MODULE is None: | ||
# Use `import keras` as default | ||
# then fallback to `tf.keras` | ||
try: | ||
import keras | ||
except ImportError: | ||
try: | ||
from tensorflow import keras | ||
except ImportError: | ||
raise ImportError( | ||
'You must have Keras (or TensorFlow) ' | ||
'installed in order to use keras_preprocessing.') | ||
set_keras_module(keras) | ||
return _KERAS_MODULE | ||
|
||
|
||
def set_keras_module(module): | ||
global _KERAS_MODULE | ||
_keras_module_validation(module) | ||
_KERAS_MODULE = module | ||
|
||
|
||
def _keras_module_validation(module): | ||
# TODO: add check on version to make sure | ||
# this version of keras-preprocessing is | ||
# compatible with the provided Keras version | ||
# i.e. `if module.__version__ < ...` | ||
pass |
Oops, something went wrong.