keras

Implement perceptual loss with pretrained VGG using keras

强颜欢笑 提交于 2020-12-29 04:23:18
问题 I am relatively new to DL and Keras. I am trying to implement perceptual loss using the pretrained VGG16 in Keras but have some troubles. I already found that question but I am still struggling :/ A short explanation of what my network should do: I have a CNN (subsequent called mainModel) that gets grayscale images as input (#TrainData, 512, 512, 1) and outputs grayscale images with the same size. The network should reduce artifacts in the images - but I think it is not that important for

GPU only being used 1-5% Tensorflow-gpu and Keras

夙愿已清 提交于 2020-12-29 04:08:58
问题 I just installed tensorflow for gpu and am using keras for my CNN. During training my GPU is only used about 5%, but 5 out of 6gb of the vram is being used during the training. Sometimes it glitches, prints 0.000000e+00 in the console and the gpu goes to 100% but then after a few seconds the training slows back down to 5%. My GPU is the Zotac gtx 1060 mini and I am using a Ryzen 5 1600x. Epoch 1/25 121/3860 [..............................] - ETA: 31:42 - loss: 3.0575 - acc: 0.0877 - val_loss:

GPU only being used 1-5% Tensorflow-gpu and Keras

ε祈祈猫儿з 提交于 2020-12-29 04:08:38
问题 I just installed tensorflow for gpu and am using keras for my CNN. During training my GPU is only used about 5%, but 5 out of 6gb of the vram is being used during the training. Sometimes it glitches, prints 0.000000e+00 in the console and the gpu goes to 100% but then after a few seconds the training slows back down to 5%. My GPU is the Zotac gtx 1060 mini and I am using a Ryzen 5 1600x. Epoch 1/25 121/3860 [..............................] - ETA: 31:42 - loss: 3.0575 - acc: 0.0877 - val_loss:

GPU only being used 1-5% Tensorflow-gpu and Keras

旧街凉风 提交于 2020-12-29 04:08:34
问题 I just installed tensorflow for gpu and am using keras for my CNN. During training my GPU is only used about 5%, but 5 out of 6gb of the vram is being used during the training. Sometimes it glitches, prints 0.000000e+00 in the console and the gpu goes to 100% but then after a few seconds the training slows back down to 5%. My GPU is the Zotac gtx 1060 mini and I am using a Ryzen 5 1600x. Epoch 1/25 121/3860 [..............................] - ETA: 31:42 - loss: 3.0575 - acc: 0.0877 - val_loss:

Keras(四)CNN 卷积神经网络 RNN 循环神经网络 原理及实例

江枫思渺然 提交于 2020-12-29 00:43:37
原文链接: http://www.one2know.cn/keras5/ CNN 卷积神经网络 卷积 池化 https://www.cnblogs.com/peng8098/p/nlp_16.html 中有介绍 以数据集MNIST构建一个卷积神经网路 from keras.layers import Dense,Activation,Conv2D,MaxPooling2D,Flatten from keras.models import Model,Sequential from keras.datasets import mnist from keras.utils import np_utils # 构建数据集 (x_train,y_train),(x_test,y_test) = mnist.load_data() x_train = x_train.reshape(x_train.shape[0],1,28,28)/255 x_test = x_test.reshape(x_test.shape[0],1,28,28)/255 y_train = np_utils.to_categorical(y_train,num_classes=10) y_test = np_utils.to_categorical(y_test,num_classes=10) print(x

Why is TF Keras inference way slower than Numpy operations?

隐身守侯 提交于 2020-12-28 16:30:32
问题 I'm working on a reinforcement learning model implemented with Keras and Tensorflow. I have to do frequent calls to model.predict() on single inputs. While testing inference on a simple pretrained model, I noticed that using Keras' model.predict is WAY slower than just using Numpy on stored weights. Why is it that slow and how can I accelerate it? Using pure Numpy is not viable for complex models. import timeit import numpy as np from tensorflow.python.keras.models import Sequential from

Why is TF Keras inference way slower than Numpy operations?

心已入冬 提交于 2020-12-28 16:29:35
问题 I'm working on a reinforcement learning model implemented with Keras and Tensorflow. I have to do frequent calls to model.predict() on single inputs. While testing inference on a simple pretrained model, I noticed that using Keras' model.predict is WAY slower than just using Numpy on stored weights. Why is it that slow and how can I accelerate it? Using pure Numpy is not viable for complex models. import timeit import numpy as np from tensorflow.python.keras.models import Sequential from

Why is TF Keras inference way slower than Numpy operations?

好久不见. 提交于 2020-12-28 16:25:09
问题 I'm working on a reinforcement learning model implemented with Keras and Tensorflow. I have to do frequent calls to model.predict() on single inputs. While testing inference on a simple pretrained model, I noticed that using Keras' model.predict is WAY slower than just using Numpy on stored weights. Why is it that slow and how can I accelerate it? Using pure Numpy is not viable for complex models. import timeit import numpy as np from tensorflow.python.keras.models import Sequential from

矩池云 | 新冠肺炎防控:肺炎CT检测

a 夏天 提交于 2020-12-28 08:55:41
连日来,新型冠状病毒感染的肺炎疫情,牵动的不仅仅是全武汉、全湖北,更是全国人民的心,大家纷纷以自己独特的方式为武汉加油!我们相信坚持下去,终会春暖花开。 今天让我们以简单实用的神经网络模型,来检测肺炎的CT影像。 第一步:导入我们需要的库 from keras.preprocessing.image import ImageDataGenerator, load_img from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten, ZeroPadding2D, Conv2D, MaxPooling2D, Activation from keras.optimizers import Adam, SGD, RMSprop from keras.callbacks import EarlyStopping from keras import backend as K import tensorflow as tf config = tf.ConfigProto() config.gpu_options.per_process_gpu_memory_fraction = 0.9 K.tensorflow_backend.set_session(tf.Session(config

what is the default kernel_initializer in keras

蹲街弑〆低调 提交于 2020-12-28 04:27:45
问题 In the user manual, it shows the different kernel_initializer below https://keras.io/initializers/ the main purpose is to initialize the weight matrix in the neural network. Anyone knows what the default initializer is? the document didn't show the default. 回答1: Usually, it's glorot_uniform by default. Different layer types might have different default kernel_initializer . When in doubt, just look in the source code. For example, for Dense layer: class Dense(Layer): ... def __init__(self,