标签: tensorflow

有没有人设法让异步优势演员评论家与Mujoco实验合作?

我在Tensorflow中使用了a3c实现的开源版本,这对于atari 2600实验非常有效.但是,当我修改Mujoco的网络时,如文中所述,网络拒绝学习任何有意义的东西.有没有人设法使a3c的任何开源实现与连续域问题一起工作,例如mujoco?

reinforcement-learning deep-learning tensorflow

0
推荐指数
1
解决办法
1658
查看次数

具有多个gpu的分布式张量流

似乎tf.train.replica_device_setter不允许指定使用的gpu.

我想做的是如下:

 with tf.device(
   tf.train.replica_device_setter(
   worker_device='/job:worker:task:%d/gpu:%d' % (deviceindex, gpuindex)):
     <build-some-tf-graph>
Run Code Online (Sandbox Code Playgroud)

distributed tensorflow

0
推荐指数
1
解决办法
2057
查看次数

当我增加将数据推送到它的线程数时,我的tensorflow队列的填充速度变慢

我已经写了一些代码将数据推送到tensorflow中的队列中,我的队列处理程序的初始化以及所有线程运行的主要功能如下:

def __init__(self):
    self.X = tf.placeholder(tf.int64)
    self.Y = tf.placeholder(tf.int64)
    self.queue = tf.RandomShuffleQueue(dtypes=[tf.int64, tf.int64],
                                       capacity=100,
                                       min_after_dequeue=20)

    self.enqueue_op = self.queue.enqueue([self.X, self.Y])


def thread_main(self, sess, coord):
    """Cycle through the dataset until the main process says stop."""
    train_fs = open(data_train, 'r')
    while not coord.should_stop():
        X_, Y_ = get_batch(train_fs)
        if not Y: #We're at the end of the file
            train_fs = open(data_train, 'r')
            X, Y = get_batch(train_fs)
        sess.run(self.enqueue_op, feed_dict={self.X:X_, self.Y:Y_}) 
Run Code Online (Sandbox Code Playgroud)

在培训期间,我正在监视队列的大小。由于某些原因,当我增加向其中推送数据的线程数量时,队列的填充速度会变慢。知道为什么吗?是因为我正在同时读取python文件吗?

编辑:

这是我正在使用的代码,在数据和图形旁边它是完全相同的。该代码在此虚拟数据上的行为符合预期。我有两个观察结果:

  • 我认为我没有适当地关闭线程,似乎它们在执行后会卡在队列中,而我运行的代码越多,它就会变得越慢。
  • 由于多线程在这里发挥作用,我猜失败的仅有两点是图形和读取数据的方式。

首先,生成一个虚拟数据集:

data_train = "./test.txt"

with open(data_train, 'w') as out_stream:
    out_stream.write("""[1,2,3,4,5,6]|1\n[1,2,3,4]|2\n[1,2,3,4,5,6]|0\n[1,2,3,4,5,6]|1\n[1,2,5,6]|1\n[1,2,5,6]|0""") …
Run Code Online (Sandbox Code Playgroud)

python-multiprocessing tensorflow

0
推荐指数
1
解决办法
1000
查看次数

读取TFRecords:AttributeError:'str'对象没有属性'queue_ref'

我整天都花在这上面,并且不知道我做错了什么.请帮忙.我使用以下代码创建了包含一些图像的TFRecords文件:

def convert_to_TF(images, labels, name):
label_count = labels.shape[0]
print('There are %d images in this dataset.' % (label_count))
if images.shape[0] != label_count:
    raise ValueError('WTF! Devil! There are %d images and %d labels. Go fix yourself!' %
                     (images.shape[0], label_count))
rows = images.shape[1]
cols = images.shape[2]
depth = images.shape[3]

filename = os.path.join(name + '.tfrecords')
print('Writing', filename)
writer = tf.python_io.TFRecordWriter(filename)
for index in range(label_count):
    image_raw = images[index].tostring()
    example = tf.train.Example(features=tf.train.Features(feature={
        'height': _int64_feature(rows),
        'width': _int64_feature(cols),
        'depth': _int64_feature(depth),
        'label': _int64_feature(int(labels[index])),
        'image_raw': _bytes_feature(image_raw)}))
    writer.write(example.SerializeToString())
Run Code Online (Sandbox Code Playgroud)

然后我尝试用以下内容读取保存的TFRecords文件:

def read_and_decode(filename_queue): …
Run Code Online (Sandbox Code Playgroud)

python-3.x tensorflow

0
推荐指数
1
解决办法
2512
查看次数

如何在张量流中缩放张量?

例如,我的张量形状是[128,128,3]并且它的范围是随机的,那么我想将这个张量中的所有num缩放到[0,255],我应该使用tensorflow中的哪个函数来做它?谢谢

tensorflow

0
推荐指数
1
解决办法
3958
查看次数

Tensorflow TFDetect演示是否对端到端跟踪对象?

这个问题是关于TFDetect演示,它是Tensorflow Android Camera Demo的一部分.描述说,

演示基于可扩展对象检测的模型,使用深度神经网络实时定位和跟踪摄像机预览中的人员.

当我运行演示时,应用程序在检测到的对象周围创建了一个框,并为每个对象分配了一个小数(我猜是置信度得分).我的问题是,如何在这里执行跟踪.它是多个对象跟踪(在此描述),其中有一个id分配给每个轨道并且轨道存储在内存中,或者只是检测多个帧中的对象以查看对象是如何移动的?

如果我错过任何事情,请纠正我.

android tensorflow

0
推荐指数
1
解决办法
1308
查看次数

Tensorflow调试器无法在Windows 10上运行

我的代码很简单:

import tensorflow as tf
import numpy as np
from tensorflow.python import debug as tf_debug

with tf.name_scope("multiplication"):
    a = tf.placeholder(tf.float32)
    b = tf.placeholder(tf.float32)
    c = tf.div(a, b, name="mult")

    with tf.Session() as session:
        session = tf_debug.LocalCLIDebugWrapperSession(session)
        session.add_tensor_filter("has_inf_or_nan", tf_debug.has_inf_or_nan)
        session.run([ c],feed_dict={a:100, b:10})
Run Code Online (Sandbox Code Playgroud)

但当我跑它时:

>python test.py --debug 
... 
ImportError: No module named '_curses' 
... 
ImportError: No module named 'readline'`
Run Code Online (Sandbox Code Playgroud)

我在网上查了一下,发现Windows 10不支持"_curses".这是否意味着我不能在Windows 10上使用Tensorflow Debugger?

tensorflow

0
推荐指数
1
解决办法
1692
查看次数

TensorFlow仅在使用MultiRNNCell时抛出错误

我正在使用传统的序列到序列框架在TensorFlow 1.0.1中构建编码器 - 解码器模型.当我在编码器和解码器中有一层LSTM时,一切正常.但是,当我尝试使用包裹在a中的> 1层LSTM时MultiRNNCell,我在调用时出错tf.contrib.legacy_seq2seq.rnn_decoder.

完整的错误是在这篇文章的最后,但简而言之,它是由一条线引起的

(c_prev, m_prev) = state
Run Code Online (Sandbox Code Playgroud)

在投掷的TensorFlow中TypeError: 'Tensor' object is not iterable..我对此感到困惑,因为我传递的初始状态rnn_decoder确实是一个应该是的元组.据我所知,使用1层或> 1层的唯一区别是后者涉及使用MultiRNNCell.使用它时是否有一些我应该知道的API怪癖?

这是我的代码(基于 GitHub仓库中的示例).道歉的长度; 这是我能做到的最小化,同时仍然是完整和可验证的.

import tensorflow as tf
import tensorflow.contrib.legacy_seq2seq as seq2seq
import tensorflow.contrib.rnn as rnn

seq_len = 50
input_dim = 300
output_dim = 12
num_layers = 2
hidden_units = 100

sess = tf.Session()

encoder_inputs = []
decoder_inputs = []

for i in range(seq_len):
    encoder_inputs.append(tf.placeholder(tf.float32, shape=(None, input_dim),
                                         name="encoder_{0}".format(i)))

for i in range(seq_len + …
Run Code Online (Sandbox Code Playgroud)

python deep-learning tensorflow recurrent-neural-network

0
推荐指数
1
解决办法
1069
查看次数

ModuleNotFoundError:没有名为'tensorflow'的模块

当我用Spyder导入TensorFlow时:

import tensorflow as tf
Run Code Online (Sandbox Code Playgroud)

然后我面临以下错误:

ModuleNotFoundError:没有名为'tensorflow'的模块

我怎样才能克服这个问题?

python spyder jupyter tensorflow

0
推荐指数
1
解决办法
2万
查看次数

在Windows中用Pip Python 3.5 anaconda安装tensorflow

我想在我的Windows 7 64位计算机上安装Tensorslow.

我用Python 3.5安装了Anaconda.

之后我做了 conda install theano

它成功完成了.
conda install mingw libpython
成功完成了.
pip install tensorflow
错误

我无法以与安装这些其他软件包相同的方式安装Tensorflow.我错过了什么基本的东西?

在此输入图像描述

python windows anaconda conda tensorflow

0
推荐指数
1
解决办法
7927
查看次数