1. В этом разделе я получил выходные данные как созданный файл "describ.txt"
# Set these path according to project folder in you system
dataset_text = 'C:\\Users\Srikanth Bhattu\Project\Flickr8k_text\Flickr8k.token.txt'
dataset_images = 'C:\\Users\Srikanth Bhattu\Project\Flickr8k_Dataset\Flicker8k_Dataset'
#we prepare our text data
filename = dataset_text + "/" + 'C:\\Users\Srikanth Bhattu\Project\Flickr8k_text\Flickr8k.token.txt'
#loading the file that contains all data
#mapping them into descriptions dictionary img to 5 captions
descriptions = all_img_captions()
print("Length of descriptions =" ,len(descriptions))
#cleaning the descriptions
clean_descriptions = cleaning_text(descriptions)
#building vocabulary
vocabulary = text_vocabulary()
print("Length of vocabulary = ", len(vocabulary))
#saving each description to file
save_descriptions()
2.Помогите мне загрузить набор данных изображения и сгенерировать как указано ниже, вывод
def extract_features(directory):
model = Xception( include_top=False, pooling='avg' )
features = {}
for img in tqdm(os.listdir(directory)):
filename = directory + "/" + img
image = Image.open(filename)
image = image.resize((299,299))
image = np.expand_dims(image, axis=0)
#image = preprocess_input(image)
image = image/127.5
image = image - 1.0
feature = model.predict(image)
features[img] = feature
return features
#2048 feature vector
features = extract_features(dataset_images)
dump(features, open("features.p","wb"))
Ошибка:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-246-e6797fb99786> in <module>
1 #2048 feature vector
----> 2 features = extract_features(dataset_images)
3 dump(features, open('C:\\Users\Srikanth Bhattu\Project\features.p','wb'))
<ipython-input-242-ab5029ed6c28> in extract_features(directory)
1 def extract_features(directory):
----> 2 model = Xception( include_top=False, pooling='avg' )
3 features = {}
4 for img in tqdm(os.listdir(directory)):
5 filename = directory + "/" + img
NameError: name 'Xception' is not defined.
Мне нужен этот вывод изображения: Нажмите здесь, чтобы открыть вывод изображения
Я работаю с «ГЕНЕРАТОР ИЗОБРАЖЕНИЯ ИЗОБРАЖЕНИЯ, используя CNN & LSTM» . У меня есть все исходные коды и набор данных, но я не могу включить мой набор данных и пути в мой код. Если кто-то хочет помочь мне завершить мой проект, пожалуйста, прокомментируйте, я заплачу им некоторые сборы. Спасибо ... !!!