# Tag Info

1

1

after creating the model you can create another model as below ( I created model till 8 layers) model = Model(vgg19.input, vgg19.layers[8].output) model.save('./style_transfer/st.h5') You can also use post-training Quantization techniques to reduce the size of the model to deploy in mobile/IoT devices. please check tensorflow documentation here

1

My doubt is whether the resize would now change the position of my object according to annotation? Yes, it will. should i annotate on the resized images(resize them myslef before training?) No, you should annotate at the original size. You solve this by applying the corresponding transformations on your bounding boxas well. So if you resize your ...

0

I have found the solution. In the model the data is normalized by being devided by 255. I had to do the same thing to the array of new data inside the prepare function. This is what the function looks like now and it works: def prepare(filepath): IMG_SIZE = 50 img_array = cv2.imread(filepath, cv2.IMREAD_GRAYSCALE) img_array = img_array/255.0 ...

0

Datacamp has an introductory course: https://www.datacamp.com/courses/introduction-to-tensorflow-in-python I have been using this site for several frameworks, and so far i have been very satisfied with the quality of the courses. It is very application-oriented, so they usually explain the maths of it in layman's terms. If you are self-taught, it should be ...

0

It is not possible to create the submodel as you define it because the LSTM1_decoder and LSTM2_decoder layers both depend on previous model layers (and hence ultimately on the initial input layer) through their initial states. From your code: xo = decoder_lstm(decoder_inputs, initial_state=encoder_states) decoder_outputs = decoder_lstm2(xo, initial_state=...

1

Your way seems to be correct. I would suggest one other way that you might want to try (maybe it won't make your life better, but still): Since you want your data points to basically live on a sphere, you could train the angles in spherical coordinates. Fix the radius to $\sqrt{n}$ and this way your network has to learn one dimension fewer. I'm not sure how ...

0

I think you reshaped train_image in wrong way. for example if you have input like A1 A2 A3 A4 A5 A6 A7 A8... then input sequence should be like (to train 4 image at a time) A1 A2 A3 A4 -> set 1 A2 A3 A4 A5 -> set 2 A3 A4 A5 A6 -> set 3 and so on where as your train image reshape is something like A1 A2 A3 A4 -> set 1 A5 A6 A7 A8 -> set 2

1

After a lot of research, I came to the conclusion that this is doable, but would require a lot of work. Essentially, the steps to achieve such a transformation are as follows: Use this version of the model exporter (or any other solution) to re-export the savedmodel with its variables (by default, the Model Zoo does not give the variables, only an ...

1

keras will differentiate automatically by looking at the graph of operations you use as part of your custom loss function. Since you are using only operations that keras "knows about" aka that exist as operations in TensorFlow keras will automatically a graph of operations to backpropagate against. If you however have a custom loss function that uses an ...

0

Instead of a generator, try using skimage or keras’s preprocess input to convert the images to arrays beforehand. The generator usually does this for you, but if you code it yourself it’s only a few lines and you can follow the tutorials you posted.

2

It seems like you are adding nodes to your computational graph in this line: layer = layer.assign(evolved_layer). The assign-operation is just as multiplication or addition a node in the graph and you construct a new one in every step. Call tf.Graph.finalize() after defining your model. This will raise an error whenever a node is added to the graph and help ...

0

I guess that too many periods make all sequences too many near. If you reduce the period to 1 the accuracy improves dramatically: import sys import os import numpy as np import math import pandas as pd from matplotlib import pyplot as plt from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection import train_test_split from sklearn....

0

I have two observations about your code: Your output is in the [-1, 1] range, therefore you should put tanh activation at the last layer. If you don't specify an activation you'll have a linear one; with tanh you force your output to be in the right range. You don't need two LSTM() layers with 30 cells each. You have specified way too many parameters for a ...

0

In Keras, you can save your model using model.save(). Then, you can either load a saved model to train it with new data, or you can continue training your model. My suggestion is, first shuffle your input images if they are following a specific pattern based on their labels. Then load a batch of let say 100 images, continue training your model and save() ...

1

You are using the function softmax_cross_entropy_with_logits which, according to Tensorflow's documentation, has the following specification for logits, logits: Per-label activations, typically a linear output. These activation energies are interpreted as unnormalized log probabilities. Hence, you should pass the activations before the non-linearity ...

0

Sigmoid functions might have saturation problems. The values that it receives are probably too far from zero, and the sigmoid is returning 'extreme' results (i.e.: 0 or 1). I suggest you to keep your signal zero centered by putting BatchNormalization() layers between each of your layers (certainly between Dense() ones, but also between conv layers if you ...

1

With BERT I am assuming you are using finally the embeddings for your task. Solution 1: Once you have embeddings, you can use them as features and with your other features and then build a new model for the task. Solution 2: Here you will play with the network. Now here left one is the normal BERT, in the right we have another MLP network to deal with ...

0

Check that the device is there first by examining the device names in the output from the following: from tensorflow.python.client import device_lib device_lib.list_local_devices() Once you've verified that 'XLA_GPU:0' is a device on your system use something like with tf.device('/device:XLA_GPU:0'): Obviously you can change the names.

0

Although building neural network models is admittedly still an art rather than a science, there are some (unwritten) rules, at least for initial approaches to a problem, such as yours here (I guess). One of them is that dense layers with 50,000 nodes are too large, and AFAIK I have never seen such large layers in practice; multiply this x3 (layers), and no ...

0

After further trial and error, it seems that commenting out the lines using the "metrics" object in Stylegan's training_loop.py script on lines 207, 264, and 267 have resolved the crashing issue.

1

The 80-20 split is just a heuristic. If you want to be precise about it, you can analyse it statistically. Say you have a 0-1 classifier, and you expect the accuracy to be around $\delta\in[0,1]$, then it's not too hard to show that you need $k=1/(\delta \epsilon^2)$ test samples to measure you accuracy up to a factor $1\pm\epsilon$. This means that if ...

1

Assuming you have tried alternatives like storing it in csr matrices in scipy, you can move away from padding to avoid memory issues by declaring your batch_size=1 and may be create batches using a groupby for equal length sequences. If you are using keras, then please check Masking.

0

If you are performing linear (logistic) regression your weights are simply your $\beta_i$. If none of them are $0$ that simply means all features are 'important' to some degree.

0

Most probably, this is because your model is way too simple - a single 50-node hidden layer for a 7-class problem does not sound adequate. Try adding more hidden layers (and not quite sure if you really need a Flatten layer just after the input), e.g.: model = tf.keras.models.Sequential([ tf.keras.layers.Dense(100, activation=tf.nn.relu), tf.keras....

4

The idea of splitting 80%-20% is to use as much data as possible for training while keeping enough (labeled) data in the test set in order to reliably evaluate the performance. It's fine to use a smaller test set if it's big enough, but if it's too small the evaluation might not reflect the real performance of the model. Your idea of using future test data ...

0

The reason may be because the fixed learning rate you chose does not fit well with the data. If you try the Backtracking version, where learning rates are adapted at every step, and where convergence can be proven rigidly for many functions, things can be better. You can look at the paper in my answer in this link: Does gradient descent always converge to ...

0

There could be a couple of possible reasons: One reason could be the Adam optimizer is a combination of several other optimization techniques (e.g., momentum and running average of gradient squares). The combination of those techniques works well on multi-label text classification. Another reason could be that multi-label text classification is a sparse ...

5

This tweet from François Chollet suggests to use tf.keras. We recommend you switch your Keras code to tf.keras. Both Theano and CNTK are out of development. Meanwhile, as Keras backends, they represent less than 4% of Keras usage. The other 96% of users (of which more than half are already on tf.keras) are better served with tf.keras. Keras ...

2

Create a custom CallBack: from tensorflow.keras.callbacks import Callback class NBatchLogger(Callback): "A Logger that log average performance per display steps." def __init__(self, display): self.step = 0 self.display = display self.metric_cache = {} def on_batch_end(self, batch, logs={}): self.step += 1 ...

0

See the model must be overfitting as the prediction code looks correct. Kindly check for other metrices than only using accuracy. Print the confidence matrix and see the results.

Top 50 recent answers are included