deep-learning

I'm reading images on the disk, how to plot like the first 50 images?

穿精又带淫゛_ 提交于 2021-02-11 13:11:08
问题 I am reading images on the disk, how to make a for and where to put it to plot the first 50 images on the screen, I want to make sure, that I'm reading the right images, it's for deep learning. def load_clef_database(): img_data_list = [] dataset_dir = "/Users/PlantCLEF2015" root = os.path.join(dataset_dir, 'train') filenames = [] # files class_species = [] class_species_unique = [] class_species_unique_id = [] class_familys = [] class_geni = [] class_ids = [] class_contents = [] metadata = [

Should I be using tf.keras or keras in 2020?

馋奶兔 提交于 2021-02-11 12:42:48
问题 A while back I read this post on PyImageSearch and was satisfied enough to switch completely to tf.keras . But since then I noticed the Keras website got an overhaul and seems to be expanding on its ambitions. So I'm a bit confused. Is it still true that "the latest release of the keras package (v2.3.0) will be the last release to support multiple backends and feature updates. Moving forward, the keras package will receive only bug fixes." from PyImageSearch? If I stick with tf.keras could I

Why doesn't the Adadelta optimizer decay the learning rate?

倖福魔咒の 提交于 2021-02-11 12:32:07
问题 I have initialised an Adadelta optimizer in Keras (using Tensorflow backend) and assigned it to a model: my_adadelta = keras.optimizers.Adadelta(learning_rate=0.01, rho=0.95) my_model.compile(optimizer=my_adadelta, loss="binary_crossentropy") During training, I am using a callback to print the learning rate after every epoch: class LRPrintCallback(Callback): def on_epoch_end(self, epoch, logs=None): lr = self.model.optimizer.lr print(K.eval(lr)) However, this prints the same (initial)

How to implement gradient ascent in a Keras DQN

落爺英雄遲暮 提交于 2021-02-11 12:30:01
问题 Have built a Reinforcement Learning DQN with variable length sequences as inputs, and positive and negative rewards calculated for actions. Some problem with my DQN model in Keras means that although the model runs, average rewards over time decrease, over single and multiple cycles of epsilon. This does not change even after significant period of training. My thinking is that this is due to using MeanSquareError in Keras as the Loss function (minimising error). So I am trying to implement

How to implement gradient ascent in a Keras DQN

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-11 12:27:04
问题 Have built a Reinforcement Learning DQN with variable length sequences as inputs, and positive and negative rewards calculated for actions. Some problem with my DQN model in Keras means that although the model runs, average rewards over time decrease, over single and multiple cycles of epsilon. This does not change even after significant period of training. My thinking is that this is due to using MeanSquareError in Keras as the Loss function (minimising error). So I am trying to implement

How do I build a TFmodel from NumPy array files?

家住魔仙堡 提交于 2021-02-11 12:19:54
问题 I have a dir with NumPy array files: bias1.npy, kernel1.npy, bias2.npy, kernel2.npy . How can I build a TF model that uses those arrays as kernels and biases of layers? 回答1: To avoid confusion bias matrix for the consistency of the numpy file is the 2D matrix with one column. This post shows how did I reproduce tf's model based on the numpy weights and biases. class NumpyInitializer(tf.keras.initializers.Initializer): # custom class converting numpy arrays to tf's initializers # used to

Reward function for learning to play Curve Fever game with DQN

会有一股神秘感。 提交于 2021-02-11 10:40:41
问题 I've made a simple version of Curve Fever also known as "Achtung Die Kurve". I want the machine to figure out how to play the game optimally. I copied and slightly modified an existing DQN from some Atari game examples that is made with Google's Tensorflow. I'm tyring to figure out an appropriate reward function. Currently, I use this reward setup: 0.1 for every frame it does not crash -500 for every crash Is this the right approach? Do I need to tweak the values? Or do I need a completely

Implementing Attention in Keras

梦想的初衷 提交于 2021-02-11 07:24:18
问题 I am trying to implement attention in keras over a simple lstm: model_2_input = Input(shape=(500,)) #model_2 = Conv1D(100, 10, activation='relu')(model_2_input) model_2 = Dense(64, activation='sigmoid')(model_2_input) model_2 = Dense(64, activation='sigmoid')(model_2) model_1_input = Input(shape=(None, 2048)) model_1 = LSTM(64, dropout_U = 0.2, dropout_W = 0.2, return_sequences=True)(model_1_input) model_1, state_h, state_c = LSTM(16, dropout_U = 0.2, dropout_W = 0.2, return_sequences=True,

Implementing Attention in Keras

我只是一个虾纸丫 提交于 2021-02-11 07:24:11
问题 I am trying to implement attention in keras over a simple lstm: model_2_input = Input(shape=(500,)) #model_2 = Conv1D(100, 10, activation='relu')(model_2_input) model_2 = Dense(64, activation='sigmoid')(model_2_input) model_2 = Dense(64, activation='sigmoid')(model_2) model_1_input = Input(shape=(None, 2048)) model_1 = LSTM(64, dropout_U = 0.2, dropout_W = 0.2, return_sequences=True)(model_1_input) model_1, state_h, state_c = LSTM(16, dropout_U = 0.2, dropout_W = 0.2, return_sequences=True,

Tensorflow ValueError: Failed to find data adapter that can handle input

﹥>﹥吖頭↗ 提交于 2021-02-10 20:32:08
问题 Hello I'm trying to make the basic example of tensorflow minst using data from images on my pc. But I run into this error all the time: "ValueError: Failed to find data adapter that can handle input: , ( containing values of types {""})" here's how i generate data: import numpy as np # for array operations import matplotlib.pyplot as plt # to show image import os # to move through directories import cv2 # to make image operations import random import pickle DATADIR=r"C:\Users\...\mnist_png