Git Product home page Git Product logo

Comments (6)

ZFTurbo avatar ZFTurbo commented on August 15, 2024 1

Try to uninstall keras completely.

pip uninstall keras

from segmentation_models_3d.

menari123 avatar menari123 commented on August 15, 2024

Hello, I'm using tensorflow 2.5.0 and keras 2.4.3 and i get the error in import: ImportError: You need to first import keras in order to use keras_applications. For instance, you can do: import keras from keras_applications import vgg16 Or, preferably, this equivalent formulation: ``` from keras import applications

from segmentation_models_3d.

ZFTurbo avatar ZFTurbo commented on August 15, 2024
  1. Please post full error stack.
  2. Try to set "sm.set_framework('tf.keras')"

from segmentation_models_3d.

menari123 avatar menari123 commented on August 15, 2024

I'm using tensorflow 2.5.0, keras 2.4.3, python 3.8 and anaconda3. I run pip install segmentation-models-3d and when i run import segmentation_models_3d i get this error:


ImportError Traceback (most recent call last)
~/anaconda3/lib/python3.8/site-packages/segmentation_models_3D/init.py in
97 try:
---> 98 set_framework(_framework)
99 except ImportError:

~/anaconda3/lib/python3.8/site-packages/segmentation_models_3D/init.py in set_framework(name)
70 from tensorflow import keras
---> 71 import efficientnet_3D.tfkeras # init custom objects
72 else:

~/anaconda3/lib/python3.8/site-packages/efficientnet_3D/tfkeras.py in
1 from . import inject_tfkeras_modules, init_tfkeras_custom_objects
----> 2 from . import model
3

~/anaconda3/lib/python3.8/site-packages/efficientnet_3D/model.py in
33 from six.moves import xrange
---> 34 from keras_applications.imagenet_utils import _obtain_input_shape
35 from keras_applications.imagenet_utils import preprocess_input as _preprocess_input

~/anaconda3/lib/python3.8/site-packages/keras_applications/imagenet_utils.py in
12
---> 13 backend = get_keras_submodule('backend')
14 keras_utils = get_keras_submodule('utils')

~/anaconda3/lib/python3.8/site-packages/keras_applications/init.py in get_keras_submodule(name)
38 if _KERAS_BACKEND is None:
---> 39 raise ImportError('You need to first import keras '
40 'in order to use keras_applications. '

ImportError: You need to first import keras in order to use keras_applications. For instance, you can do:

import keras
from keras_applications import vgg16

Or, preferably, this equivalent formulation:

from keras import applications

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
in
----> 1 import segmentation_models_3D as sm

~/anaconda3/lib/python3.8/site-packages/segmentation_models_3D/init.py in
99 except ImportError:
100 other = _TF_KERAS_FRAMEWORK_NAME if _framework == _KERAS_FRAMEWORK_NAME else _KERAS_FRAMEWORK_NAME
--> 101 set_framework(other)
102
103 print('Segmentation Models: using {} framework.'.format(_KERAS_FRAMEWORK))

~/anaconda3/lib/python3.8/site-packages/segmentation_models_3D/init.py in set_framework(name)
66 if name == _KERAS_FRAMEWORK_NAME:
67 import keras
---> 68 import efficientnet_3D.keras # init custom objects
69 elif name == _TF_KERAS_FRAMEWORK_NAME:
70 from tensorflow import keras

~/anaconda3/lib/python3.8/site-packages/efficientnet_3D/keras.py in
1 from . import inject_keras_modules, init_keras_custom_objects
----> 2 from . import model
3
4 from .preprocessing import center_crop_and_resize
5

~/anaconda3/lib/python3.8/site-packages/efficientnet_3D/model.py in
32
33 from six.moves import xrange
---> 34 from keras_applications.imagenet_utils import _obtain_input_shape
35 from keras_applications.imagenet_utils import preprocess_input as _preprocess_input
36

~/anaconda3/lib/python3.8/site-packages/keras_applications/imagenet_utils.py in
11 from . import get_keras_submodule
12
---> 13 backend = get_keras_submodule('backend')
14 keras_utils = get_keras_submodule('utils')
15

~/anaconda3/lib/python3.8/site-packages/keras_applications/init.py in get_keras_submodule(name)
37 'Requested: %s' % name)
38 if _KERAS_BACKEND is None:
---> 39 raise ImportError('You need to first import keras '
40 'in order to use keras_applications. '
41 'For instance, you can do:\n\n'

ImportError: You need to first import keras in order to use keras_applications. For instance, you can do:

import keras
from keras_applications import vgg16

Or, preferably, this equivalent formulation:

from keras import applications

from segmentation_models_3d.

menari123 avatar menari123 commented on August 15, 2024

image

from segmentation_models_3d.

mavaylon1 avatar mavaylon1 commented on August 15, 2024

You should make a requirements file

from segmentation_models_3d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.