Created
February 14, 2019 09:58
-
-
Save cobanov/b28cf8f6763c2c818a820b75ed320906 to your computer and use it in GitHub Desktop.
VGG16 Keras
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Deep Learning Türkiye topluluğu için Mert Çobanoğlu tarafından hazırlanmıştır. | |
Amaç: Keras ile nesne tanıma. | |
Algoritma: Evrişimli Sinir Ağları (Convolutional Neural Networks) | |
Ek: Çalışma ile ilgili rehber README.md dosyasında belirtilmiştir. | |
""" | |
from keras.applications.vgg16 import VGG16 | |
from keras.preprocessing import image | |
from keras.applications.vgg16 import preprocess_input, decode_predictions | |
import numpy as np | |
model = VGG16(weights='imagenet') | |
img_path = 'images/bird.jpg' | |
img = image.load_img(img_path, target_size=(224, 224)) | |
x = image.img_to_array(img) | |
x = np.expand_dims(x, axis=0) | |
x = preprocess_input(x) | |
preds = model.predict(x) | |
print('Predicted:', decode_predictions(preds, top=3)[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
model = VGG16(weights='imagenet') ======> model = VGG16(weights='imagenet', include_top=True)
#Üstteki değişikliği yapın#
print('Predicted:', decode_predictions(preds, top=3)[0])
#burada hata almazsınız#