Tensorfow基础知识点&操作

var.namevar.op.name

opt = tf.train.GradientDescentOptimizer(1e-4)
grads_and_vars = opt.compute_gradients(total_loss)       
for grad, var in grads_and_vars:        
    print(var.op.name)

the output is: conv1/filt conv1/bias

and when I change var.op.name into var.name

the output is: conv1/filt:0 conv1/bias:0
var.op.name是指每个变量在创立时的操作的名字,也即为变量申请内存时的那个操作的名字。而var.name是Tensor名字,Tensor是操作的输出,也就是在创立变量的这个操作的输出就是所创立的变量。

tf.read_file 和 tf.image.decode_jpeg

tensor_queue=tf.train.slice_producer([paths],)
#返回的per_path是包含名字的tensor
per_path=tensor_queue[0]
#可以输出per_path看到是['/home/user/1.jpg']
per_path=tf.Print(per_path,[per_path],message='')
raw_input,=tf.py_func(cv_imread,[per_path],[tf.uint8])
#py_func输出没有shape
raw_input.set_shape((300,300,3))

tf.image


    tf.image.random_brightness(img,0.5) 表示像素加减0.5。然后clip成[0,1)。
    tf.image.adjust_brightness(img,0.5)表示加0.5,然后clip
    tf.image.random_contrast(img,0.1,5)表示gamma校正中的gamma值在0.1-5之间选择。当gamma=1时,
    图像保持不变。
    

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值