Salman Chen
1 min readDec 1, 2020

--

I found that the problem was because in

`data_generator(train_descriptions, train_features, wordtoix, max_length, number_pics_per_bath)` the train_features was blank because no images assigned.

I tried to check where they were from, and found out the train_img from this part since the embedding took nearly no time.

# Call the funtion to encode all the train images

# This will take a while on CPU - Execute this only once

start = time()

encoding_train = {}

for img in train_img:

encoding_train[img[len(images):]] = encode(img)

print("Time taken in seconds =", time()-start)

this was the problem and fixed by fixing the directory

# Below path contains all the images

images = 'Flickr_Data/Images'

# Create a list of all image names in the directory

img = glob.glob(images + '*.jpg')

to

# Below path contains all the images

images = 'Flickr_Data/Images/'

# Create a list of all image names in the directory

img = glob.glob(images + '*.jpg')

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Salman Chen
Salman Chen

Written by Salman Chen

Astro grad student at NTHU — interested in astrophysics and neuroscience, love chocolate and cookies

No responses yet

Write a response