Tensorflow api 修改

AttributeError: 'module' object has no attribute 'SummaryWriter'  tf.train.SummaryWriter改为:tf.summary.FileWriter

AttributeError: 'module' object has no attribute 'summaries' tf.merge_all_summaries()改为:summary_op = tf.summaries.merge_all()

AttributeError: 'module' object has no attribute 'histogram_summary' 改为:  tf.summaries.histogram()

AttributeError: 'module' object has no attribute 'scalar_summary' tf.scalar_summary('images', images)改为:tf.summary.scalar('images', images)
tf.image_summary('images', images)改为:tf.summary.image('images', images)


ValueError: Only call `softmax_cross_entropy_with_logits` with named arguments (labels=..., logits=..., ...)
cifar10.loss(labels, logits) 改为:cifar10.loss(logits=logits, labels=labels)

cross_entropy = tf.nn.softmax_cross_entropy_with_logits(logits, dense_labels, name='cross_entropy_per_example')
改为:cross_entropy = tf.nn.softmax_cross_entropy_with_logits(logits=logits, labels=dense_labels, name='cross_entropy_per_example')

ValueError: Shapes (2, 128, 1) and () are incompatible concated = tf.concat(1, [indices, sparse_labels])改为:concated = tf.concat([indices, sparse_labels], 1)




重大 API 变动
1、TensorFlow models已经被移动到一个单独的github库。
2、除法和模运算符(/,//,%)现在匹配Python(flooring)语义。这也适用于 [tf.div] 和 [tf.mod]。要获取基于强制整数截断的行为,可以使用 [tf.truncatediv] 和 [tf.truncatemod]。
3、现在推荐使用 [tf.divide()] 作为除法函数。[tf.div()] 将保留,但它的语义不会回应 Python 3 或 [from future] 机制。
4、tf.reverse() 现在取轴的索引要反转。例如 [tf.reverse(a,[True,False,True])] 现在必须写为 [tf.reverse(a,[0,2])]。 [tf.reverse_v2()] 将保持到TensorFlow 1.0 最终版。
5、[tf.mul,tf.sub ] 和 [tf.neg] 不再使用,改为 [tf.multiply],[tf.subtract] 和 [tf.negative]。
6、[tf.pack] 和 [tf.unpack] 弃用,改为 [tf.stack] 和 [tf.unstack]。
7、[TensorArray.pack] 和 [TensorArray.unpack] 在弃用过程中,将来计划启用 [TensorArray.stack] 和 [TensorArray.unstack]。

以下Python函数的参数在引用特定域时,全部改为使用 [axis]。目前仍将保持旧的关键字参数的兼容性,但计划在 1.0 最终版完成前删除。
1、tf.listdiff已重命名为tf.setdiff1d以匹配NumPy命名。
2、tf.inv已被重命名为tf.reciprocal(组件的倒数),以避免与np.inv的混淆,后者是矩阵求逆。
3、tf.round现在使用banker的舍入(round to even)语义来匹配NumPy。
4、tf.split现在以相反的顺序并使用不同的关键字接受参数。我们现在将NumPy order 匹配为tf.split(value,num_or_size_splits,axis)。
5、tf.sparse_split现在采用相反顺序的参数,并使用不同的关键字。我们现在将NumPy order 匹配为tf.sparse_split(sp_input,num_split,axis)。注意:我们暂时要求   tf.sparse_split 需要关键字参数。
6、tf.concat现在以相反的顺序并使用不同的关键字接受参数。特别地,我们现在将NumPy order匹配为tf.concat(values,axis,name)。
7、默认情况下,tf.image.decode_jpeg使用更快的DCT方法,牺牲一点保真度来提高速度。通过指定属性dct_method ='INTEGER_ACCURATE',可以恢复到旧版行为。
8、tf.complex_abs已从Python界面中删除。 tf.abs支持复杂张量,现在应该使用 tf.abs。
9、Template.var_scope属性重命名为.variable_scope
10、SyncReplicasOptimizer已删除,SyncReplicasOptimizerV2重命名为SyncReplicasOptimizer。
11、tf.zeros_initializer()和tf.ones_initializer()现在返回一个必须用initializer参数调用的可调用值,在代码中用tf.zeros_initializer()替换tf.zeros_initializer。
12、SparseTensor.shape已重命名为SparseTensor.dense_shape。与SparseTensorValue.shape相同。
13、分别替换tf.scalar_summary,tf.histogram_summary,tf.audio_summary,tf.image_summary与tf.summary.scalar, tf.summary.histogram,tf.summary.audio, tf.summary.image。新的摘要ops以名字而不是标签作为它们的第一个参数,意味着摘要ops现在尊重TensorFlow名称范围。
14、使用tf.summary.FileWriter和tf.summary.FileWriterCache替换tf.train.SummaryWriter和tf.train.SummaryWriterCache。
15、从公共API中删除RegisterShape。使用C++形状函数注册。
16、Python API 中的 _ref dtypes 已经弃用。
17、在C++ API(in tensorflow/cc)中,Input,Output等已经从tensorflow::ops命名空间移动到tensorflow。
18、将{softmax,sparse_softmax,sigmoid} _cross_entropy_with_logits的arg order更改为(labels,predictions),并强制使用已命名的args。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
TensorFlow Object Detection API 是一个开源项目,它提供了一系列基于 TensorFlow 的工具和库,用于实现目标检测任务。对于 macOS 系统,我们可以通过以下步骤来使用 TensorFlow Object Detection API: 1. 安装 TensorFlow:在 macOS 上安装 TensorFlow 是使用 TensorFlow Object Detection API 的前提。你可以通过 pip 命令进行安装,例如在终端中执行 `pip install tensorflow`。 2. 下载 TensorFlow Object Detection API:打开终端并导航到适合你的工作目录中,然后使用 git 命令来克隆 TensorFlow Object Detection API 的 GitHub 仓库,例如执行 `git clone https://github.com/tensorflow/models.git`。 3. 安装依赖项:进入克隆的模型目录中,找到 research 文件夹并进入。然后运行 `pip install -r object_detection/requirements.txt` 命令来安装所需的依赖项。 4. 下载预训练模型:在 TensorFlow Object Detection API 中,我们可以使用预训练的模型来进行目标检测。你可以从 TensorFlow Model Zoo 中下载适合你任务的模型,并将其解压到你的工作目录中。 5. 运行实例代码:在 research/object_detection 目录中,你可以找到一些示例代码,用于训练、评估和使用目标检测模型。可以通过阅读这些示例代码并根据自己的需求进行修改。例如,你可以使用 `python object_detection/builders/model_builder_tf2_test.py` 命令来运行一个模型的测试。 以上是在 macOS 上使用 TensorFlow Object Detection API 的基本步骤,你可以根据你的具体需求进行更多的深入研究和调整。希望这些信息能帮助到你!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值