# Tag Info

5

It's a very specific problem and there's no right or wrong solution. I'll just write what I'd do in your position and hope that it is useful. How many "before and after" images will I need? You'll need a lot of images to consistently get good results, in the range of tens or preferably hundreds of thousands. What architecture should I use? i.e. ...

3

Keras supports lazy execution. The create_model and model.compile code are not executed until it is absolutely required which is right before the first training epoch. That increased time for the first epoch includes building the TensorFlow computational graph based on the plan in your create_model function. All remaining epochs re-use the same computational ...

2

It seems that you actually mean "neural structured learning". From the Tensorflow webpage on their neural structured learning framework, it seems it is just an umbrella term to two types of regularizations: Neural Graph Learning and Adversarial Learning. Basically you add an extra term to your training loss where you force the internal representations for ...

2

I'm using this model (basically building on work of Chollet). It uses a pretrained model (VGG16) for a multiclass image recognition problem. from keras.applications import VGG16 import os, datetime import numpy as np from keras.preprocessing.image import ImageDataGenerator from keras.utils import to_categorical from keras import models, layers, optimizers, ...

2

Your model is not sufficiently complex to adequately classify the CIFAR 10 data set. CIFAR-10 is considerably more complex than the Fashion-MNIST data set and therefore you need a more complex model.You can add more hidden layers to your model to achieve this. You should also add DROPOUT layers to prevent over fitting. Perhaps the easiest solution is to use ...

2

Is it common practice when working with text? No, you could split dataset as you wish, in general in real-world problem you should use cross validation. Does it have anything to do with using a "pre-trained" TensorFlow Hub layer? No, it doesn't.

1

You start with a VGG net that is pre-trained on ImageNet - this likely means the weights are not going to change a lot (without further modifications or drastically increasing the learning rate, for example). If you are expecting the performance to increase on a pre-trained network, you are performing fine-tuning. There is a section on fine-tuning the Keras ...

1

It is hard to know what is happening from just that screenshot and no code. The training and validation plots are usually separated on the page, not lines on the same graph. If you are using Tensorflow 2.0, there is a known issue, regarding the syncing of TB and the tfevent file (where logs are stored). A couple of things to try: Try adding the ...

1

Q1: I do not really understand how the situation in your Q1 is possible - I would expect an error to be thrown about as a mismatch in shape. For example, when I change the number of classes in the final dense layer, I do indeed get an error. model = Sequential() model.add(Conv2D(32, kernel_size=(3, 3), activation='relu', ...

1

Since you just achieve a training accuracy of 45%, I assume that your model is too simple. What you can do: 1) Use more hidden layers: more hidden layers increase the number of parameters and complexity of your model. However, since you are using dense, fully-connected layers you might see that your model gets big and slow pretty quickly. Therefore, I would ...

1

I think your model is not complex enough to learn from the CIFAR-10 datasets. You can find CIFAR-10 classification datasets results using different models and activation functions here. Looking from the results, I can see that you will need to use a dense CNN model with Exponential Linear units (ELU) to get better accuracy.

1

Two things come to mind: You can add a data generator. This will generate new images from your current images by introducing a bunch of small changes (i.e. randomly rotating, zooming, shearing, shifting horizontally/vertically...), forcing the model to learn important distinguishing features between the different classes of images. You can also add dropout ...

1

A safer method is to use the integer part of the fraction (after truncating) $n_c \approx n^{3 \over 4}$ examples for training, and $n_v \equiv n - n_c$ for validation (a.k.a. testing). Then, perform that whole train-test split at least $n$ times, preferably $2n$ if you can afford it, recording your validation loss for each validation example (or the ...

1

I dont think you are rescaling the image after reading it. Because you have rescaled it during training. img = image.load_img(path_to_file, target_size=(150,150)) img = image.img_to_array(img) img = img/255 # this must be done.

1

To answer: 1) When calculating the loss function for multivariate outputs, keras calculates it as a mean across all your outputs: https://github.com/keras-team/keras/blob/2.0.4/keras/losses.py#L12 Hence, if one output is doing really badly and others not, it could influence your loss result. 2) In the source code there are no mentioning about scaling the ...

1

This answer might not make a lot of sense without a little background on quantum computing A QCNN (https://arxiv.org/abs/1810.03787) is a type of quantum model that the authors in this paper use to model quantum data. At the core it is just a quantum circuit acting on a set of qubits in order to model quantum data that is on those qubits. The authors use it ...

1

There can be multiple reasons for low accuracy : Your data is not balanced Your data is not related to your output Your model is very complex Wrong selection of hyperparameters Ideally you should do a feature correlation check in beginning. Instead, To rule out first 2 doubts, you can train a decision tree/Random forest. If you get decent accuracy then ...

1

Do I need to first convert the string column into some other data type? Yes, it's very important. Neural Networks don't take raw words and/or letters as inputs. Textual information must be processed numerically in order to be fed into the model. I thought about it, and came up with three things you could do: Use one-hot encoding, as it was suggested. I ...

1

You can use one-hot encoding to encode your domains as char arrays. Then your training samples should have dimension (samples, longest domain length, all chars used). Here is a code sample: import pandas as pd import numpy as np from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, LSTM # make some fake samples urls = ['...

1

There are multiple ways to do it. Here is one technique: Run OCR on your image and search for your desired text . in this case it is Total. Get the pixels of that word - run image_to_data method of ocr to get pixels. Now you can extract the ROI using those pixels via OpenCV.

1

The logits have the distribution according to the len of vocabulary and the model training. So, you can use np.argmax(logits) to get the prediction, but normally to the application of generating script is more interesting to take into account a factor of aleatory which in this case is the function "random_categorical" which is used to get the value according ...

1

Although there are valid points in the accepted answer, I believe it is incorrect in this case. The timing differences mentioned were between the first epoch of training and the remaining epochs. The model and so the computational graph is compiled only once, when you call model.compile(), which is not part of the training itself. The difference in timings ...

Only top voted, non community-wiki answers of a minimum length are eligible