Commit 4a724626 authored by Christian Fuß's avatar Christian Fuß

small fixes to show, attend and tell model and its dataset generation script

parent 91616996
package showAttendTell;
component Main{
ports in Z(0:255)^{3, 224, 224} image,
out Z(0:25316)^{1} softmax[19];
ports in Z(0:255)^{3, 224, 224} images,
in Z(-oo:oo)^{64,2048} data,
out Z(0:25316)^{1} target[25];
instance Show_attend_tell net1;
instance Show_attend_tell net;
connect images -> net.images;
connect net.target[:] -> target[:];
}
......@@ -12,7 +12,7 @@ component Show_attend_tell{
layer FullyConnected(units = 256) features;
layer FullyConnected(units = 1, flatten=false) attention;
1 -> target[0];
0 -> target[0];
data -> features;
......
......@@ -14,7 +14,7 @@ component Show_attend_tell_images_as_input{
layer FullyConnected(units = 256) features;
layer FullyConnected(units = 1, flatten=false) attention;
1 -> target[0];
0 -> target[0];
images ->
Convolution(kernel=(7,7), channels=64, stride=(7,7), padding="valid") ->
......
......@@ -124,6 +124,10 @@ VocabularyInverse = dict((v,k) for k,v in vocabulary.items())
with open("dict.pkl", "wb") as f:
pickle.dump(VocabularyInverse, f, 2)
with open('dict.txt', 'w') as f:
for item in VocabularyInverse.values():
f.write("%s\n" % item)
# Pad to max length
for sentence in labels:
sentence += [2] * (max_length - len(sentence))
......
<start>
<end>
<pad>
a
toothbrush
has
been
placed
in
can
of
beer
two
white
vase
type
items
made
out
clay
sit
front
black
background
bowls
filled
with
salad
and
pasta
on
table
large
tree
trunk
lies
across
road
rural
area
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment