deep-learning

How to programmatically generate deploy.txt for caffe in python

谁都会走 提交于 2020-01-28 09:37:04
问题 I have written python code to programmatically generate a convolutional neural network (CNN) for training and validation .prototxt files in caffe. Below is my function: def custom_net(lmdb, batch_size): # define your own net! n = caffe.NetSpec() # keep this data layer for all networks n.data, n.label = L.Data(batch_size=batch_size, backend=P.Data.LMDB, source=lmdb, ntop=2, transform_param=dict(scale=1. / 255)) n.conv1 = L.Convolution(n.data, kernel_size=6, num_output=48, weight_filler=dict

Why my acc always higher but my val_acc is very small?

耗尽温柔 提交于 2020-01-25 09:30:07
问题 I tried to train 14000 training datasets and 3500 validation datasets, but why every time I train I always get high accuracy results while the validation section is very small so what should I do if I want the results of the validation to be close to the accuracy of the training and provide significant additions to each epoch does there have to be something to add or subtract? [sorry for bad english] from keras.models import Sequential from keras.layers import Conv2D from keras.layers import

How to prepare training data for image segmentation

一个人想着一个人 提交于 2020-01-25 08:35:29
问题 I am using bounding box marking tools like BBox and YOLO marker for object localisation. I wanted to know is there any equivalent marking tools available for image segmentation tasks. How people in academia and research are preparing data sets for these image segmentation tasks. Recent Kaggle competition severstal-steel-defect-detection has pixel level segmentation information. Which tool they used to prepare this data? 回答1: Generally speaking it is a pretty complex but a common task, so you

Output of Graph Convolution in deepchem

那年仲夏 提交于 2020-01-25 08:14:27
问题 I am using Deepchem to create features for the my GraphConvolution model as follows. import deepchem as dc from rdkit import Chem import numpy as np import pandas as pd from rdkit.Chem import Draw from rdkit.Chem.Draw import IPythonConsole smile = 'O=C(C1=CC=C(C=C1)C(O)=O)O' molecules = [] molecules.append(Chem.MolFromSmiles(smile)) featurizer = dc.feat.graph_features.ConvMolFeaturizer() mol_object = featurizer.featurize(mols=molecules) Now I want to know the output mol_object . I know that

Softmax Cross Entropy loss explodes

天大地大妈咪最大 提交于 2020-01-25 07:34:10
问题 I am creating a deep convolutional neural network for pixel-wise classification. I am using adam optimizer, softmax with cross entropy. Github Repository I asked a similar question found here but the answer I was given did not result in me solving the problem. I also have a more detailed graph of what it going wrong. Whenever I use softmax, the problem in the graph occurs. I have done many things such as adjusting training and epsilon rates, trying different optimizers, etc. The loss never

When passing input data as arrays, do not specify `steps_per_epoch`/`steps` argument. Please use `batch_size` instead

丶灬走出姿态 提交于 2020-01-25 07:24:07
问题 My code is below : model.fit_generator(generator=(train_image_list, train_mask_list),epochs=1000,shuffle=True) Both the train_image_list and train_mask_list contains image lists.When trying to run the above code in Google Colab I get the following error: When passing input data as arrays, do not specify `steps_per_epoch`/`steps` argument. Please use `batch_size` instead. In the Keras documentation, fit_generator() do not specify a parameter called 'batch_size'. How to solve this issue? 回答1:

How is the self-attention mechanism in Transformers able to learn how the words are related to each other?

久未见 提交于 2020-01-25 07:05:51
问题 Given the sentence The animal didn't cross the street because it was too tired , how the self-attention is able to map with a higher score the word aninal intead of the word street ? I'm wondering if that might be a consequence of the word embedding vectors fed into the network, that some how already encapsulate some degree of distance among the words. 来源: https://stackoverflow.com/questions/58855564/how-is-the-self-attention-mechanism-in-transformers-able-to-learn-how-the-words

Using categorical_crossentropy for only two classes

纵饮孤独 提交于 2020-01-25 07:03:22
问题 Computer vision and deep learning literature usually say one should use binary_crossentropy for a binary (two-class) problem and categorical_crossentropy for more than two classes. Now I am wondering: is there any reason to not use the latter for a two-class problem as well? 回答1: categorical_crossentropy : accepts only one correct class per sample will take "only" the true neuron and make the crossentropy calculation with that neuron binary_crossentropy : accepts many correct classes per

BCEWithLogitsLoss in Keras

蓝咒 提交于 2020-01-25 00:25:12
问题 How to implement BCEWithLogitsLoss in keras and use it as custom loss function while using Tensorflow as backend. I have used BCEWithLogitsLoss in PyTorch which was defined in torch . How to implement the same in Keras.? 回答1: In TensorFlow, you can directly call tf.nn.sigmoid_cross_entropy_with_logits which works both in TensorFlow 1.x and 2.0. If you want to stick to Keras API, use tf.losses.BinaryCrossentropy and set from_logits=True in the constructor call. Unlike PyTorch, there are not

Error when checking model target: expected dense_39 to have 3 dimensions, but got array with shape (940, 1)

China☆狼群 提交于 2020-01-24 23:59:12
问题 I'm trying to train this Convolutional Neural Network but can't figure out what the issue is with my last layer. model = Sequential() model.add(Conv1D(50, kernel_size=(1), activation='relu', input_dim=50)) model.add(Dense(32)) model.add(Dense(1)) model.summary() model.compile(loss=keras.losses.mean_squared_error, optimizer=keras.optimizers.adam()) model.fit(X_train, y_train, batch_size=940, epochs=10, verbose=1, validation_data=(X_test, y_test)) Model: ________________________________________