conv-neural-network

Tensorflow: How can I extract image features from a specific layer of a pre-trained CNN?

假装没事ソ 提交于 2019-12-05 03:42:19
问题 I have a pre-trained CNN model as a .pb file. I can load the model and extract the final vector from the last layer for all images. Now I would like to extract the vector coming from a specific layer and not the final for my images. I am using an import_graph_def function to load the model and I don't know the names of the layers because .pb file is large and I can't open it. How can I run one part of the model and not the whole in order to get vectors until the layer I want? 回答1: One

tensorflow - understanding tensor shapes for convolution

牧云@^-^@ 提交于 2019-12-05 02:24:33
问题 Currently trying to work my way through the Tensorflow MNIST tutorial for convolutional networks and I could use some help with understanding the dimensions of the darn tensors. So we have images of 28x28 pixels in size. The convolution will compute 32 features for each 5x5 patch. Let's just accept this, for now, and ask ourselves later why 32 features and why 5x5 patches. Its weight tensor will have a shape of [5, 5, 1, 32] . The first two dimensions are the patch size, the next is the

Cross entropy loss suddenly increases to infinity

微笑、不失礼 提交于 2019-12-05 01:06:57
问题 I am attempting to replicate an deep convolution neural network from a research paper. I have implemented the architecture, but after 10 epochs, my cross entropy loss suddenly increases to infinity. This can be seen in the chart below. You can ignore what happens to the accuracy after the problem occurs. Here is the github repository with a picture of the architecture After doing some research I think using an AdamOptimizer or relu might be a problem. x = tf.placeholder(tf.float32, shape=

How to iterate over two dataloaders simultaneously using pytorch?

我是研究僧i 提交于 2019-12-05 00:33:03
问题 I am trying to implement a Siamese network that takes in two images. I load these images and create two separate dataloaders. In my loop I want to go through both dataloaders simultaneously so that I can train the network on both images. for i, data in enumerate(zip(dataloaders1, dataloaders2)): # get the inputs inputs1 = data[0][0].cuda(async=True); labels1 = data[0][1].cuda(async=True); inputs2 = data[1][0].cuda(async=True); labels2 = data[1][1].cuda(async=True); labels1 = labels1.view

How do you change the dimension of your input pictures in pytorch?

元气小坏坏 提交于 2019-12-04 21:34:35
i made a convolutional nuralnetwork and i want it to take input pictures and output pictures but when i turn the pictures into tensors they have the wrong dimension : RuntimeError: Expected 4-dimensional input for 4-dimensional weight [20, 3, 5, 5], but got 3-dimensional input of size [900, 1440, 3] instead how do i change the dimension of the pictures ? and why does it need to be changed? and how do i make the output an picture? i tryed to use transform = transforms.Compose( [transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))]) to normilize the img but it didnt

TensorFlow tfrecords: tostring() changes dimension of image

廉价感情. 提交于 2019-12-04 21:25:37
I have built a model to train a convolutional autoencoder in TensorFlow. I followed the instructions on Reading Data from the TF documentation to read in my own images of size 233 x 233 x 3. Here is my convert_to() function adapted from those instructions: def convert_to(images, name): """Converts a dataset to tfrecords.""" num_examples = images.shape[0] rows = images.shape[1] cols = images.shape[2] depth = images.shape[3] filename = os.path.join(FLAGS.tmp_dir, name + '.tfrecords') print('Writing', filename) writer = tf.python_io.TFRecordWriter(filename) for index in range(num_examples): print

How to predict multiple images in Keras at a time using multiple-processing (e.g. with different CPUs)?

非 Y 不嫁゛ 提交于 2019-12-04 19:20:17
I have a lot of PNG images that I want to classify, using a trained CNN model. To speed up the process, I would like to use multiple-processing with CPUs (I have 72 available, here I'm just using 4). I don't have a GPU available at the moment, but if necessary, I could get one. My workflow: read a figure with openCV adapt shape and format use mymodel.predict(img) to get the probability for each class When it comes to the prediction step, it never finishes the mymodel.predict(img) step. When I use the code without the multiprocessing module, it works fine. For the model, I'm using keras with a

Counting the number of vehicles from an image with machine learning

不问归期 提交于 2019-12-04 16:25:35
I am new to machine learning. I got a task to find the total number of vehicles from an image using machine learning concept. I am using neural network. My image of worst case is given here. Traffic Image I need to find the total number of cars from this image. My idea is to cut this big image into small patches of image and train the network to count the vehicles from the small patches. Each patch will be having count less than 5. Then in the processing of new image, I could make use of a sliding window to get the total count of vehicles. I just want to know whether this idea is possible or

Realtime Data augmentation in Lasagne

房东的猫 提交于 2019-12-04 16:13:39
I need to do realtime augmentation on my dataset for input to CNN, but i am having a really tough time finding suitable libraries for it. I have tried caffe but the DataTransform doesn't support many realtime augmentations like rotating etc. So for ease of implementation i settled with Lasagne . But it seems that it also doesn't support realtime augmentation. I have seen some posts related to Facial Keypoints detection where he's using Batchiterator of nolearn.lasagne . But i am not sure whether its realtime or not. There's no proper tutorial for it. So finally how should i do realtime

Keras getting output of intermidate layers

*爱你&永不变心* 提交于 2019-12-04 15:32:04
## what my model looks like # defining the model archictecture model = Sequential() # 1st conv layer model.add(Conv2D(32, (5, 5), activation='relu', input_shape=x_ip_shape)) # 1st max pool model.add(MaxPooling2D(pool_size=(2, 2))) # 2nd conv layer model.add(Conv2D(64, (7, 7), activation='relu')) # 2nd max pool model.add(MaxPooling2D(pool_size=(2, 2))) # Flattenning the input model.add(Flatten()) # 1st Fully connected layer model.add(Dense(10, activation='relu')) # Adding droput model.add(Dropout(0.25)) # softmax layer model.add(Dense(classes_out, activation='softmax')) # defining loss,