neural-network

How to add dropout layers automatically to a neural network in pytorch

How to add dropout layers automatically to a neural network in pytorch Question: I have a neural network in pytorch and make each layer automatically via the following structure: class FCN(nn.Module): ##Neural Network def __init__(self,layers): super().__init__() #call __init__ from parent class self.activation = nn.Tanh() self.loss_function = nn.MSELoss(reduction =’mean’) ‘Initialise neural network as a list using …

Total answers: 2

Exchange a pooling layer using conv2d layer in keras

Exchange a pooling layer using conv2d layer in keras Question: I have a neural network in keras with two conv2d layers, an average pooling layer and a dense output layer. I want to put the trained model on an FPGA later on and the architecture does not support MaxPooling or AveragePooling layers. However, I read …

Total answers: 1

OCR PDF image to Excel by template

OCR PDF image to Excel by template Question: I need to convert a lot PDF tables data scans with bad quality to excel tables. The only way I see the solution is to train tesseract or some other framework on pre-generated images(all tables in PDF are the same in most cases). Is it real to …

Total answers: 3

mat1 and mat2 shapes cannot be multiplied (1×7 and 1×1)

mat1 and mat2 shapes cannot be multiplied (1×7 and 1×1) Question: I am using a linear regression model in PyTorch to predict number of cars sold from car price using fake data: car_price_tensor tensor([3., 4., 5., 6., 7., 8., 9.]) number_of_car_sell_tensor tensor([[7.5000], [7.0000], [6.5000], [6.0000], [5.5000], [5.0000], [4.5000]]) Here’s the network: import torch.nn as nn …

Total answers: 1

Neural network built from scratch in python to classify digits stuck at 11.35 percent accuracy. I am using the MNIST dataset

Neural network built from scratch in python to classify digits stuck at 11.35 percent accuracy. I am using the MNIST dataset Question: My neural network is stuck at 11.35 percent accuracy and i am unable to trace the error. low accuracy at 11.35 percent I am following this code https://github.com/MLForNerds/DL_Projects/blob/main/mnist_ann.ipynb which I found in a …

Total answers: 1

How to save and load a NeuralFit model or weights?

How to save and load a NeuralFit model or weights? Question: I have evolved a neural network to learn y=x^2 using the neuralfit library, but I would like to save the model to do predictions later. I currently have: import neuralfit import numpy as np # y(x) = x^2 x = np.arange(10).reshape(-1,1) y = x**2 …

Total answers: 1

How to disable status after each epoch in NeuralFit?

How to disable status after each epoch in NeuralFit? Question: I use the neuralfit package to evolve a neural network, but am not sure how I can avoid printing completely. I would simply like to plot the history after training. I currently have: import neuralfit import numpy as np x = np.asarray([[0],[1]]) y = np.asarray([[1],[0]]) …

Total answers: 1

Single loss function with multi-input multi-output model in Keras

Single loss function with multi-input multi-output model in Keras Question: I am trying to train a multi-input (3) multi-output (4) model using Keras and I need to use a SINGLE loss function that takes in all the output predictions. 2 of these outputs are my true model outputs that I care about and have corresponding …

Total answers: 1

for categorical class RuntimeError: 0D or 1D target tensor expected, multi-target not supported

For categorical class RuntimeError: 0D or 1D target tensor expected, multi-target not supported Question: I have 28 features and target variable is categorical (0-8) i.e. 9 target variable . Data sample: X_train.shape,y_train.shape output –((640, 28), (640, 1)) X_train[0] output –array([0.4546875 , 0.63958333, 0.46875 , 0.62916667, 0.4859375 , 0.62916667, 0.5015625 , 0.64166667, 0.4859375 , 0.65 , …

Total answers: 1