- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
Settings:
Mac OS 10.14.6
Python 3.7.4
Tensorflow 2.0.0
我在 name_scope 设置方面遇到问题。我在代码中编写 name_scope()
,但 Tensorboard 中没有 name_scope,如 this image in Tensorboard 。我打算在此图像中为 Flatten、Dense 等创建一个名称范围。
我卸载并重新安装 Tensorflow,但得到了相同的结果。作为附加信息,我在终端中没有收到任何错误。有人对这种情况有任何想法吗?
def _model_B0001(self):
with tf.name_scope('1stLayer'):
inputs = Input(self.shape)
x = Flatten()(inputs)
x = Dense(512)(x)
output1 = Dense(self.nb_classes1, activation='softmax', name='output1')(x)
output2 = Dense(self.nb_classes2, activation='softmax', name='output2')(x)
predictions = [output1, output2]
model = Model(inputs, predictions)
model.compile(loss={'output1': 'categorical_crossentropy',
'output2': 'categorical_crossentropy'},
optimizer='adam',
metrics=['accuracy'])
model.summary()
with open(self.summary_txt, "w") as fp:
model.summary(print_fn=lambda x: fp.write(x + "\r\n"))
return model
最佳答案
这个问题我自己解决了。可能是因为 pip 和 anaconda 的碰撞。所以我做了下面的事情。
卸载所有 pip 软件包。
$ pip freeze > piplist.txt
$ sudo pip uninstall -r piplist.txt
卸载所有 anaconda 软件包。
卸载软件包。
$ conda install anaconda-clean
$ anaconda-clean
删除包后删除空文件夹。
$ rm -fr ~/.anaconda_backup
$ rm -fr /anaconda3
删除.bash_profile中的内容
$ sudo nano .bash_profile
重新安装 anaconda。从https://www.anaconda.com/distribution/下载
重新运行张量板。
def _model_A0001(self):
with tf.name_scope('1stLayer') as scope:
# print(scope)
# sys.exit()
inputs = Input(self.shape)
x = Conv2D(32, (3, 3), border_mode='same', name='conv2d')(inputs)
x = Activation('relu', name='relu')(x)
x = MaxPooling2D(pool_size=(2, 2), name='max_pooling')(x)
x = Dropout(0.25, name='dropout')(x)
with tf.name_scope('2ndLayer'):
x = Conv2D(64, (3, 3), border_mode='same')(x)
x = Activation('relu')(x)
x = Conv2D(64, (3, 3))(x)
x = MaxPooling2D(pool_size=(2, 2))(x)
x = Dropout(0.25)(x)
with tf.name_scope('DenseLayer'):
x = Flatten()(x)
x = Dense(512)(x)
x = Activation('relu')(x)
x = Dropout(0.5)(x)
output1 = Dense(self.nb_classes1, activation='softmax', name='output1')(x)
output2 = Dense(self.nb_classes2, activation='softmax', name='output2')(x)
predictions = [output1, output2]
# inputs = [inputs, inputs]
model = Model(inputs, outputs=predictions)
model.compile(loss={'output1': 'categorical_crossentropy',
'output2': 'categorical_crossentropy'},
optimizer='adam',
metrics=['accuracy'])
model.summary()
with open(self.summary_txt, "w") as fp:
model.summary(print_fn=lambda x: fp.write(x + "\r\n"))
return model
关于python - Tensorflow 的 name_scope 在 Tensorboard 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59475228/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!