@d56043 (sho shinsha)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

keras版YOLOv4のエラーについて

解決したいこと

YOLOv4のdarknet用の重みをkeras用に変換するため、convert.pyを実行するとエラーが発生するので解決したい。

発生している問題・エラー

AttributeError: module 'tensorflow._api.v1.compat.v2' has no attribute '__internal__'

該当するソースコード


(tf_py36) C:\Users\sun20\Desktop\keras-yolo4-master>python convert.py
Using TensorFlow backend.
2021-06-27 21:24:20.319220: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
Traceback (most recent call last):
  File "convert.py", line 5, in <module>
    from keras import backend as K
  File "C:\Users\sun20\anaconda3\envs\tf_py36\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import utils
  File "C:\Users\sun20\anaconda3\envs\tf_py36\lib\site-packages\keras\utils\__init__.py", line 25, in <module>
    from .multi_gpu_utils import multi_gpu_model
  File "C:\Users\sun20\anaconda3\envs\tf_py36\lib\site-packages\keras\utils\multi_gpu_utils.py", line 7, in <module>
    from ..layers.merge import concatenate
  File "C:\Users\sun20\anaconda3\envs\tf_py36\lib\site-packages\keras\layers\__init__.py", line 4, in <module>
    from ..engine import Layer
  File "C:\Users\sun20\anaconda3\envs\tf_py36\lib\site-packages\keras\engine\__init__.py", line 3, in <module>
    from .topology import InputSpec
  File "C:\Users\sun20\anaconda3\envs\tf_py36\lib\site-packages\keras\engine\topology.py", line 18, in <module>
    from .. import initializers
  File "C:\Users\sun20\anaconda3\envs\tf_py36\lib\site-packages\keras\initializers\__init__.py", line 124, in <module>
    populate_deserializable_objects()
  File "C:\Users\sun20\anaconda3\envs\tf_py36\lib\site-packages\keras\initializers\__init__.py", line 49, in populate_deserializable_objects
    LOCAL.GENERATED_WITH_V2 = tf.__internal__.tf2.enabled()
  File "C:\Users\sun20\anaconda3\envs\tf_py36\lib\site-packages\tensorflow_core\python\util\module_wrapper.py", line 193, in __getattr__
    attr = getattr(self._tfmw_wrapped_module, name)
AttributeError: module 'tensorflow._api.v1.compat.v2' has no attribute '__internal__'

自分で試したこと

keras==2.1.6
TensorFlow==1.15.0
CUDA==10.0
cuDNN==7.5.0 for CUDA10.0

エラーでググってkerasのヴァージョンを変えたりしましたが解決できませんでした。
解決法をご存じの方、助けてください。

0 likes

No Answers yet.

Your answer might help someone💌