Giter Club home page Giter Club logo

detection-2016-nipsws's People

Contributors

miriambellver avatar skrish13 avatar xavigiro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

detection-2016-nipsws's Issues

TypeError: __init__() got an unexpected keyword argument 'file'

Hi, @xavigiro @jorditorresBCN @miriambellver @skrish13 @verovilaplana

I've met this error:

kerb:scripts mun$
kerb:scripts mun$ python3 image_zooms_training.py -n 0
Using TensorFlow backend.
Traceback (most recent call last):
File "image_zooms_training.py", line 6, in
from keras.models import Sequential
File "/usr/local/lib/python3.6/site-packages/keras/init.py", line 2, in
from . import backend
File "/usr/local/lib/python3.6/site-packages/keras/backend/init.py", line 64, in
from .tensorflow_backend import *
File "/usr/local/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 1, in
import tensorflow as tf
File "/usr/local/lib/python3.6/site-packages/tensorflow/init.py", line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/init.py", line 52, in
from tensorflow.core.framework.graph_pb2 import *
File "/usr/local/lib/python3.6/site-packages/tensorflow/core/framework/graph_pb2.py", line 16, in
from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2
File "/usr/local/lib/python3.6/site-packages/tensorflow/core/framework/node_def_pb2.py", line 16, in
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File "/usr/local/lib/python3.6/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File "/usr/local/lib/python3.6/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in
from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
File "/usr/local/lib/python3.6/site-packages/tensorflow/core/framework/resource_handle_pb2.py", line 41, in
options=None, file=DESCRIPTOR),
TypeError: init() got an unexpected keyword argument 'file'
kerb:scripts mun$

What's wrong to me?

Thanks in advance.

from @bemoregt.

Precision_recall Curve questions

Hi
#13 I saw Anida's problem. I have a same problem. And i can not get the precision recall curve from your paper.

I want to know what will u put the precision value and recall value if there are no proposals exceed the threshold you set? You set it to precision:1.0 recall: 0.0 or something else? I tried many methods. I evaulated it by getting each image's p_r value and let the average mean of them to the final p_r of this threshold. I also tried to caculate all the TP and FP and FN numbers of the whole testing images and used the formula to get the final p_r of this threshold. But also didn't get the result. This trapped me a lot.

You said 'I analyzed if any of them had more than 0.5 intersection over union with any object of the ground truth, and that is a TP'. but I think that means one gt can have more than one TP.

And I want to know if your models given on github can be used directly to test and get the precision recall curve. Should i still need to train for getting the result of your paper.

You said this model is different from ones from your paper. One is for 1 object. One is for multiple objects. So did you have precision recall curve graph of this model ?

Or if it is possible. Could you please upload the metric codes. That will be of great help.

Thanks a lot.

platform

Can I run this code in Google Colaboratory?
I did but there comes some error regarding VGG16.

Something about training

When I training the model, it will be saved in the models_image_zooms folder at each epoch. But when I need to test the model, It need a full model instead of some epoch of it. Could you give me some advise to solve this problem~~~

something about the order of the color channels

Hello, all.
I found that the code used the pretrained VGG16 model from https://gist.github.com/baraldilorenzo/07d7802847aaad0a35d3,and because of using opencv, the input was loaded in BGR order. But I found that in keras.preprocessing, the image was load in RGB order , https://github.com/fchollet/keras/blob/master/keras/preprocessing/image.py#L300
was there something wrong?
And my environment is Keras 1.2.1 ,Theano 0.8.2 , Tensorflow 0.12.1 , using Tensorflow backend.

Thanks!

Something about training time

Hi all.
I train the pool45_crops_training.py, but it almost 4 days to get the mature model. I figure out, when the training stage, the GPU utilization is almost between 0 and 20%. So is there any wrong when i am training?
I environment is Keras 1.1 theano 0.8.2 CUDA7.5 CUDNN 5.0 python 2.7

TypeError: slice indices must be integers or None or have an __index__ method

Traceback (most recent call last):
File "image_zooms_training.py", line 116, in
gt_masks = generate_bounding_box_from_annotation(annotation, image.shape)
File "/mnt/parse_xml_annotations.py", line 51, in generate_bounding_box_from_annotation
masks[annotation[i, 3]:annotation[i, 4], annotation[i, 1]:annotation[i, 2], i] = 1
TypeError: slice indices must be integers or None or have an index method

