在 faster  rcnn的tensorflow 实现中看到这个函数

rois,rpn_scores=tf.py_func(proposal_layer,[rpn_cls_prob,rpn_bbox_pred,self._im_info,self.mode,self._feat_stride,self._anchors,self._num_anchors],[tf.float32,tf.float32],name="proposal")

  tensorflow 官网上的解释

py_func(
    func,
    inp,
    Tout,
    stateful=True,
    name=None
)

将python 函数包装为一个tensorflow操作符
python 函数proposal_layer 以numpy 矩阵作为输入输出,使函数变为tensorflow图中的操作符
定义一个简单的sinh函数在tensorflow图中:
def my_func(x):
# x will be a numpy array with the contents of the placeholder below
return np.sinh(x)
inp = tf.placeholder(tf.float32)
y = tf.py_func(my_func, [inp], tf.float32)

tf.py_func的更多相关文章

  1. Tensorflow之调试(Debug) && tf.py_func()

    Tensorflow之调试(Debug)及打印变量 tensorflow调试tfdbg 几种常用方法: 1.通过Session.run()获取变量的值 2.利用Tensorboard查看一些可视化统计 ...

  2. 使用多块GPU进行训练 1.slim.arg_scope(对于同等类型使用相同操作) 2.tf.name_scope(定义名字的范围) 3.tf.get_variable_scope().reuse_variable(参数的复用) 4.tf.py_func(构造函数)

    1. slim.arg_scope(函数, 传参) # 对于同类的函数操作,都传入相同的参数 from tensorflow.contrib import slim as slim import te ...

  3. tf.data

    以往的TensorFLow模型数据的导入方法可以分为两个主要方法,一种是使用feed_dict另外一种是使用TensorFlow中的Queues.前者使用起来比较灵活,可以利用Python处理各种输入 ...

  4. tf调试函数

    Tensorflow之调试(Debug)及打印变量   参考资料:https://wookayin.github.io/tensorflow-talk-debugging 几种常用方法: 1.通过Se ...

  5. TensorFlow学习笔记(一):数据操作指南

    扩充 TensorFlow tf.tile 对数据进行扩充操作 import tensorflow as tf temp = tf.tile([1,2,3],[2]) temp2 = tf.tile( ...

  6. tensorflow_目标识别object_detection_api,RuntimeError: main thread is not in main loop,fig = plt.figure(frameon=False)_tkinter.TclError: no display name and no $DISPLAY environment variable

    最近在使用目标识别api,但是报错了: File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/script_o ...

  7. tensorflow faster rcnn 代码分析一 demo.py

    os.environ["CUDA_VISIBLE_DEVICES"]=2 # 设置使用的GPU tfconfig=tf.ConfigProto(allow_soft_placeme ...

  8. CTPN项目部分代码学习

    上次拜读了CTPN论文,趁热打铁,今天就从网上找到CTPN 的tensorflow代码实现一下,这里放出大佬的github项目地址:https://github.com/eragonruan/text ...

  9. R2CNN项目部分代码学习

    首先放出大佬的项目地址:https://github.com/yangxue0827/R2CNN_FPN_Tensorflow 那么从输入的数据开始吧,输入的数据要求为tfrecord格式的数据集,好 ...

随机推荐

  1. kunbernetes-快速入门

    1.入门概述 本文以在容器云上部署一个nexus3应用为例,通过通过一步步的操作,帮助用户快速的对Kubernetes有一个快速和整体的认识.通过快速入门,可以提供如下知识内容: 在集群中部署一个容器 ...

  2. 倒计时js

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. 理解IO、NIO、 AIO

    转载:https://baijiahao.baidu.com/s?id=1586112410163034993&wfr=spider&for=pc nio 同步: 自己亲自出马持银行卡 ...

  4. python项目在无外网的生产环境解决沙盒依赖问题

    参考 https://yq.aliyun.com/articles/159599 https://www.jianshu.com/p/08c657bd34f1 缺点是 只能针对python的环境 做沙 ...

  5. android 获取通话记录

    在manifest添加以下权限<uses-permission android:name="android.permission.READ_CALL_LOG" />&l ...

  6. 1.[Andriod]之Andriod布局 VS WinPhone布局

    0.写在前面的话 近来被HTML+CSS的布局折腾的死去活来,眼巴巴的看着CSS3中的flex,grid等更便捷更高效的的布局方式无法在项目中应用,心里那叫一个窝火啊,去你妹的兼容性,,, 最近体验下 ...

  7. springBoot中使用定时任务

    简单示例 导入依赖 springBoot已经默认集成了定时任务的依赖,只需要引入基本的依赖就可以使用定时任务. <parent> <groupId>org.springfram ...

  8. L1-8 矩阵A乘以B (15 分)

    给定两个矩阵A和B,要求你计算它们的乘积矩阵AB.需要注意的是,只有规模匹配的矩阵才可以相乘.即若A有R​a​​行.C​a​​列,B有R​b​​行.C​b​​列,则只有C​a​​与R​b​​相等时,两 ...

  9. mysql 解压版安装

    1.官网下载压缩包 2.解压 3.配置环境变量 添加系统环境变量  MYSQL_HOME 值为解压的主目录,例如     D:\mysql-5.7.25-winx64 修改Path 环境变量,点击编辑 ...

  10. json 百分比转化

    NumberFormat number = NumberFormat.getPercentInstance(); number.setMaximumFractionDigits(0);//设置小数点后 ...