---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Input In [20], in <cell line: 1>()
----> 1 from tensorflow.keras import layers
2 import keras.backend as backend
3 import tensorflow as tf
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\api\_v2\keras\__init__.py:13, in <module>
10 import sys as _sys
12 from keras import __version__
---> 13 from keras.api._v2.keras import __internal__
14 from keras.api._v2.keras import activations
15 from keras.api._v2.keras import applications
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\api\__init__.py:8, in <module>
3 """Public API for tf. namespace.
4 """
6 import sys as _sys
----> 8 from keras.api import keras
9 from tensorflow.python.util import module_wrapper as _module_wrapper
11 if not isinstance(_sys.modules[__name__], _module_wrapper.TFModuleWrapper):
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\api\keras\__init__.py:16, in <module>
14 from keras.api.keras import activations
15 from keras.api.keras import applications
---> 16 from keras.api.keras import backend
17 from keras.api.keras import callbacks
18 from keras.api.keras import constraints
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\api\keras\backend\__init__.py:24, in <module>
22 from keras.backend import binary_crossentropy
23 from keras.backend import binary_focal_crossentropy
---> 24 from keras.backend import binary_weighted_focal_crossentropy
25 from keras.backend import cast
26 from keras.backend import cast_to_floatx
ImportError: cannot import name 'binary_weighted_focal_crossentropy' from 'keras.backend' (D:\Users\DGong\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\backend.py)
I can't figure out why I'm getting an import error here. I've uninstalled and reinstalled tensorflow
and keras
many times, as well as used both pip and pip3. I checked the file and nothing seems to be different between the way binary_focal_crossentropy
and binary_weighted_focal_crossentropy
is exported. But the former seems to import without error.
binary_focal_crossentropy
, I've never seen these functions.