keras

Keras predict loop memory leak using tf.data.Dataset but not with a numpy array

大兔子大兔子 提交于 2021-02-07 06:43:17
问题 I encounter a memory leak and decreasing performance when looping over a Keras model predict function when using a tf.data.Dataset to feed the model, but not when feeding it with a numpy array. Does anyone understand what is causing this and/or how to resolve the issue? Minimal reproducible code snippet (copy/paste runnable): import tensorflow as tf import numpy as np import time SIZE = 5000 inp = tf.keras.layers.Input(shape=(SIZE,), dtype='float32') x = tf.keras.layers.Dense(units=SIZE)(inp)

Why are my results still not reproducible?

≯℡__Kan透↙ 提交于 2021-02-07 06:39:11
问题 I want to get reproducible results for a CNN. I use Keras and Google Colab with GPU. In addition to recommendations to insert certain code snippets, which should allow a reproducibility, I also added seeds to the layers. ###### This is the first code snipped to run ##### !pip install -U -q PyDrive from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth from oauth2client.client import GoogleCredentials # Authenticate and create the PyDrive client

Heroku: deploying Deep Learning model

岁酱吖の 提交于 2021-02-07 06:17:27
问题 I have developed a rest API using Flask to expose a Python Keras Deep Learning model (CNN for text classification). I have a very simple script that loads the model into memory and outputs class probabilities for a given text input. The API works perfectly locally. However, when I git push heroku master , I get Compiled slug size: 588.2M is too large (max is 500M) . The model is 83MB in size, which is quite small for a Deep Learning model. Notable dependencies include Keras and its tensorflow

Single Thread Impacts Model Accuracy and Loss with TensorFlow Keras Backend

瘦欲@ 提交于 2021-02-07 05:36:11
问题 Question Why does setting the number of threads in the TensorFlow backend for Keras, intra_op_parallelism_threads and inter_op_parallelism_threads, to 1 negatively impact the accuracy and loss of a model? Background I am using Keras (2.1.6) to train an MNIST CNN with TensorFlow (1.7.0) as the backend. I was running some training in an AWS EC2 instance and noticed my accuracy decreased greatly after switching from a t2.medium instance to a t2.small. This happened without changing the code at

Find most similar images by using neural networks

痴心易碎 提交于 2021-02-07 04:41:47
问题 I am working with Python, scikit-learn and keras. I have 3000 thousands images of front-faced watches like the following ones: Watch_1, Watch_2, Watch_3. I like to write program which receives as an input a photo of a real watch which maybe taken under less ideal conditions than the photos above (different background colour, darker lightning etc) and find the most similar watches among the 3000 ones to it. By similarity I mean that if I give as an input a photo of a round, brown watch with

Add DropOut after loading the weights in Keras

余生长醉 提交于 2021-02-07 04:37:50
问题 I am doing king of transfer learning. What I have done is First train the model with the big datasets and save the weights. Then I train the model with my dataset by freezing the layers. But I see there was some overfitting. So I try to change the dropout of the model and load the weights since the numbers are changing while drop out are changing. I find difficulties to change the dropout. Directly my question is, Is it possible to change the model's dropout while loading the weights? my

How to do zero padding in keras conv layer?

a 夏天 提交于 2021-02-07 00:00:25
问题 I am trying to implement model from scientific article, which says they are using zero padding. Is it possible to configure this padding in keras Conv2D? Only possible values for padding I see are padding: one of "valid" or "same" (case-insensitive). Is it possible to pad with zeros or other constant values? 回答1: "same" means zero padding. It is currently not possible to pad with other constants in an efficient way. 回答2: When you use padding='valid' , there's no padding. When you use padding=

How to do zero padding in keras conv layer?

北慕城南 提交于 2021-02-06 23:59:45
问题 I am trying to implement model from scientific article, which says they are using zero padding. Is it possible to configure this padding in keras Conv2D? Only possible values for padding I see are padding: one of "valid" or "same" (case-insensitive). Is it possible to pad with zeros or other constant values? 回答1: "same" means zero padding. It is currently not possible to pad with other constants in an efficient way. 回答2: When you use padding='valid' , there's no padding. When you use padding=

How to do zero padding in keras conv layer?

你离开我真会死。 提交于 2021-02-06 23:57:02
问题 I am trying to implement model from scientific article, which says they are using zero padding. Is it possible to configure this padding in keras Conv2D? Only possible values for padding I see are padding: one of "valid" or "same" (case-insensitive). Is it possible to pad with zeros or other constant values? 回答1: "same" means zero padding. It is currently not possible to pad with other constants in an efficient way. 回答2: When you use padding='valid' , there's no padding. When you use padding=

小白学PyTorch | 15 TF2实现一个简单的服装分类任务

爷,独闯天下 提交于 2021-02-06 21:36:42
【机器学习炼丹术】的学习笔记分享 <<小白学PyTorch>> 小白学PyTorch | 14 tensorboardX可视化教程 小白学PyTorch | 13 EfficientNet详解及PyTorch实现 小白学PyTorch | 12 SENet详解及PyTorch实现 小白学PyTorch | 11 MobileNet详解及PyTorch实现 小白学PyTorch | 10 pytorch常见运算详解 小白学PyTorch | 9 tensor数据结构与存储结构 小白学PyTorch | 8 实战之MNIST小试牛刀 小白学PyTorch | 7 最新版本torchvision.transforms常用API翻译与讲解 小白学PyTorch | 6 模型的构建访问遍历存储(附代码) 小白学PyTorch | 5 torchvision预训练模型与数据集全览 小白学PyTorch | 4 构建模型三要素与权重初始化 小白学PyTorch | 3 浅谈Dataset和Dataloader 小白学PyTorch | 2 浅谈训练集验证集和测试集 小白学PyTorch | 1 搭建一个超简单的网络 小白学PyTorch | 动态图与静态图的浅显理解 这个系列《小白学PyTorch》的所有代码和数据集放在了公众号【机器学习炼丹术】后台,回复【pytorch】获取(已经更新到最新