随笔分类 -  tensorflow

摘要:我看了很多博客,也看了一些github大神的源码,很多基于一个版本改写而成。会将代码分成很多小.py文件,如建立YOLO3网络模块就会用一个.py文件, 如建立共用iou计算就会放在utils.py文件里,这让很多学习者,无从适应。我也为此困惑过,因此我将自己写的代码贡献在博客中,希望给你们有一些帮 阅读全文
posted @ 2020-01-07 00:02 tangjunjun 阅读(1316) 评论(0) 推荐(0) 编辑
摘要:tf.random_shuffle(value, seed=None, name=None) 函数就是随机地将张量沿第一维度打乱 value:将被打乱的张量. seed:一个 Python 整数.用于为分布创建一个随机种子. name:操作的名称. 代码如下:import tensorflow as 阅读全文
posted @ 2019-12-22 21:16 tangjunjun 阅读(3428) 评论(0) 推荐(0) 编辑
摘要:tf.where()的使用,该函数会返回满足条件的索引。经验证,发现返回均是二维矩阵,可以说明该函数用二维矩阵给出满足条件的位置索引。(若有错误,欢迎指正。)代码如下:import tensorflow as tfsess=tf.Session()import numpy as npprint('验 阅读全文
posted @ 2019-12-10 22:13 tangjunjun 阅读(3590) 评论(0) 推荐(1) 编辑
摘要:tf.argmax(input,axis)根据axis取值的不同返回每行或者每列最大值的索引。代码如下: import tensorflow as tfimport numpy as npsess=tf.Session()a = np.array([[1, 2, 3], [2, 3, 4], [5, 阅读全文
posted @ 2019-12-09 23:30 tangjunjun 阅读(489) 评论(0) 推荐(0) 编辑
摘要:import tensorflow as tfimport numpy as npsess=tf.Session()a=np.ones((5,6))c=tf.cast(tf.reduce_sum(a, axis=1),tf.bool) # tf.reduce_sum 表示按照axis方向求和c=se 阅读全文
posted @ 2019-12-02 00:28 tangjunjun 阅读(369) 评论(0) 推荐(0) 编辑
摘要:import tensorflow as tfimport numpy as npimport cv2 as cvimport matplotlib.pyplot as pltsess=tf.Session()name='../main/0.jpg' # 相对位置img=tf.read_file(n 阅读全文
posted @ 2019-11-07 23:39 tangjunjun 阅读(852) 评论(0) 推荐(0) 编辑
摘要:我使用tensorboard继续做了标量展示与直方图展示,在一的基础做了拓展,其改写代码如下: import numpy as npimport tensorflow as tfimport random# x_img = np.array(np.ones((5,784)))y_lable = np 阅读全文
posted @ 2019-11-06 23:27 tangjunjun 阅读(321) 评论(0) 推荐(0) 编辑
摘要:我使用tensorboard中的graph做了展示,至于其它功能可以类推,其代码如下: import numpy as npimport tensorflow as tfx_img = np.array(np.ones((5,784))) # 自己编造的图片数据y_lable = np.array( 阅读全文
posted @ 2019-11-04 22:46 tangjunjun 阅读(5012) 评论(0) 推荐(0) 编辑
摘要:版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本文链接:https://blog.csdn.net/dcrmg/article/details/79091941 tf.ConfigProto()函数用在创建session的时候,用来对sess 阅读全文
posted @ 2019-10-30 22:44 tangjunjun 阅读(2511) 评论(0) 推荐(2) 编辑
摘要:def draw_bbox(image, bboxes, class_i, show_label=True): # 将中心点坐标与w,h通过变化为左上角与右下角坐标 bboxes_change = np.copy(bboxes) bboxes[:,0:2]=bboxes_change[:,0:2]-0.5*bboxes_change[:,2:4] bboxes[:, 0:2] = bboxes_c 阅读全文
posted @ 2019-10-30 16:00 tangjunjun 阅读(1018) 评论(0) 推荐(0) 编辑
摘要:补充: 阅读全文
posted @ 2019-10-29 15:12 tangjunjun 阅读(11152) 评论(0) 推荐(0) 编辑
摘要:def image_preporcess(image, target_size, gt_boxes=None): image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB).astype(np.float32) ih, iw = target_size h, w, 阅读全文
posted @ 2019-10-24 20:12 tangjunjun 阅读(689) 评论(0) 推荐(0) 编辑
摘要:一 .tf.variable() 在模型中每次调用都会重建变量,使其存储相同变量而消耗内存,如: def repeat_value(): weight=tf.variable(tf.random_normal([5,5,6]),name='weight') return weight 如果多次调用函 阅读全文
posted @ 2019-10-23 15:11 tangjunjun 阅读(1734) 评论(0) 推荐(0) 编辑
摘要:1. 模型参数的保存: 阅读全文
posted @ 2019-10-16 00:25 tangjunjun 阅读(1656) 评论(0) 推荐(0) 编辑
摘要:1. tf.global_variables_initializer() 可以初始化所有变量。 2. tf.variables_initializer([var_list]) 仅初始化列表var_list种的值。 报错结果: 正确结果: 3. 变量重复赋值并未报错,其结果如下: 此点证实模型参数可以 阅读全文
posted @ 2019-10-15 22:59 tangjunjun 阅读(1553) 评论(0) 推荐(0) 编辑
摘要:线性soft-nms: 高斯nms: 阅读全文
posted @ 2019-09-30 16:32 tangjunjun 阅读(916) 评论(0) 推荐(1) 编辑
摘要:正确的做法: 阅读全文
posted @ 2019-09-21 09:44 tangjunjun 阅读(4207) 评论(0) 推荐(1) 编辑
摘要:总结:二者用法一致。a=np.array([[[[10,8,3,9],[5,6,7,8]]],[[[1,2,3,4],[5,6,7,8]]],[[[1,2,3,4],[5,6,7,8]]]] )print('a=',a)print('a.shape=',a.shape)c=np.minimum(a[...,:2], a[...,2:]) # 说明在对应位置找最小值print('c=',c)pri... 阅读全文
posted @ 2019-09-19 19:51 tangjunjun 阅读(2668) 评论(0) 推荐(0) 编辑
摘要:import numpy as npimport tensorflow as tfsess=tf.Session()a=np.zeros((1,2,3,4))b=np.ones((1,2,3,4))c1 = tf.concat([a, b], axis=-1) # 倒数第一维度增加,其它不变d1=sess.run(c1)print('d1=',d1)print('d1.shape=',d1.sha 阅读全文
posted @ 2019-09-18 23:12 tangjunjun 阅读(2777) 评论(0) 推荐(0) 编辑
摘要:sess=tf.Session()a=np.array([1,2,3,5.]) # 此代码保留为浮点数a1=np.array([1,2,3,5]) # 此代码保留为整数 c=tf.reduce_mean(a)d=sess.run(c)print(a)print(d)c1=tf.reduce_mean(a1)d1=sess.run(c1)print(a1)print(d1) 总结:tf.re... 阅读全文
posted @ 2019-09-12 17:29 tangjunjun 阅读(6914) 评论(0) 推荐(0) 编辑

https://rpc.cnblogs.com/metaweblog/tangjunjun
点击右上角即可分享
微信分享提示