What is the purpose of copying an object in object oriented programming?

I've been learning c# for about 3 months now and one thing I have come across today is the concept of deep and shallow copy constructors on objects (having just gotten used to the concepts of base...

Full-matrix approach to backpropagation in Artificial Neural Network

I am learning Artificial Neural Network (ANN) recently and have got a code working and running in Python for the same based on mini-batch training. I followed the book of Michael Nilson's Neural...

How to interpret increase in both loss and accuracy

I have run deep learning models(CNN's) using tensorflow. Many times during the epoch, i have observed that both loss and accuracy have increased, or both have decreased. My understanding was that...

Tensorflow: loss decreasing, but accuracy stable

My team is training a CNN in Tensorflow for binary classification of damaged/acceptable parts. We created our code by modifying the cifar10 example code. In my prior experience with Neural...

Removing then Inserting a New Middle Layer in a Keras Model

Given a predefined Keras model, I am trying to first load in pre-trained weights, then remove one to three of the models internal (non-last few) layers, and then replace it with another layer. I...

reverse word embeddings in keras - python

I am trying to make a chatbot in keras. I am assigning every word in the vocabulary its own ID. One training sample looks like this: [0 0 0 0 0 0 32 328 2839 13 192 1 ] -> [23 3289 328 2318 12 0 0...

Why do we need to call zero_grad() in PyTorch?

The method zero_grad() needs to be called during training. But the documentation is not very helpful | zero_grad(self) | Sets gradients of all model parameters to zero. Why do we need to...

Python 3 - FileNotFoundError: [Errno 2] No such file or directory: '../data/mnist.pkl'

I'm trying to load the mnist data set for this neural networks and deep learning example (http://neuralnetworksanddeeplearning.com/chap1.html) but I keep getting this error. >>> import...

How to handle large JSON file in Pytorch?

I am working on a time series problem. Different training time series data is stored in a large JSON file with the size of 30GB. In tensorflow I know how to use TF records. Is there a similar way...

Merge the Bounding boxes near by into one

I am new in python and I am using Quickstart: Extract printed text (OCR) using the REST API and Python in Computer Vision for text detection in Sales Fliers.So this algorithm is given has a...

Can't import bert.tokenization

I am using Google Colab and the following import doesn't work somehow: from bert.tokenization import FullTokenizer I am getting this error: ModuleNotFoundError: No module named...

PyTorch - Getting the 'TypeError: pic should be PIL Image or ndarray. Got <class 'numpy.ndarray'>' error

I am getting the error TypeError: pic should be PIL Image or ndarray. Got <class 'numpy.ndarray'> when I try to load a non-image dataset through the DataLoader. The versions of torch and...

Images not standardizing in Keras

I am following a 2017 tutorial on deep learning in Python, and I am trying to standardize some images from the well-known MNIST dataset. The author has the following to say about the piece of code...

How to save the region of interest of a frame using openCV?

I am creating a Deep Learning program that is capable to identifying a hand digit gesture. I have completed training the model and now I need to use it on a live video. So I am trying to create...

How to clear GPU memory after PyTorch model training without restarting kernel

I am training PyTorch deep learning models on a Jupyter-Lab notebook, using CUDA on a Tesla K80 GPU to train. While doing training iterations, the 12 GB of GPU memory are used. I finish training...

RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same

I am trying to train the following CNN as follows, but I keep getting the same error regarding .cuda() and I am not sure how to fix it. Here is a chunk of my code so far. import matplotlib.pyplot...

Create synthetic LiDAR point clouds

I'd like to create synthetic training data for DL models for segmentation and classification in point clouds. The ground truth / real data comprise LiDAR point clouds. I scripted a simple mesh...

AttributeError: module 'tensorflow' has no attribute 'value'

I am training pytorch-yolov3 in custom dataset. I prepared all the required txt, data and names files . while runninng following command: python3 train.py --model_def config/yolov3.cfg...

Can someone explain the relationship between batch size and steps per epoch?

I have a training set containing 272 images. batch size = 8, steps per epoch = 1 > train the model for just 8 images and jumps to next epoch? batch size = 8, steps per epoch = 34 (no shuffle) >...

Tensorflow: None of the MLIR optimization passes are enabled (registered 1)

I am using a very small model for testing purposes using tensorflow 2.3 and keras. Looking at my terminal, I get the following warning: I...

Get the output of just bottleneck layer from autoencoder

I'm new to Autoencoder. I have built a simple convolution autoencoder as shown below: # ENCODER input_img = Input(shape=(64, 64, 1)) encode1 = Conv2D(32, (3, 3), activation=tf.nn.leaky_relu,...

values in torch.nn.conv2d and torch.nn.Linear

I am confiused how to get the out_channels in torch.nn.Conv2d and the in_features, out_features in torch.nn.Linear. For example I have a non-color 28*28 image input. the in_channels =...

ValueError: Shape must be rank 3 but is rank 2. A `Concatenate` layer requires inputs with matching shapes except for the concat

I am trying to use Tensorflow Functional API to define a multi input neural network. This is my code: from keras_self_attention import SeqSelfAttention from tensorflow import keras Input1 =...

Runtime error while trying dynamic quantization on transformer model

I am trying to do dynamic quantization(quantizes the weights and the activations) on a pytorch pre-trained model from huggingface library. I have referred this link and found dynamic quantization...

How to merge two torch.utils.data dataloaders with a single operation

I have two dataloaders and I would like to merge them without redefining the datasets, in my case train_dataset and val_dataset. train_loader = DataLoader(train_dataset, batch_size = 512,...

How to use ELMO Embeddings as the First Embedding Layer in tf 2.0 Keras using tf-hub?

I am trying to build a NER model in Keras using ELMO Embeddings. SO I stumped across this tutorial and started implementing. I got lots of errors and some of them are as: import tensorflow as...

ValueError <ipython-input-65-8da781e9d890>

I faced a problem when I run deep learning with kerase lib. at the second line below code. X_train, X_test, y_train, y_test = train_test_split(X,y, test_size = 0.15, random_state =...

Evaluation using iou_threshold 0.5 is 0.000000

I'm working using the PixelLib to create a custom training. These are my training steps: train_maskrcnn = instance_custom_training() train_maskrcnn.modelConfig(network_backbone = "resnet101",...

Unexpected input data type. Actual: (tensor(double)) , expected: (tensor(float))

I am learning this new ONNX framework that allows us to deploy the deep learning (and others) model into production. However, there is one thing I am missing. I thought that the main reason for...

AttributeError: 'Sequential' object has no attribute 'predict_proba'

predict_proba returns the error in the neural network i saw the example on this link...