Skip to content

Commit 22951fd

Browse files
committed
fixing tfrecord3
1 parent 478d538 commit 22951fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

example/tutorial_tfrecord3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _bytes_feature_list(values):
6666

6767
processed_capts, img_capts = [], []
6868
for idx in range(len(caption_data['images'])):
69-
img_capt = caption_data['annotations'][idx]['caption']
69+
img_capt = caption_data['images'][idx]['caption']
7070
img_capts.append(img_capt)
7171
processed_capts.append(tl.nlp.process_sentence(img_capt, start_word="<S>", end_word="</S>"))
7272
print("Original Captions: %s" % img_capts)
@@ -80,7 +80,7 @@ def _bytes_feature_list(values):
8080
for idx in range(len(caption_data['images'])):
8181
# get data
8282
img_name = caption_data['images'][idx]['file_name']
83-
img_capt = '<S> ' + caption_data['annotations'][idx]['caption'] + ' </S>'
83+
img_capt = '<S> ' + caption_data['images'][idx]['caption'] + ' </S>'
8484
img_capt_ids = [vocab.word_to_id(word) for word in img_capt.split(' ')]
8585
print("%s : %s : %s" % (img_name, img_capt, img_capt_ids))
8686
img = Image.open(IMG_DIR+img_name)

0 commit comments

Comments
 (0)