- 博客(27)
- 资源 (1)
- 收藏
- 关注
原创 tensorflow编程: Building Graphs
Core graph data structurestf.Graph# 程序从一开始就默认有一个 graph 。任何的 tf.Graph() 操作 都是在新建 graph,但都只能在新建的那个 上下文管理器 内发挥作用a = tf.get_default_graph()# 该graph 继承 a.graph,则 该graph 内 default_graph 就为 a.graphwith a.as
2017-09-30 17:24:28 787
原创 tensorflow编程: Control Flow
Control Flow Operationstf.identity复制tensor tf.identity (input, name=None)import tensorflow as tft = tf.constant(value=[[1, 1, 1], [2, 2, 2]], dtype=tf.int32)a1 = ta2 = tf.identity(t)print a1asser
2017-09-30 15:39:03 2098
原创 tensorflow: bn层
Introduction具体见 深度学习: Batch Normalization (归一化)Experiment实验一可视化 batch normalization 过程中的 tensor演化(以输入一张[1, 4 , 4, 1]的图片为例)# -*- coding: utf-8 -*-import tensorflow as tfdef func_convolut
2017-09-29 10:46:45 2559
原创 tensorflow: 打印内存中的变量
法一:循环打印模板for (x, y) in zip(tf.global_variables(), sess.run(tf.global_variables())): print '\n', x, y实例# coding=utf-8import tensorflow as tfdef func(in_put, layer_name, is_training=True): with
2017-09-29 10:16:37 2351 1
原创 tensorflow: bn层 的 decay参数项
实验五:探究 batch normalization 过程中的 decay 参数项 在 train 和 test 过程中的不同作用。 在 decay=0 (即移动偏移无损失)时:import tensorflow as tfdef func(in_put, layer_name, is_training=True): with tf.variable_scope(layer_name,
2017-09-29 09:38:34 5370
原创 python: enumerate
API enumerate(sequence, [start=0])Argssequence – 一个序列、迭代器或其他支持迭代对象。start – 下标起始位置Returns返回 enumerate(枚举) 对象。示例 将 enumerate(枚举)对象 存在一个list中返回:seq = ['Spring', 'Summer', 'Fall', 'Winter']print lis
2017-09-28 16:41:22 345
原创 tensorflow: 对variable_scope进行reuse的两种方法
方法一:模板:具体示例:方法二:模板:# -*- coding: utf-8 -*-import tensorflow as tffrom tensorflow.python.ops import variable_scope as vs ### 改动部分 ###def func(..., reuse=False): ### 改动部分 ### if reuse:
2017-09-28 15:56:16 34907 6
原创 tensorflow编程: Layers (contrib)
Layers (contrib)Higher level ops for building neural network layerstf.contrib.layers.batch_norm 添加一个 Batch Normalization 层 。tf.contrib.layers.batch_norm ( inputs, ##### decay=0.999, ####
2017-09-26 08:55:44 3933
原创 tensorflow编程: Constants, Sequences, and Random Values
Constant Value Tensorstf.zeros tf.zeros (shape, dtype=tf.float32, name=None)tf.zeros_like tf.zeros_like (tensor, dtype=None, name=None, optimize=True)tf.ones tf.ones (shape, dtype=tf.float32, n
2017-09-25 17:55:05 636
原创 shutdown & reboot & last
shutdownsudo shutdown [-h/-r/ ] [now/+10/22:00]-h:系统停止运作(halt)-r:重启(reboot)放空:类同于 -hnow:立即执行+10:10分钟后执行22:00:指定时间点22:00执行rebootsudo rebootlast查询本机过去处于 关机状态 的时段last -x shutdownshutdown system d
2017-09-23 17:31:39 874
原创 tensorflow: Shapes and Shaping 探究
定义 Tensor Transformations - Shapes and Shaping: TensorFlow provides several operations that you can use to determine the shape of a tensor and change the shape of a tensor. tensorflow提供了一些操作,让用户可以定义
2017-09-23 16:36:30 422
原创 python: 上下文管理器(context manager)
定义允许你在有需要的时候,精确地分配和释放资源用途上下文管理器的一个常见用例,是资源的加锁和解锁,以及关闭已打开的文件优点避免了琐碎操作:通过使用with,许多样板代码可以被消掉 避免了遗忘步骤:因此不用关注嵌套代码如何退出,又能确保我们的文件会被关闭,避免了代表其中最常见的就是with语句了 python提供了with语句语法,来构建对资源的自动创建与自动释放示例小白代码:file = ope
2017-09-23 11:01:38 2312 2
原创 python: range & xrange 探究
概述 xrange 和 range 这两个基本上都是在循环的时候用。 xrange 用法与 range 完全相同,所不同的是生成的不是一个list对象,而是一个生成器。 生成很大的数字序列的时候,用 xrange 会比 range 性能优很多,因为不需要一上来就开辟一块很大的内存空间。所以尽量用 xrange 。实验 range ( [start,] stop [, step] )>>
2017-09-07 16:46:40 381
原创 图像滤波器 探究(图示+源码)
Demo原图像: Averaging_Blur:Averaging_Blur_Enhanced:Completed_Blur:Edge_Detection_360_degree:Edge_Detection_45_degree:Embossing_45_degree:Embossing_Asymmetric:Gaussian_Blur:Motion_Blur:Sharpness_Center:Sh
2017-09-07 14:57:31 908 1
原创 python: 递归记录 指定后缀名 的文件
# coding=utf-8import ossave_txt = './paths.txt' # 记录路径的文档root_folder = './root' # 将被递归的文件夹根目录suffix_name = '.jpg' # 后缀名# 递归记录指定后缀名的文件的绝对路径def write_file_path_to_txt(folder, save_txt): out_file =
2017-09-07 11:25:00 1998
原创 python: input()、raw_input() 探究
实验a = input('请输入:')print a如果输入字符串,则马上报错:请输入:str Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 1, in <module>但是如果输入整数,却不会报错:请输入:1010如果把 input 改成
2017-09-06 21:44:57 332
原创 python: time模块、datetime模块
时间上下限import datetimeprint 'min : ', datetime.datetime.minprint 'max : ', datetime.datetime.maxmin : 0001-01-01 00:00:00max : 9999-12-31 23:59:59.999999datetime.datetime.now(
2017-09-06 19:54:39 772
原创 python: 前后缀操作
返回后缀名import ospath = 'first_directory/second_directory/file.txt'print os.path.splitext(path)[1]print type(os.path.splitext(path)[1]).txt<type 'str'>前缀名的bool判断path = 'first_directory/second_directory
2017-09-06 19:12:14 1542
原创 python: 将列表中的字符串 连接成一个 长路径
今天实习公司分配了一个数据处理的任务。在从列表中读取字符串并连接成一个长路径时,我遇到了如下问题:import ospath_list = ['first_directory', 'second_directory', 'file.txt']print os.path.join(path_list) 发现 os.path.join 之后,依然是字符串列表。这我就纳闷了:['first_direct
2017-09-06 18:57:14 9610
原创 常见帧率 与 帧率运用
帧率概念引入帧率(Frame rate)是用于测量显示帧数的量度。所谓的测量单位为每秒显示帧数(Frames per Second,简称:FPS)或“赫兹”(Hz),一般来说FPS用于描述视频、电子绘图或游戏每秒播放多少帧,而赫兹则描述显示屏的画面每秒更新多少次。此词多用于影视制作和电子游戏。帧率层级对照表 帧率(FPS) 人眼感受 产品运用 < 10 ~ 12 不连贯
2017-09-06 18:29:51 6600 2
原创 opencv: 视频中提取帧图片并保存(cv2.VideoCapture)
Code因为工作需要,写了一段代码用于在视频中提取帧图片:# coding=utf-8# 全局变量VIDEO_PATH = './1.avi' # 视频地址EXTRACT_FOLDER = './extract_folder' # 存放帧图片的位置EXTRACT_FREQUENCY = 100 # 帧提取频率def extract_frames(video_path, ds...
2017-09-06 17:22:54 20129 3
原创 python: 删除当前目录下的所有.pyc、.py~文件
import osprint os.listdir('.')del_paths = [name for name in os.listdir('.') if name.endswith('.pyc') or name.endswith('.py~')]for del_path in del_paths: os.remove(del_path)print os.listdir('.')[
2017-09-06 16:56:19 3717 1
原创 tensorflow: 激活函数(Activation_Functions) 探究
激活函数概念From TensorFlow - Activation_Functions:在神经网络中,我们有很多的 非线性函数 来作为 激活函数连续 、平滑 tf.sigmoid(x, name = None) == 1 / (1 + exp(-x))import numpy as npimport tensorflow as tfsess = tf.Session()bn
2017-09-05 20:19:29 4354
原创 tensorflow: 损失函数(Losses Functions) 探究
API官方定义From tf.nn.l2_loss: tf.nn.l2_loss l2_loss( t, name=None ) Defined in tensorflow/python/ops/gen_nn_ops.py. See the guide: Neural Network > Losses L2 Loss. Computes half the
2017-09-04 17:03:05 7196
原创 numpy: np.random模块 探究(源码)
官方api定义From Random sampling: Random sampling (numpy.random) Simple random data rand(d0, d1, …, dn) Random values in a given shape . randn(d0, d1, …, dn) Return a sample (or samples) from t
2017-09-01 14:45:15 2135 1
原创 numpy: 新建二维序列数组
法一import numpy as npa = np.arange(start=0, stop=9, step=1, dtype=int)a.resize(3, 3)print aprint type(a)[[0 1 2] [3 4 5] [6 7 8]]<type 'numpy.ndarray'>Process finished with exit code 0要特别注意这里的 .re
2017-09-01 10:09:57 1721
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人