neural-network

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

How to change the backend of Keras to Theano?

半腔热情 提交于 2021-02-10 15:28:09
问题 I installed keras. When I import keras, it says tensorflow not installed. I tried changing the backend in keras.json file to theano. But this doesn't help as it still says no module named tensorflow. Please help me fix this. 回答1: Did you try this? you will find the Keras configuration file at: $HOME/.keras/keras.json The default configuration file looks like this: { "image_data_format": "channels_last", "epsilon": 1e-07, "floatx": "float32", "backend": "tensorflow" } Simply change the field

Input 0 of layer lstm_9 is incompatible with the layer: expected ndim=3, found ndim=4. Full shape received: [None, 2, 4000, 256]

旧城冷巷雨未停 提交于 2021-02-10 14:49:31
问题 I try to create model with RNN network but I receive : Input 0 of layer lstm_9 is incompatible with the layer: expected ndim=3, found ndim=4. Full shape received: [None, 2, 4000, 256] error. INPUT train_data.shape() = (100,2,4000) train_labels.shape() =(100,) labels_values = 0 or 1 (two classes) MODEL input = Input(shape=(2,4000)) # shape from train_data embedded = Embedding(2, 256)(input) lstm = LSTM(1024, return_sequences=True)(embedded) # ERROR dense = Dense(2, activation='softmax')(lstm)

CNN loss with multiple outputs?

寵の児 提交于 2021-02-10 14:33:08
问题 I have the following model def get_model(): epochs = 100 learning_rate = 0.1 decay_rate = learning_rate / epochs inp = keras.Input(shape=(64, 101, 1), name="inputs") x = layers.Conv2D(128, kernel_size=(3, 3), strides=(3, 3), padding="same")(inp) x = layers.Conv2D(256, kernel_size=(3, 3), strides=(3, 3), padding="same")(x) x = layers.Flatten()(x) x = layers.Dense(150)(x) x = layers.Dense(150)(x) out1 = layers.Dense(40000, name="sf_vec")(x) out2 = layers.Dense(128, name="ls_weights")(x) model =

Simple Perceptron In Javascript for XOR gate

偶尔善良 提交于 2021-02-10 06:52:50
问题 I tried to use a single perceptron to predict the XOR gate. However, the results seem to be completely random and I cannot find the error. What am I doing wrong here ? - Is my training method wrong? - or is there any error in the perceptron model ? - or a single perceptron cannot be used for this problem ? class Perceptron { constructor(input_nodes, learning_rate) { this.nodes = input_nodes; this.bias = Math.random() * 2 - 1; this.learning_rate = learning_rate; this.weights = []; for (let i =

Neural Networks: A step-by-step breakdown of the Backpropagation phase?

两盒软妹~` 提交于 2021-02-10 06:31:09
问题 I have to design an animated visual representation of a neural network that is functional (i.e. with UI that allows you to tweak values etc). The primary goal with it is to help people visualize how and when the different math operations are performed in a slow-motion, real-time animation. I have the visuals set up along with the UI that allows you to tweak values and change the layout of the neurons, as well as the visualizations for the feed forward stage, but since I don’t actually

Finding the optimal combination of inputs which return maximal output for a black box model

筅森魡賤 提交于 2021-02-10 05:24:06
问题 One of the challenges that I have been facing when applying ANN to regression tasks on my job is that in order to find the optimal out for a given range of inputs, I have to feed a multidimensional meshgrid to my model and then simply pick the highest value. However, this is overall a very computationally costly solution. The lenght of the text bellow might be scary but it just my attempt to better explain it. Let me explain with other words. Supposing that I have 9 inputs for my ANN, and

Upsampling in Semantic Segmentation

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-09 11:14:29
问题 I am trying to implement a paper on Semantic Segmentation and I am confused about how to Upsample the prediction map produced by my segmentation network to match the input image size. For example, I am using a variant of Resnet101 as the segmentation network (as used by the paper). With this network structure, an input of size 321x321 (again used in the paper) produces a final prediction map of size 41x41xC (C is the number of classes). Because I have to make pixel-level predictions, I need

Upsampling in Semantic Segmentation

懵懂的女人 提交于 2021-02-09 11:13:47
问题 I am trying to implement a paper on Semantic Segmentation and I am confused about how to Upsample the prediction map produced by my segmentation network to match the input image size. For example, I am using a variant of Resnet101 as the segmentation network (as used by the paper). With this network structure, an input of size 321x321 (again used in the paper) produces a final prediction map of size 41x41xC (C is the number of classes). Because I have to make pixel-level predictions, I need

Use layer output in keras custom loss

≡放荡痞女 提交于 2021-02-09 02:48:52
问题 I am developing a custom loss function in Keras and I need the first layer output. How can I retrieve it? def custom_loss(y_true, y_pred): cross = K.mean(K.binary_crossentropy(y_true, y_pred), axis = 1) layer_output = model.get_layer_output(1) # this is what i'd like to use return cross + perturb 回答1: Checking the docs you can retrieve a layer by using the model.get_layer() method. You can then pass the desired index or well pass the name of the layer. After getting a layer you can easily