theano

Getting Keras (with Theano) to work with Celery

老子叫甜甜 提交于 2019-12-03 07:47:11
I have some keras code which works synchronously to predict a given input, I have even made amendments so it can work with standard multi-threading (using locks in a seperate class from this) however when running via asynchronous celery (even with one worker and one task) I get an error on calling predict on the keras model. @app.task def predict_task(param): """Run task.""" json_file = open('keras_model.json', 'r') loaded_model_json = json_file.read() json_file.close() model = model_from_json(loaded_model_json) model.load_weights('keras_weights.h5') tokenizer_file = open('tokenizer.pickle',

Using Python+Theano with OpenCL in an AMD GPU

限于喜欢 提交于 2019-12-03 07:14:32
问题 I'm trying to use Python with Theano to accelerate some code with OpenCL. I installed libgpuarray and pygpu as instructed (I think), and got no errors. The installation detected the OpenCL runtime installed. I just cannot run the Theano example for OpenCL, mainly because I don't know how to specify my GPU. My GPU is a Radeon HD 5340/5450/5470 , according to inxi . All code in the Theano documentation uses device=cuda0 and the only place where OpenCL is mentioned, it says device=openclN where

Theano import error: No module named cPickle

自古美人都是妖i 提交于 2019-12-03 06:26:24
>>> import theano Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Python/2.7/site-packages/theano/__init__.py", line 52, in <module> from theano.gof import ( File "/Library/Python/2.7/site-packages/theano/gof/__init__.py", line 38, in <module> from theano.gof.cc import \ File "/Library/Python/2.7/site-packages/theano/gof/cc.py", line 30, in <module> from theano.gof import link File "/Library/Python/2.7/site-packages/theano/gof/link.py", line 18, in <module> from theano.gof.type import Type File "/Library/Python/2.7/site-packages/theano/gof/type.py", line

How to enable Keras with Theano to utilize multiple GPUs

爷,独闯天下 提交于 2019-12-03 06:18:01
Setup: Using a Amazon Linux system with a Nvidia GPU I'm using Keras 1.0.1 Running Theano v0.8.2 backend Using CUDA and CuDNN THEANO_FLAGS="device=gpu,floatX=float32,lib.cnmem=1" Everything works fine, but I run out of video memory on large models when I increase the batch size to speed up training. I figure moving to a 4 GPU system would in theory either improve total memory available or allow smaller batches to build faster, but observing the the nvidia stats, I can see only one GPU is used by default: +------------------------------------------------------+ | NVIDIA-SMI 361.42 Driver

Calling “fit” multiple times in Keras

三世轮回 提交于 2019-12-03 05:36:13
问题 I've working on a CNN over several hundred GBs of images. I've created a training function that bites off 4Gb chunks of these images and calls fit over each of these pieces. I'm worried that I'm only training on the last piece on not the entire dataset. Effectively, my pseudo-code looks like this: DS = lazy_load_400GB_Dataset() for section in DS: X_train = section.images Y_train = section.classes model.fit(X_train, Y_train, batch_size=16, nb_epoch=30) I know that the API and the Keras forums

Saliency maps of neural networks (using Keras)

江枫思渺然 提交于 2019-12-03 05:15:56
问题 I have a fully connected multilayer perceptron trained in Keras. I feed it an N-dimensional feature vector and it predicts one out of M classes for the input vector. The training and prediction is working well. Now I want to analyze what part of the input feature vector is actually responsible for a particular class. For example, lets say there are two classes A and B , and an input vector f . The vector f belongs to class A and the network predicts it correctly - the output of the network is

基于theano的卷积神经网络实现中遇到的问题

佐手、 提交于 2019-12-03 04:11:11
No module named theano.tensor.nnet 在使用Anaconda Navigator-jupyter notebook运行下面的python代码时,出现上述问题。 import theano from theano.tensor.nnet import conv import theano.tensor as T 解决方法: 在Anaconda – Environments中安装需要的theano组件。 注意:有时会因为网络问题,导致部分安装失败,可以多次尝试。 UserWarning: downsample module has been moved 在运行下面代码的时候,出现如下错误提示: from theano.tensor.signal import downsample 解决方法:将上述代码改为: from theano.tensor.signal import pool # from theano.tensor.signal import downsample 同时,对于使用了下面代码的语句,也需要做一些改动。 pool_out = downsample.max_pool_2d(input, maxpool_shape, ignore_border=True) # 改为: pool_out = pool.pool_2d(input,

What is data type for Python Keras deep learning package?

情到浓时终转凉″ 提交于 2019-12-03 03:41:28
I didn't find anything about data type that we need to work with Python Keras deep learning package with this link. I checked array and list but returned error. Any clue? Keras uses numpy arrays containing the theano.config.floatX floating point type. This can be configured in your .theanorc file. Typically, it will be float64 for CPU computations and float32 for GPU computations, although you can also set it to float32 when working on the CPU if you prefer. You can create a zero-filled array of the proper type by the command X = numpy.zeros((4,3), dtype=theano.config.floatX) 来源: https:/

Keras: reshape to connect lstm and conv

不问归期 提交于 2019-12-03 03:21:42
This question exists as a github issue , too. I would like to build a neural network in Keras which contains both 2D convolutions and an LSTM layer. The network should classify MNIST. The training data in MNIST are 60000 grey-scale images of handwritten digits from 0 to 9. Each image is 28x28 pixels. I've splitted the images into four parts (left/right, up/down) and rearranged them in four orders to get sequences for the LSTM. | | |1 | 2| |image| -> ------- -> 4 sequences: |1|2|3|4|, |4|3|2|1|, |1|3|2|4|, |4|2|3|1| | | |3 | 4| One of the small sub-images has the dimension 14 x 14. The four

theano g++ not detected

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I installed theano but when I try to use it I got this error: WARNING (theano.configdefaults): g++ not detected! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. I installed g++ , and put the correct path in the environment variables, so it is like theano does not detect it. Does anyone know how to solve the problem or which may be the cause? 回答1: I had this occur on OS X after I updated XCode (through the App Store).