On precision_recall curve questions

I'm interested in your code, so I have a question to ask.
I used the image-zooms model and the pre-training model weights you provided. Now I get 6 q-val from the graph of the test results. I don't know how to use these 6 q-val to calculate the precision and recall curves next.

maximum memory consumed?

Hi Míriam, thanks for your code. I tried running your code on computer with tesla K40 GPU which is with 12G video ram but still encountered "cannot allocate memory" error as someone posted before. This is pretty surprising to me. Is the computation that heavy? I wonder if you have ever recorded the maximum ram running the training process needed?

something about precision-recall curve and loss

I came with problems about precision-recall function. I don't know how to caculate them and your code don't show that. Could you please give me the formulas?
And the second question is about loss, i only use voc2007 to train your code, but it didn't decrease so much. There's still big flunctuate, 0.3 round but sometimes more than 1.0, but i don't change anything..
Thank you

IOError: Unable to open file (File signature not found)

Dear miriambellver, thanks for your share.
I met a problem when ran your code:

Traceback (most recent call last):
File "image_zooms_testing.py", line 42, in
model = get_q_network(weights_path + model_name)
File "/auto/master05/liyi9487/project/detection-2016-nipsws/scripts/reinforcement.py", line 87, in get_q_network
model.load_weights(weights_path)
File "/home/master/05/liyi9487/.local/lib/python2.7/site-packages/keras/engine/topology.py", line 2486, in load_weights
f = h5py.File(filepath, mode='r')
File "/home/master/05/liyi9487/.local/lib/python2.7/site-packages/h5py/_hl/files.py", line 272, in init
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "/home/master/05/liyi9487/.local/lib/python2.7/site-packages/h5py/_hl/files.py", line 92, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/tmp/pip-build-v_zMzm/h5py/h5py/_objects.c:2847)
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/tmp/pip-build-v_zMzm/h5py/h5py/_objects.c:2805)
File "h5py/h5f.pyx", line 76, in h5py.h5f.open (/tmp/pip-build-v_zMzm/h5py/h5py/h5f.c:2093)
IOError: Unable to open file (File signature not found)

I use keras=1.0.8, Using Theano 0.8.2 backend.
Thank you very much

Using TensorFlow backend

Hello, @miriambellver , I met a problem, I installed theano and tensorflow, But when I run image_zooms_testing.py, It has a problem,"Using TensorFlow backend. and ValueError: Filter must not be larger than the input: Filter: (2, 2) Input: (1, 112)" Do you know what's the problem? thanks a lot

which keras backend are you using?

I am trying to run your code with theano backended keras. However, I run into the following error.

Using Theano backend.
Couldn't import dot_parser, loading of dot files will not be possible.
Using gpu device 0: Tesla K80 (CNMeM is disabled, cuDNN 4007)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
(Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0)
Traceback (most recent call last):
File "image_zooms_testing.py", line 41, in
model_vgg = obtain_compiled_vgg_16(path_vgg)
File "/data/scratch/gaop/deep_reinforcement/detection-2016-nipsws/scripts/features.py", line 203, in obtain_compiled_vgg_16
model = vgg_16(vgg_weights_path)
File "/data/scratch/gaop/deep_reinforcement/detection-2016-nipsws/scripts/features.py", line 247, in vgg_16
model.add(Flatten())
File "/home/gaop/env/local/lib/python2.7/site-packages/keras/models.py", line 312, in add
output_tensor = layer(self.outputs[0])
File "/home/gaop/env/local/lib/python2.7/site-packages/keras/engine/topology.py", line 514, in call
self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
File "/home/gaop/env/local/lib/python2.7/site-packages/keras/engine/topology.py", line 572, in add_inbound_node
Node.create_node(self, inbound_layers, node_indices, tensor_indices)
File "/home/gaop/env/local/lib/python2.7/site-packages/keras/engine/topology.py", line 152, in create_node
output_shapes = to_list(outbound_layer.get_output_shape_for(input_shapes[0]))
File "/home/gaop/env/local/lib/python2.7/site-packages/keras/layers/core.py", line 402, in get_output_shape_for
'(got ' + str(input_shape[1:]) + '. '
Exception: The shape of the input to "Flatten" is not fully defined (got (0, 7, 512). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.

ValueError: You are trying to load a weight file containing 0 layers into a model with 16 layers.

When I run the code, it stops at this line:

model_vgg = obtain_compiled_vgg_16(path_vgg)

The error message is the following:

Traceback (most recent call last):

  File "E:\EUMETSAT\UPC\scripts\image_zooms_training.py", line 76, in <module>
    model_vgg = obtain_compiled_vgg_16(path_vgg)

  File "E:\EUMETSAT\UPC\scripts\features.py", line 251, in obtain_compiled_vgg_16
    model = vgg_16(vgg_weights_path)

  File "E:\EUMETSAT\UPC\scripts\features.py", line 304, in vgg_16
    model.load_weights(weights_path)

  File "E:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\training.py", line 2211, in load_weights
    hdf5_format.load_weights_from_hdf5_group(f, self.layers)

  File "E:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\keras\saving\hdf5_format.py", line 686, in load_weights_from_hdf5_group
    ' layers.')

