deep-learning

Python extract multiple objects from image opencv

大兔子大兔子 提交于 2020-05-15 02:34:19
问题 I am trying to extract object from an image using the color using OpenCV, I have tried by inverse thresholding and grayscale combined with cv2.findContours() but I am unable to use it recursively. Furthermore I can't figure out how to "cut out" the match from the original image and save it to a single file. EDIT ~ import cv2 import numpy as np # load the images empty = cv2.imread("empty.jpg") full = cv2.imread("test.jpg") # save color copy for visualization full_c = full.copy() # convert to

Hierarchical Attention Network - model.fit generates error 'ValueError: Input dimension mis-match'

ぐ巨炮叔叔 提交于 2020-05-14 21:28:13
问题 For background, I am referring to the Hierarchical Attention Network used for sentiment classification. For code : my full code is posted below, but it is just simple revision of the original code posted by the author on the link above. And I explain my changes below. For training data : here For word embeddings : this is the Glove embedding here Key config : Keras 2.0.9, Scikit-Learn 0.19.1, Theano 0.9.0 The original code posted in the link above takes a 3D shape input, i.e., (review,

How do I load a keras saved model with custom Optimizer

拥有回忆 提交于 2020-05-14 18:24:09
问题 I have compiled and trained a keras model with a custom optimizer. I saved the model but when I try to load the model, it throws an error stating ValueError: Unknown optimizer: MyOptimizer . I tried to pass MyOptimizer as a custom object something like : models.load_model('myModel.h5', custom_objects={'optimizer':MyOptimizer}) and it still throws an error. How do I load the model a keras model with custom Objects? 回答1: I ran into the same problem :) I made it work by loading the model with

how to add label to image data set for classification?

∥☆過路亽.° 提交于 2020-05-14 18:24:05
问题 I am using python 3.6 installed on mac os. I have text file that store name of image and the class number of every single image on. #label.txt: img0001.jpg 1 img0002.jpg 3 img0003.jpg 5 img0004.jpg 10 img0005.jpg 6 img0006.jpg 8 img0007.jpg 10 ..... I want to give them to my neural network in tensorflow as label of input data and give the image to network in same time like this xs = tf.placeholder(tf.float32,[None,#size of my photo]) ys = tf.placeholder(tf.float32,[None,#size of my label if

model.fit.generator for dual path cnn

旧巷老猫 提交于 2020-05-14 09:07:45
问题 I am trying to run parallel path CNN, which is concatenated with a dense layer. I have named the first path as model1 and second part as model2 and the concatenated model containing parallel pats as model. I have compiled the model and the model summary also is working. Now I have to train the model. For that I have given the input to the CNN model is given as model.fit.generator. I am using keras 2.1.6 version. base_model1 = model.fit_generator(["train_generator","train_generator"], steps

What is the default activation function of cudnnlstm in tensorflow

我的未来我决定 提交于 2020-05-14 07:42:06
问题 What's the default activation function of cudnnlstm in TensorFlow? How can I set an activation function such as relu ? Maybe it's just linear model? I read the document, but I did not find it. For example, the code is below: lstmcell=tf.contrib.cudnn_rnn.CudnnLSTM(1,encoder_size,direction="bidirectional") hq,_ =lstmcell(query) And I read the document of TensorFlow From this link. The function is below __init__( num_layers, num_units, input_mode=CUDNN_INPUT_LINEAR_MODE, direction=CUDNN_RNN

What is the default activation function of cudnnlstm in tensorflow

给你一囗甜甜゛ 提交于 2020-05-14 07:39:25
问题 What's the default activation function of cudnnlstm in TensorFlow? How can I set an activation function such as relu ? Maybe it's just linear model? I read the document, but I did not find it. For example, the code is below: lstmcell=tf.contrib.cudnn_rnn.CudnnLSTM(1,encoder_size,direction="bidirectional") hq,_ =lstmcell(query) And I read the document of TensorFlow From this link. The function is below __init__( num_layers, num_units, input_mode=CUDNN_INPUT_LINEAR_MODE, direction=CUDNN_RNN

Not found: Op type not registered 'CountExtremelyRandomStats'

China☆狼群 提交于 2020-05-13 17:47:49
问题 I am getting the following error while running bazel command in the docker container. command ran : - bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server --port=9000 --model_name=rf_quora --model_base_path=/serving/rf_model &> rf_log & error: Not found: Op type not registered 'CountExtremelyRandomStats' in binary running on 864822af1c6c. Make sure the Op and Kernel are registered in the binary running in this process. I tried my search with the following link but in vain. https

Normalization of input data in Keras

别来无恙 提交于 2020-05-13 05:36:08
问题 One common task in DL is that you normalize input samples to zero mean and unit variance. One can "manually" perform the normalization using code like this: mean = np.mean(X, axis = 0) std = np.std(X, axis = 0) X = [(x - mean)/std for x in X] However, then one must keep the mean and std values around, to normalize the testing data, in addition to the Keras model being trained. Since the mean and std are learnable parameters, perhaps Keras can learn them? Something like this: m = Sequential()

ssh AWS, Jupyter Notebook not showing up on web browser

一曲冷凌霜 提交于 2020-05-13 05:35:11
问题 I am trying to use ssh connecting to AWS "Deep Learning AMI for Amazon Linux", and everything works fine except Jupyter Notebook. This is what I got: ssh -i ~/.ssh/id_rsa ec2-user@yy.yyy.yyy.yy gave me Last login: Wed Oct 4 18:01:23 2017 from 67-207-109-187.static.wiline.com ============================================================================= __| __|_ ) _| ( / Deep Learning AMI for Amazon Linux ___|\___|___| The README file for the AMI ➜➜➜➜➜➜➜➜➜➜➜➜➜➜➜➜➜➜➜➜ /home/ec2-user/src/README