keras

ValueError : Input 0 of layer lstm is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: [None, 18]

萝らか妹 提交于 2020-12-15 06:07:29
问题 I'm new with Keras and I'm trying to build a model for personal use/future learning. I've just started with python and I came up with this code (with help of videos and tutorials). I have a data of 16324 instances, each instance consists of 18 features and 1 dependent variable. import pandas as pd import os import time import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout, LSTM, BatchNormalization from tensorflow.keras

Keras model accuracy not improving

北城以北 提交于 2020-12-15 05:35:38
问题 I'm trying to train a neural network to predict the ratings for players in FIFA 18 by easports (ratings are between 64-99). I'm using their players database (https://easports.com/fifa/ultimate-team/api/fut/item?page=1) and I've processed the data into training_x, testing_x, training_y, testing_y. Each of the training samples is a numpy array containing 7 values...the first 6 are the different stats of the player (shooting, passing, dribbling, etc) and the last value is the position of the

ModuleNotFoundError: No module named 'six.moves.collections_abc'

ⅰ亾dé卋堺 提交于 2020-12-15 05:34:23
问题 i am just starting with machine learning i am following this tutorial from Weights&Bias where they gave us some code and asked to run it i am unable to run the code First I was getting the error Keras requires TensorFlow 2.2 or higher for which I tried this method Following the advice given here, downgrading Keras did the trick for me without having to touch any other packages. Just do: pip install keras==2.3.0 from this link Error "Keras requires TensorFlow 2.2 or higher" then I started

What does the implementation of keras.losses.sparse_categorical_crossentropy look like?

蓝咒 提交于 2020-12-15 05:05:12
问题 I found tf.keras.losses.sparse_categorical_crossentropy is an amazing class that helps me create a loss function for a neural network that has a large number of output classes. Without this it is impossible to train the model, as I found tf.keras.losses.categorical_crossentropy gave an out-of-memory error because of converting an index into a 1-hot vector of very large size. I, however, have a problem of understanding how sparse_categorical_crossentropy avoids the big memory issue. I took a

What does the implementation of keras.losses.sparse_categorical_crossentropy look like?

本秂侑毒 提交于 2020-12-15 05:04:05
问题 I found tf.keras.losses.sparse_categorical_crossentropy is an amazing class that helps me create a loss function for a neural network that has a large number of output classes. Without this it is impossible to train the model, as I found tf.keras.losses.categorical_crossentropy gave an out-of-memory error because of converting an index into a 1-hot vector of very large size. I, however, have a problem of understanding how sparse_categorical_crossentropy avoids the big memory issue. I took a

How to make sure that TFLite Interpreter is only using int8 operations?

╄→尐↘猪︶ㄣ 提交于 2020-12-13 18:53:26
问题 I've been studying quantization using Tensorflow's TFLite. As far as I understand it is possible to quantize my model weights (so that they will be stored using 4x less memory) but it doesn't necessary implies that the model won't convert it back to floats to run it. I've also understood that to run my model only using int I need to set the following parameters: converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8] converter.inference_input_type = tf.uint8 converter

Gradients do not exist for variables?

久未见 提交于 2020-12-13 12:15:01
问题 How can I fix error shown below? The input and output shape is supposed to be consist of 1 or -1. Here is my code: #Data Input main_input=Input(shape=(2*N_c),name='main_input') encoding_x=Dense(2*N_c,activation='relu',name='input_layer')(main_input) #Channel Input # channel_input=Input(shape=(4,),dtype='complex64',name='channel_input') channel_input = Lambda(set_channel2)(encoding_x) padded_channel = Lambda(z_padding,name='ppading_layerddddd')(channel_input) ffted_channel = Lambda(ffting,name

Gradients do not exist for variables?

ぐ巨炮叔叔 提交于 2020-12-13 12:07:18
问题 How can I fix error shown below? The input and output shape is supposed to be consist of 1 or -1. Here is my code: #Data Input main_input=Input(shape=(2*N_c),name='main_input') encoding_x=Dense(2*N_c,activation='relu',name='input_layer')(main_input) #Channel Input # channel_input=Input(shape=(4,),dtype='complex64',name='channel_input') channel_input = Lambda(set_channel2)(encoding_x) padded_channel = Lambda(z_padding,name='ppading_layerddddd')(channel_input) ffted_channel = Lambda(ffting,name

MLModel works with MultiArray output but cannot successfully change the output to an image

旧城冷巷雨未停 提交于 2020-12-13 11:16:52
问题 I have converted a Keras model to a MLModel using coremltools 4.0 with limited success. It works but only if I use an MLMultiArray for the output and covert to an image. Converting to an image takes magnitudes longer than inferencing; making it unusable. If I try to change the MLModel spec to use images for output I get this error running prediction: Failed to convert output Identity to image: NSUnderlyingError=0x2809bad00 {Error Domain=com.apple.CoreML Code=0 "Invalid array shape ( 2048,

MLModel works with MultiArray output but cannot successfully change the output to an image

▼魔方 西西 提交于 2020-12-13 11:16:24
问题 I have converted a Keras model to a MLModel using coremltools 4.0 with limited success. It works but only if I use an MLMultiArray for the output and covert to an image. Converting to an image takes magnitudes longer than inferencing; making it unusable. If I try to change the MLModel spec to use images for output I get this error running prediction: Failed to convert output Identity to image: NSUnderlyingError=0x2809bad00 {Error Domain=com.apple.CoreML Code=0 "Invalid array shape ( 2048,