-
Notifications
You must be signed in to change notification settings - Fork 754
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
You need to first import keras
in order to use keras_preprocessing
. For instance, you can do:
#41
Comments
same here. running this via the tweet package and got this traceback:
any ideas how to resolve this? edit: okay, updating tensor flow fixed that for me and then it turned into another issue #197 (for which a fix was provided fortunately) |
Hi, I have spent quite a lot of time solving this problem. The problem was in keras_applications. There is two possible way to face this error message:
Anyway it occurred by .json file we can solve this problem by reinstalling Tensorflow and Keras-related things but I know that this works heavily stressful. This is my personal recommendation for this kind of errors.
First, find your path of 'keras_applications' are installed (It might be in such 'C:\ProgramData\Anaconda3\Lib\site-packages' Or, just use 'pip show keras_applications') And then, open (imagenet_utils.py) than edit it like this from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import keras
import json
import warnings
import numpy as np
from . import get_keras_submodule
from . import set_keras_submodules
backend = set_keras_submodules('backend')
backed = 'backend'
keras_utils = get_keras_submodule('utils')
CLASS_INDEX = None
CLASS_INDEX_PATH = ('https://s3.amazonaws.com/deep-learning-models/'
'image-models/imagenet_class_index.json')
# Global tensor of imagenet mean for preprocessing symbolic inputs
_IMAGENET_MEAN = None
... It's just editing check flag rightly (It should be checked by Keras backend API but because of version issue it impossible to check automatically sometimes).
I know that this is not a perfect solution for the code, But it works okay temporarily. |
can't run demo, getting the following error:
ImportError: You need to first
import keras
in order to usekeras_preprocessing
. For instance, you can do:Or, preferably, this equivalent formulation:
The text was updated successfully, but these errors were encountered: