Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def load_feature_model(self):

def load_tokenizer(self):
self.tokenizer = load(open("pkl/tokenizer.pkl", 'rb'))
#See: https://stackoverflow.com/questions/49861842/attributeerror-tokenizer-object-has-no-attribute-oov-token-in-keras
self.tokenizer.oov_token = None
self.details = load(open("pkl/detail.pkl", 'rb'))
self.max_length = self.details['max_length']
self.vocab_size = self.details['vocab_size']
Expand Down Expand Up @@ -89,4 +91,4 @@ def get_caption(self, image_file_path):
cv2.putText(image, caption, (10, image.shape[0]-100), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 1, cv2.LINE_4)
cv2.imwrite("example_output.jpg", image)
cv2.imshow("Image Captioning", image)
cv2.waitKey(2000)
cv2.waitKey(2000)