deep-learning

How to handle variable length data for LSTM

我怕爱的太早我们不能终老 提交于 2021-01-29 07:15:19
问题 From what I know the general steps to preprocess data for LSTM include the following steps vocab_size = 20000 # Only consider the top 20k words maxlen = 200 # Only consider the first 200 words of each movie review (x_train, y_train), (x_val, y_val) = keras.datasets.imdb.load_data(num_words=vocab_size) print(len(x_train), "Training sequences") print(len(x_val), "Validation sequences") x_train0 = keras.preprocessing.sequence.pad_sequences(x_train, maxlen=maxlen) x_val0 = keras.preprocessing

Why do we use log probability in deep learning?

陌路散爱 提交于 2021-01-29 06:51:36
问题 I got curious while reading the paper 'Sequence to Sequence Learning with Neural Networks'. In fact, not only this paper but also many other papers use log probabilities, is there a reason for that? Please check the attached photo. 回答1: For any given problem we need to optimise the likelihood of parameters. But optimising the product require all data at once and requires huge computation. We know that a sum is a lot easier to optimise as the derivative of a sum is the sum of derivatives. So,

How To Get The Pixel Count Of A Segmented Area in an Image I used Vgg16 for Segmentation

人盡茶涼 提交于 2021-01-29 06:44:59
问题 I am new to deep learning but have succeeded in semantic segmentation of the image I am trying to get the pixel count of each class in the label. As an example in the image I want to get the pixel count of the carpet, or the chandelier or the light stand. How do I go about? Thanks any suggestions will help. 回答1: Edit: In what format the regions are returned? Do you have only the final image or the regions are given as contours? If you have them as contours (list of coordinates), you can apply

Having trouble with CNN prediction

此生再无相见时 提交于 2021-01-29 06:25:12
问题 I am using Convolutional Neural Networking for vehicle identification, my first time. Currently, I am working with just 2 classes(bike and car). Training set: 420 car images and 825 bike images. Test set: 44 car images and 110 bike images Car and Bike images are in different format(bmp,jpg). In single prediction, I am always getting 'bike'. I have tried using the Sigmoid function in the output layer. Then I get only 'car'. My code is like following: `` from keras.models import Sequential from

How to compensate if I cant do a large batch size in neural network

大城市里の小女人 提交于 2021-01-29 05:34:44
问题 I am trying to run an action recognition code from GitHub. The original code used a batch size of 128 with 4 GPUS. I only have two gpus so I cannot match their bacth size number. Is there anyway I can compensate this difference in batch. I saw somewhere that iter_size might compensate according to a formula effective_batchsize= batch_size*iter_size*n_gpu . what is iter_size in this formula? I am using PYthorch not Caffe. 回答1: In pytorch, when you perform the backward step (calling loss

How to fix ''ValueError: Input 0 is incompatible with layer flatten: expected min_ndim=3, found ndim=2" error when loading model

风格不统一 提交于 2021-01-29 05:33:56
问题 I'm trying to save and load my keras model. It trains, evaluates, and saves fine (using .h5 to save model) but when I try to load the model I get the following error: ValueError: Input 0 is incompatible with layer flatten: expected min_ndim=3, found ndim=2. Am I loading the model incorrectly? Any help would be appreciated! This is the code block from where I'm saving the model. def ml(self): model = tf.keras.models.Sequential() model.add(tf.keras.layers.Flatten()) self.addLayer(model,145,6)

Why does my CNN not predict labels as expected?

▼魔方 西西 提交于 2021-01-29 05:21:05
问题 I am new to the concept of Similarity Learning. I am currently doing a face recognition model using Siamese Neural Network for the Labelled Faces in the Wild Dataset. Code for Siamese Network Model (Consider each code snippets to be a cell in Colab): from keras.applications.inception_v3 import InceptionV3 from keras.applications.mobilenet_v2 import MobileNetV2 from keras.models import Model from keras.layers import Input,Flatten def return_inception_model(): input_vector=Input((224,224,3))

ValueError: as_list() is not defined on an unknown TensorShape

纵然是瞬间 提交于 2021-01-29 05:20:20
问题 i work on thhe example based in this web and here is i got after this jobs_train, jobs_test = jobs_df.randomSplit([0.6, 0.4]) >>> zuckerberg_train, zuckerberg_test = zuckerberg_df.randomSplit([0.6, 0.4]) >>> train_df = jobs_train.unionAll(zuckerberg_train) >>> test_df = jobs_test.unionAll(zuckerberg_test) >>> from pyspark.ml.classification import LogisticRegression >>> from pyspark.ml import Pipeline >>> from sparkdl import DeepImageFeaturizer >>> featurizer = DeepImageFeaturizer(inputCol=

Which parameters of Mask-RCNN control mask recall?

£可爱£侵袭症+ 提交于 2021-01-29 05:02:25
问题 I'm interested in fine-tuning a Mask-RCNN model that I'm using for instance segmentation. Currently I have trained the model for 6 epochs and the various Mask-RCNN losses are as follows: The reason I'm stopping is that the COCO evaluation metrics seem to have dipped in the last epoch: I know this is a far reaching question, but I'm looking to gain some intuition of how to understand which parameters are going to be the most impactful in improving the evaluation metrics. I understand there are

Run tensorflow model in CPP

烂漫一生 提交于 2021-01-29 04:56:00
问题 I trained my model using tf.keras. I convert this model to '.pb' by, import os import tensorflow as tf from tensorflow.keras import backend as K K.set_learning_phase(0) from tensorflow.keras.models import load_model model = load_model('model_checkpoint.h5') model.save('model_tf2', save_format='tf') This creates a folder 'model_tf2' with 'assets', varaibles, and saved_model.pb I'm trying to load this model in cpp. Referring to many other posts (mainly, Using Tensorflow checkpoint to restore