attribute-aware-attention
attribute-aware-attention copied to clipboard
Model Folder is empty
Why the model folder is empty and where is model reside? I can't able to find it
I didn't put the pretrained model here. You need to train by yourself.
Also what is the technique, used for CUB attributes because there are 312 attributes but you processed attributes? What technique you used? I am trying to understand the meaning of this
nb_attributes = [10, 16, 16, 16, 5, 16, 7, 16, 12, 16, 16, 15, 4, 16, 16, 16, 16, 6, 6, 15, 5, 5, 5, 16, 16, 16, 16, 5]
like what is the meaning of 10 here[position represent bill shape etc]?
Also, I am getting this error, don't know why?
ValueError Traceback (most recent call last)
<ipython-input-8-101167670821> in <module>()
11 model_raw.summary()
12 share_fea_map = model_raw.get_layer(shared_layer_name).output
---> 13 share_fea_map = Reshape((final_dim, L), name='reshape_layer')(share_fea_map)
14 share_fea_map = Permute((2, 1))(share_fea_map)
15
C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\topology.py in __call__(self, inputs, **kwargs)
636 # Inferring the output shape is only relevant for Theano.
637 if all([s is not None for s in _to_list(input_shape)]):
--> 638 output_shape = self.compute_output_shape(input_shape)
639 else:
640 if isinstance(input_shape, list):
C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\core.py in compute_output_shape(self, input_shape)
400 # input shape known? then we can compute the output shape
401 return (input_shape[0],) + self._fix_unknown_dimension(
--> 402 input_shape[1:], self.target_shape)
403
404 def call(self, inputs):
C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\core.py in _fix_unknown_dimension(self, input_shape, output_shape)
388 output_shape[unknown] = original // known
389 elif original != known:
--> 390 raise ValueError(msg)
391
392 return tuple(output_shape)
ValueError: total size of new array must be unchanged
I am assuming the value of L
is wrong because the for RESNET50
, activation_49
have shape (?, 2048,7,7)
but the while reshaping, you consider the value of L
is 14*14
.
Also what is the technique, used for CUB attributes because there are 312 attributes but you processed attributes? What technique you used? I am trying to understand the meaning of this
nb_attributes = [10, 16, 16, 16, 5, 16, 7, 16, 12, 16, 16, 15, 4, 16, 16, 16, 16, 6, 6, 15, 5, 5, 5, 16, 16, 16, 16, 5]
like what is the meaning of 10 here[position represent bill shape etc]?
The 312 attributes are clustered according to whether they are the same attribute.
Also, I am getting this error, don't know why?
ValueError Traceback (most recent call last) <ipython-input-8-101167670821> in <module>() 11 model_raw.summary() 12 share_fea_map = model_raw.get_layer(shared_layer_name).output ---> 13 share_fea_map = Reshape((final_dim, L), name='reshape_layer')(share_fea_map) 14 share_fea_map = Permute((2, 1))(share_fea_map) 15 C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\topology.py in __call__(self, inputs, **kwargs) 636 # Inferring the output shape is only relevant for Theano. 637 if all([s is not None for s in _to_list(input_shape)]): --> 638 output_shape = self.compute_output_shape(input_shape) 639 else: 640 if isinstance(input_shape, list): C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\core.py in compute_output_shape(self, input_shape) 400 # input shape known? then we can compute the output shape 401 return (input_shape[0],) + self._fix_unknown_dimension( --> 402 input_shape[1:], self.target_shape) 403 404 def call(self, inputs): C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\core.py in _fix_unknown_dimension(self, input_shape, output_shape) 388 output_shape[unknown] = original // known 389 elif original != known: --> 390 raise ValueError(msg) 391 392 return tuple(output_shape) ValueError: total size of new array must be unchanged
I am assuming the value of
L
is wrong because the forRESNET50
,activation_49
have shape(?, 2048,7,7)
but the while reshaping, you consider the value ofL
is14*14
.
The input image size is 448448, not 224224.
Thank you for you quick answers.
- I am getting this error, I dont know what am i doing wrong I exactly run your code same.
Epoch 1/10
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-91-341adc1cba50> in <module>()
55 label_batch_list.append(np_utils.to_categorical(y_batch, nb_classes))
56
---> 57 loss = model.train_on_batch(X_batch, label_batch_list)
58 # print
59 ave_loss = ave_loss*(batches-1)/batches + np.array(loss)/batches
~/anaconda3/envs/3.5pytorch/lib/python3.5/site-packages/keras/engine/training.py in train_on_batch(self, x, y, sample_weight, class_weight)
1875 x, y,
1876 sample_weight=sample_weight,
-> 1877 class_weight=class_weight)
1878 if self.uses_learning_phase and not isinstance(K.learning_phase(), int):
1879 ins = x + y + sample_weights + [1.]
~/anaconda3/envs/3.5pytorch/lib/python3.5/site-packages/keras/engine/training.py in _standardize_user_data(self, x, y, sample_weight, class_weight, check_array_lengths, batch_size)
1478 output_shapes,
1479 check_batch_axis=False,
-> 1480 exception_prefix='target')
1481 sample_weights = _standardize_sample_weights(sample_weight,
1482 self._feed_output_names)
~/anaconda3/envs/3.5pytorch/lib/python3.5/site-packages/keras/engine/training.py in _standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix)
121 ': expected ' + names[i] + ' to have shape ' +
122 str(shape) + ' but got array with shape ' +
--> 123 str(data_shape))
124 return data
125
ValueError: Error when checking target: expected p0 to have shape (1,) but got array with shape (200,)
The categorical_crossentropy loss in Keras may changed its API.
you can try to set from_logits=True
in keras.backend.categorical_crossentropy(target, output, from_logits=False, axis=-1)
.
The prediction of network is a list of length 30 in which there are 28 attributes and what are the other two? I got the prediction on image, how can i see the attention on image?
The region_score_map
in https://github.com/iamhankai/attribute-aware-attention/blob/master/cub_demo.py#L112 is the attention values. You can visualize it.