ValueError: You are trying to load a weight file containing 0 layers into a model with 16 layers.

Does anyone know how to fix this issue?

about weights of model_vgg

Thank you for your code. I have two questions.

  1. Is the vgg16_weights.h5, which downloaded from the link provided by you, pretrained on ImageNet?
  2. It seems that the model_vgg is trained at every epoch, but do not be saved. At test time, the weights of model_vgg is still the Initial weights(i.e. vgg16_weights.h5). Why not save it and use it at test time?

Precision recall curve problems

Hi,
I use the metric standard like you said but i still can not get the curve like you did.
I don't know what's wrong with it and maybe i misunderstood something.
Here is my metrics code
iou_list means each proposal generated from each action from one image, gt_masks is the same one in your code, and confidence is the qval of each action from one image. precision_recall_per_img is the list of p-r value of size 50.

`def precision_recall_curve_threhold(iou_list,gt_masks,confidence):
threhold_list = np.arange(0,5,0.1)
precision_recall_per_img = []
TP_FN = float(gt_masks.shape[2])
a = zip(confidence, range(len(confidence)))
a.sort(key=lambda x: x[0])
index = [x[1] for x in a[::-1]]

for i_th in range(len(threhold_list)):
    proposal_num = 0
    flag = [0] * int(TP_FN)
    cls = [-1] * len(index)
    # caculate proposal_num
    for i in index:
        if confidence[i] > threhold_list[i_th]:
            proposal_num += 1
        else:
            break
    # caculate per threhold
    # object
    if proposal_num!= 0:
        for i_ob in range(int(TP_FN)):
            max=0
            max_id = -1
            # proposal
            for j in index[:proposal_num]:
                if cls[j] != 1:
                    cls[j] = 0
                if iou_list[j][i_ob]> 0.5 and iou_list[j]>max:
                    max = iou_list[j][i_ob]
                    max_id = j
                if max_id != -1:
                    cls[max_id] = 1
                    flag[i_ob] = 1
        TP = float(cls.count(1))
        FP = float(cls.count(0))
        TP_r = float(flag.count(1))
        precision = TP / (TP + FP)
        recall = TP_r / TP_FN
        precision_recall_per_img.append((precision, recall))
    else:
        precision_recall_per_img.append((-1,-1))

return precision_recall_per_img`

When each time i get the whole test precision_recall value on the one test image. I sum the precision and recall of all test images on each threshold.

for i in range(50):
               if precision_recall_c_new[i][0]!=-1:
                   sum_p[i] += precision_recall_c_new[i][0]
                   sum_r[i] += precision_recall_c_new[i][1]
                   count[i] += 1

And then do mean like this:

 for i in range(50):
        if count[i]!=0:
            f1.write(str([float(sum_p[i])/count[i],float(sum_r[i])/count[i]]))
            f1.write('\n')

Am i wrong in calculating curve ?

Multi-class Training

I want to train and test the model for multiple classes categories.
How to train and test the model for all the class categories at the same time?

Keras version

Can you please point out which version of Keras is needed for this? The latest 1.1.2 gives the following error:

Exception: The shape of the input to "Flatten" is not fully defined (got (0, 7, 512). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.

Downgrading to 0.3.0 works but leads to another issue down the line in reinforcement.py:

Traceback (most recent call last):
  File "image_zooms_training.py", line 82, in <module>
    models = get_array_of_q_networks_for_pascal("0", class_object)
  File "/home/nauman/objdet/detection-2016-nipsws/scripts/reinforcement.py", line 95, in get_array_of_q_networks_for_pascal
    q_networks.append(get_q_network("0"))
  File "/home/nauman/objdet/detection-2016-nipsws/scripts/reinforcement.py", line 76, in get_q_network
    model.add(Dense(1024, init=lambda shape, name: normal(shape, scale=0.01, name=name), input_shape=(25112,)))
...
TypeError: <lambda>() takes exactly 2 arguments (1 given)

Pre-trained model always select top-left region

I used the pre-trained image-zooms model and tested on VOC2007 test. It runs properly, however, it seems that the agent just always take the same action ...

example:
000216

I used the default config in image_zooms_testing.py:

class_object = 1
# 1 if you want to obtain visualizations of the search for objects
bool_draw = 1
# Scale of subregion for the hierarchical regions (to deal with 2/4, 3/4)
scale_subregion = float(3)/4
scale_mask = float(1)/(scale_subregion*4)
# Number of steps that the agent does at each image
number_of_steps = 10
# Only search first object
only_first_object = 1

A wired problem I found when testing the VOC dataset 2007

def get_conv_image_descriptor_for_image(image, model):
    im = cv2.resize(image, (224, 224)).astype(np.float32)
    print('resized: {}'.format(im.shape))
    dim_ordering = K.image_dim_ordering()
    if dim_ordering == 'th':
        # 'RGB'->'BGR'
        im = im[::-1, :, :]
        # Zero-center by mean pixel
        im[0, :, :] -= 103.939
        im[1, :, :] -= 116.779
        im[2, :, :] -= 123.68
    else:
        # 'RGB'->'BGR'
        im = im[:, :, ::-1]
        # Zero-center by mean pixel
        im[:, :, 0] -= 103.939
        im[:, :, 1] -= 116.779
        im[:, :, 2] -= 123.68

    im = im.transpose((2, 0, 1))
    print('transposed: {}'.format(im.shape))
    im = np.expand_dims(im, axis=0)
    print('expanded: {}'.format(im.shape))
    inputs = [K.learning_phase()] + model.inputs
    _convout1_f = K.function(inputs, [model.layers[31].output])
    return _convout1_f([0] + [im])

def get_state(image, history_vector, model_vgg):
    print('--------b4: {}'.format(image.shape))
    descriptor_image = get_conv_image_descriptor_for_image(image, model_vgg)
    print('--------aft: {}'.format(np.array(descriptor_image).shape))
    descriptor_image = np.reshape(descriptor_image, (visual_descriptor_size, 1))
    history_vector = np.reshape(history_vector, (number_of_actions*actions_of_history, 1))
    state = np.vstack((descriptor_image, history_vector))
    return state

when deploying the function above, the output I got on screen were as follows:
--------b4: (272, 500, 3)
resized: (224, 224, 3)
transposed: (3, 224, 224)
expanded: (1, 3, 224, 224)
--------aft: (1, 1, 5376)

the final output from the 31th layers of VGG16 should be 25088 (size of length), but in my code the size is 5376. Therefore the inference cannot be continued because of this dismatch between two vectors, one should be 25088, but is 5376 instead.

Yes, pretrained CNN is used here,using pretrained cnn (vgg16 here) has 2 benefits:First,

Yes, pretrained CNN is used here,using pretrained cnn (vgg16 here) has 2 benefits:First,
learning the Q function is faster because we need to up-date the parameters of the Q-Network only, while using the deep CNN just as a feed-forward feature extractor. Second, the hierarchy of features is trained with a larger dataset,leveraging generic discriminative features in this method.

Originally posted by @mani5h in #19 (comment)

flatten error

Hi
I'm a beginner and running the this code
I installed keras 2.0.2, theano0.9.0 with (anaconda3)python3.5. and coding by pycharm on windows10.
but I'm getting an error after image_zooms_training.py run:

File "C:/Users/heram/PycharmProjects/Hirarchical obj detec/scripts/image_zooms_training.py", line 78, in
model_vgg = obtain_compiled_vgg_16(path_vgg)
File "C:\Users\heram\PycharmProjects\Hirarchical obj detec\scripts\features.py", line 251, in obtain_compiled_vgg_16
model = vgg_16(vgg_weights_path)
File "C:\Users\heram\PycharmProjects\Hirarchical obj detec\scripts\features.py", line 295, in vgg_16
model.add(Flatten())
File "C:\Users\heram\Anaconda3\envs\Hirarchical obj detec\lib\site-packages\keras\models.py", line 455, in add
output_tensor = layer(self.outputs[0])
File "C:\Users\heram\Anaconda3\envs\Hirarchical obj detec\lib\site-packages\keras\engine\topology.py", line 559, in call
output_shape = self.compute_output_shape(input_shape)
File "C:\Users\heram\Anaconda3\envs\Hirarchical obj detec\lib\site-packages\keras\layers\core.py", line 488, in compute_output_shape
'(got ' + str(input_shape[1:]) + '. '
ValueError: The shape of the input to "Flatten" is not fully defined (got (0, 7, 512). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.

What is its cause?

error in generate_bounding_box_from_annotation

File "/home/priya/Downloads/detection-2016-nipsws-master/scripts/parse_xml_annotations.py", line 56, in generate_bounding_box_from_annotation
masks[annotation[i, 3]:annotation[i, 4], annotation[i, 1]:annotation[i, 2], i] = 1

TypeError: slice indices must be integers or None or have an index method

ERROR (theano.gof.cmodule): [Errno 12] Cannot allocate memory

Dear miriambellver, thanks for your share.
I met a problem when ran your code:
Problem occurred during compilation with the command line below: /usr/bin/g++ -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -march=core-avx-i -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mxsave -mxsaveopt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=3072 -mtune=core-avx-i -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/theano/gof -fvisibility=hidden -o /home/leemo/.theano/compiledir_Linux-3.16--generic-x86_64-with-Ubuntu-14.04-trusty-x86_64-2.7.6-64/tmprBtt4Q/af8288e23d4f9216c7a523f6c00e6cf5.so /home/leemo/.theano/compiledir_Linux-3.16--generic-x86_64-with-Ubuntu-14.04-trusty-x86_64-2.7.6-64/tmprBtt4Q/mod.cpp -L/usr/lib -lpython2.7 ERROR (theano.gof.cmodule): [Errno 12] Cannot allocate memory Traceback (most recent call last): File "image_zooms_testing.py", line 98, in <module> state = get_state(region_image, history_vector, model_vgg) File "/home/leemo/git-repo/detection-2016-nipsws/scripts/reinforcement.py", line 46, in get_state descriptor_image = get_conv_image_descriptor_for_image(image, model_vgg) File "/home/leemo/git-repo/detection-2016-nipsws/scripts/features.py", line 198, in get_conv_image_descriptor_for_image _convout1_f = K.function(inputs, [model.layers[31].output]) File "/usr/local/lib/python2.7/dist-packages/keras/backend/theano_backend.py", line 802, in function return Function(inputs, outputs, updates=updates, **kwargs) File "/usr/local/lib/python2.7/dist-packages/keras/backend/theano_backend.py", line 788, in __init__ **kwargs) File "/usr/local/lib/python2.7/dist-packages/theano/compile/function.py", line 320, in function output_keys=output_keys) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 479, in pfunc output_keys=output_keys) File "/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py", line 1777, in orig_function defaults) File "/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py", line 1641, in create input_storage=input_storage_lists, storage_map=storage_map) File "/usr/local/lib/python2.7/dist-packages/theano/gof/link.py", line 690, in make_thunk storage_map=storage_map)[:3] File "/usr/local/lib/python2.7/dist-packages/theano/gof/vm.py", line 1003, in make_all no_recycling)) File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 970, in make_thunk no_recycling) File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 879, in make_c_thunk output_storage=node_output_storage) File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 1200, in make_thunk keep_lock=keep_lock) File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 1143, in __compile__ keep_lock=keep_lock) File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 1595, in cthunk_factory key=key, lnk=self, keep_lock=keep_lock) File "/usr/local/lib/python2.7/dist-packages/theano/gof/cmodule.py", line 1142, in module_from_key module = lnk.compile_cmodule(location) File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 1506, in compile_cmodule preargs=preargs) File "/usr/local/lib/python2.7/dist-packages/theano/gof/cmodule.py", line 2182, in compile_str p_out = output_subprocess_Popen(cmd) File "/usr/local/lib/python2.7/dist-packages/theano/misc/windows.py", line 75, in output_subprocess_Popen p = subprocess_Popen(command, **params) File "/usr/local/lib/python2.7/dist-packages/theano/misc/windows.py", line 36, in subprocess_Popen proc = subprocess.Popen(command, startupinfo=startupinfo, **params) File "/usr/lib/python2.7/subprocess.py", line 710, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1223, in _execute_child self.pid = os.fork() OSError: [Errno 12] Cannot allocate memory
I used a GT750M GPU which has 4GB memory to run this code, but seems the GPU memory is still not enough, so can you tell me how many resource have you used when you ran your code, have you ever met this problem before?
BTW, I used theano as bakcend.
Using Theano backend. Using gpu device 0: GeForce GT 750M (CNMeM is enabled with initial size: 95.0% of memory, cuDNN 5005)

Used the pre-trained model model_image_zooms_2, it returns action 6 on the very first prediction with similar airplane test images

Used the pre-trained model model_image_zooms_2, it returns action 6 on the very first prediction with similar airplane test images. I am getting qval returned like the following one: [[ 0.00517994 0.00194971 0.00551834 0.00129612 -0.00100664 0.02811333]] on the very first prediction with the pretrained model. Input images are preprocessed as expected (mean normalized and converted to BGR). Getting no clue where I am doing wrong. Any idea where things can go wrong / how to debug? thanks in advance.

IOError: Unable to create file

Dear miriambellver , thanks for your share. I use theano0.9 and keras=1.1.0 . But I met this problem:
Using Theano backend.
Using gpu device 0: GeForce GTX 1070 (CNMeM is enabled with initial size: 75.0% of memory, cuDNN 5105)
/home/sook/anaconda2/lib/python2.7/site-packages/theano/sandbox/cuda/init.py:600: UserWarning: Your cuDNN version is more recent than the one Theano officially supports. If you see any problems, try updating Theano or downgrading cuDNN to version 5.
warnings.warn(warn)
/home/sook/detection/scripts/parse_xml_annotations.py:51: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
masks[annotation[i, 3]:annotation[i, 4], annotation[i, 1]:annotation[i, 2], i] = 1
image_zooms_training.py:220: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
offset_aux[1]:offset_aux[1] + size_mask[1]]
image_zooms_training.py:221: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
region_mask[offset[0]:offset[0] + size_mask[0], offset[1]:offset[1] + size_mask[1]] = 1
Traceback (most recent call last):
File "image_zooms_training.py", line 284, in
model.save_weights(string, overwrite=True)
File "/home/sook/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 2443, in save_weights
f = h5py.File(filepath, 'w')
File "/home/sook/anaconda2/lib/python2.7/site-packages/h5py/_hl/files.py", line 272, in init
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "/home/sook/anaconda2/lib/python2.7/site-packages/h5py/_hl/files.py", line 98, in make_fid
fid = h5f.create(name, h5f.ACC_TRUNC, fapl=fapl, fcpl=fcpl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/home/ilan/minonda/conda-bld/work/h5py/_objects.c:2696)
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/home/ilan/minonda/conda-bld/work/h5py/_objects.c:2654)
File "h5py/h5f.pyx", line 96, in h5py.h5f.create (/home/ilan/minonda/conda-bld/work/h5py/h5f.c:2109)
IOError: Unable to create file (Unable to open file: name = '../models_image_zooms/model0_epoch_0h5', errno = 2, error message = 'no such file or directory', flags = 13, o_flags = 242)

could you tell me what happen ?
Thanks a lot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.