我正在导入keras_adversarial并克隆其git,但无法导入'AdversarialModel'
我正在研究gans,内置发电机和鉴别器。现在我想结合它们,但是colab在导入keras_adversarial模块
时出错import keras_adversarial
from keras_adversarial import AdversarialModel, simple_gan, gan_targets
from keras_adversarial import AdversarialOptimizerSimultaneous,
normal_latent_sampling
1 import keras_adversarial
----> 2 from keras_adversarial import AdversarialModel, simple_gan,
gan_targets
3 from keras_adversarial import AdversarialOptimizerSimultaneous,
normal_latent_sampling
ImportError: cannot import name 'AdversarialModel'
答案 0 :(得分:0)
Colab环境仅安装了一组核心软件包。要将某些第三方软件包添加为keras_adversarial
,您可以在Colab单元中直接执行安装脚本,在每个命令之前使用!
符号表示这些是命令行bash代码,而不是Python。
您需要做的是:
!git clone https://github.com/bstriner/keras_adversarial.git
!cd keras_adversarial
!python setup.py install