-
Notifications
You must be signed in to change notification settings - Fork 2
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
ModuleNotFoundError: No module named 'keras.engine'" #4
Comments
Can you try exactly:
|
Oh thank you so much! It seems that it worked, but I've encountered a new error: "TypeError: list indices must be integers or slices, not str" It might be related to how indices are accessed internally in the code. Could you provide some guidance on how to resolve this new error? I appreciate any help you can offer! |
Can you post full error log? |
Yeah sure! This is what I got: TypeError Traceback (most recent call last) File ~/jupyter_py3.5/lib/python3.10/site-packages/classification_models_1D/models_factory.py:94, in ModelsFactory.inject_submodules..wrapper(*args, **kwargs) File ~/jupyter_py3.5/lib/python3.10/site-packages/classification_models_1D/models/resnet.py:387, in ResNet18(input_shape, input_tensor, weights, pooling, classes, include_top, stride_size, kernel_size, repetitions, **kwargs) File ~/jupyter_py3.5/lib/python3.10/site-packages/classification_models_1D/models/resnet.py:269, in ResNet(model_params, input_shape, input_tensor, include_top, classes, weights, stride_size, kernel_size, init_filters, first_kernel_size, repetitions, pooling, **kwargs) File ~/jupyter_py3.5/lib/python3.10/site-packages/keras/utils/traceback_utils.py:67, in filter_traceback..error_handler(*args, **kwargs) File ~/jupyter_py3.5/lib/python3.10/site-packages/google/protobuf/internal/containers.py:70, in BaseContainer.getitem(self, key) TypeError: list indices must be integers or slices, not str |
Can you try to run this code:
|
Hi. Yeah for sure, I run it and I got this error: "GPU use: 4
|
Hi again. Sorry I'm a little bit desperate and maybe someone can help me. I've been analyzing the code, and it seems the issue arises when adjusting the input shape to be compatible with BatchNormalization after importing from tensorflow.keras using the following snippet: from tensorflow.keras import layers, models Example bn_params dictionarybn_params = { Example usage in a modelinput_tensor = layers.Input(shape=(224*224, 2)) While layers.BatchNormalization(**bn_params) appears correct, the error arises when attempting to adjust the input shape to align with BatchNormalization. I'm unsure how to correct this issue." |
I can't reproduce your issue. I cloned repo, then installed dependencies in fresh venv. After I run
|
Ok, i understand. And what is your version of python, keras and keras aplication? Tensor flow is 2.8.4 ok |
|
I don't know what is happening. Because i have this: And then I run this: ResNet18, preprocess_input = Classifiers.get('resnet18') And i get the same error "TypeError: list indices must be integers or slices, not str" |
Can you add before |
Hi ! I got this "{'axis': 2, 'momentum': 0.99, 'epsilon': 2e-05, 'center': True, 'scale': True}" and then the "TypeError: list indices must be integers or slices, not str" |
from classification_models_1D.tfkeras import Classifiers ResNet18, preprocess_input = Classifiers.get('resnet18') "{ File ./anaconda3/lib/python3.11/site-packages/classification_models_1D/models_factory.py:94, in ModelsFactory.inject_submodules..wrapper(*args, **kwargs) File ./anaconda3/lib/python3.11/site-packages/classification_models_1D/models/resnet.py:387, in ResNet18(input_shape, input_tensor, weights, pooling, classes, include_top, stride_size, kernel_size, repetitions, **kwargs) File./anaconda3/lib/python3.11/site-packages/classification_models_1D/models/resnet.py:346, in ResNet(model_params, input_shape, input_tensor, include_top, classes, weights, stride_size, kernel_size, init_filters, first_kernel_size, repetitions, pooling, **kwargs) File ./anaconda3/lib/python3.11/site-packages/classification_models_1D/weights.py:52, in load_model_weights(model, model_name, dataset, classes, include_top, kernel_size, channel, **kwargs) ValueError: There is no weights for such configuration: model = model, dataset = imagenet, classes = 1000, include_top = True." |
Either set |
Thanks worked |
Hi!
I have the following requirements installed:
tensorflow>=2.8.0
keras_applications>=1.0.8
kapre>=0.3.7
I have also installed classification-models-1D using pip.
When I run the following example code in my Jupyter notebook:
from classification_models_1D.tfkeras import Classifiers
ResNet18, preprocess_input = Classifiers.get('resnet18')
model = ResNet18(input_shape=(224*224, 2), weights='imagenet')
I encounter the error:
ModuleNotFoundError: No module named 'keras.engine'
I have tried different versions of TensorFlow and Keras, but the issue persists. Can anyone help me resolve this?
Thank you!
The text was updated successfully, but these errors were encountered: