草庐IT

pywrap_tensorflow_internal

全部标签

python - "TypeError: ' Tensor ' object is not iterable"错误与tensorflow Estimator

我有一个程序生成的(无限)数据源,我正在尝试将其用作高级TensorflowEstimator的输入,以训练基于图像的3D对象检测器。我像在TensorflorEstimator中一样设置数据集Quickstart,我的dataset_input_fn返回特征和标签Tensor的元组,就像Estimator.train函数指定,以及这个tutorialshows的方式,但在尝试调用训练函数时出现错误:TypeError:'Tensor'对象不可迭代。我做错了什么?defdata_generator():"""Generatorforimage(features)andgroundtru

python - 为什么在tensorflow中构建resnet模型时使用fixed padding

Tensorflow在github中有resnet的官方实现.它使用固定填充而不是普通的tf.layers.conv2d。像这样:defconv2d_fixed_padding(inputs,filters,kernel_size,strides,data_format):"""Strided2-Dconvolutionwithexplicitpadding."""#Thepaddingisconsistentandisbasedonlyon`kernel_size`,notonthe#dimensionsof`inputs`(asopposedtousing`tf.layers.co

python - Tensorflow `tf.layers.batch_normalization` 没有向 `tf.GraphKeys.UPDATE_OPS` 添加更新操作

以下代码(复制/粘贴可运行)说明了如何使用tf.layers.batch_normalization。importtensorflowastfbn=tf.layers.batch_normalization(tf.constant([0.0]))print(tf.get_collection(tf.GraphKeys.UPDATE_OPS))>[]#UPDATE_OPScollectionisempty使用TF1.5,文档(在下面引用)明确指出在这种情况下UPDATE_OPS不应为空(https://www.tensorflow.org/api_docs/python/tf/layer

python - 如何在 VirtualBox Ubuntu OS 上安装 tensorflow GPU 版本。主机操作系统是 windows 10

我想使用Anaconda(python3.6)设置深度学习环境。我有安装了Windows的nvidiagetforce1060系统。现在我想在VB中安装Ubuntu操作系统。我可以在基于VB的Ubuntu操作系统中安装Cuda和CuDNN库吗?谁能帮帮我? 最佳答案 您不能在虚拟盒子上使用您的GPU。因为虚拟盒子cannot通过主机GPU。但是,您可以使用python的windows版本,它可以在您的windows机器上使用GPU。Here是windows的安装步骤。安装完cuda,cudnn和anaconda3.6我就用了,$pi

python - Pipenv-错误 : ModuleNotFoundError: No module named 'pip._internal'

今天,我通过安装了Pipenvpipinstallpipenv如文档中所述,我进入了一个测试目录并使用创建了一个新的虚拟环境pipenv外壳并尝试通过安装一个包pipenv安装numpy我收到以下错误信息:Installingnumpy…⠧Error:Anerroroccurredwhileinstallingnumpy!Traceback(mostrecentcalllast):File"/Users/florian/.local/share/virtualenvs/test-bJfQ6Jzk/bin/pip",line7,infrompip._internalimportmainM

python - 将图像编辑为 tensorflow 张量 python

我会尽力在这里提供一个可重现的例子。我有一张图片:AaronEckhart的这张图片是(150,150)我的目标是通过对像素进行数学运算来扰乱此图像的ROI,但是,问题是数学运算必须作为tensorflow张量来完成,因为要完成的数学运算是将张量乘以它缩放梯度(这也是一个大小为(row_pixels,column_pixels,3)的张量)所以这是我想象的过程:以numpy数组的形式读入图像RGB大小:(1,150,150,3)(1是批处理尺寸)w,h=img.shaperet=np.empty((w,h,3),dtype=np.uint8)ret[:,:,0]=ret[:,:,1]=

python - TensorFlow 初始化 Tensor of ones

假设我有一个张量X=tf.placeholder("float",[None,5])所以我知道列数但不知道行数。我需要初始化一个维度为nrowsx1的向量现在下面的代码块不起作用,o=tf.ones(shape=(tf.shape(X)[0],1))==>TypeError:ListofTensorswhensingleTensorexpected也没有,o=tf.ones(shape=(X.get_shape()[0].value,1))==>TypeError:Input'dims'of'Fill'Ophastypestringthatdoesnotmatchexpectedtyp

python - TensorFlow 将图像张量调整为动态形状

我正在尝试使用TensorFlow读取一些图像输入以解决图像分类问题。当然,我正在使用tf.image.decode_jpeg(...)执行此操作。我的图像大小可变,因此我无法为图像张量指定固定形状。但我需要根据图像的实际大小来缩放图像。具体来说,我想以保持纵横比的方式将较短的边缩放到固定值,并将较长的边缩放。我可以通过shape=tf.shape(image)获取某个图像的实际形状。我也可以像这样计算新的较长边shape=tf.shape(image)height=shape[0]width=shape[1]new_shorter_edge=400ifheight我现在的问题是我无法

python - 可重用的 Tensorflow 卷积网络

我想重用Tensorflow"MNISTforPros"CNNexample中的代码.我的图像是388pxX191px,只有2个输出类。原码可以是foundhere.我尝试通过更改仅输入和输出层来重用此代码,如下所示:输入层x=tf.placeholder("float",shape=[None,74108])y_=tf.placeholder("float",shape=[None,2])x_image=tf.reshape(x,[-1,388,191,1])输出层W_fc2=weight_variable([1024,2])b_fc2=bias_variable([2])运行修改后

python - 在 Tensorflow 中使用字符串标签

我仍在尝试使用自己的图像数据运行Tensorflow。我能够使用此示例中的conevert_to()函数创建.tfrecords文件link现在我想用那个例子中的代码训练网络link.但它在read_and_decode()函数中失败了。我对该功能的更改是:label=tf.decode_raw(features['label'],tf.string)错误是:TypeError:DataTypestringforattr'out_type'notinlistofallowedvalues:float32,float64,int32,uint8,int16,int8,int64那么如何1