参考 Web ページ http://aidiary.hatenablog.com/entry/20170104/1483535144
spyder を使用
from keras.applications.vgg16 import VGG16 m = VGG16(include_top=True, weights='imagenet', input_tensor=None, input_shape=None)
m.summary()
人物ではなくて、 「風船」や「いちご」など、人工物、動物、植物がいいです.
※ 上に書いたように、VGG16 に、「ImageNet を用いて学習(訓練)済み」のニューラルネットのデータをダウンロードして使用している
from keras.applications.vgg16 import VGG16, preprocess_input, decode_predictions from tensorflow.keras.preprocessing import image import numpy as np import sys rgb = image.load_img('a.png', target_size=(224, 224)) x = image.img_to_array(rgb) x = np.expand_dims(x, axis=0) preds = model.predict(preprocess_input(x)) results = decode_predictions(preds, top=5)[0] for result in results: print(result)
本サイトは金子邦彦研究室のWebページです.サイトマップは,サイトマップのページをご覧下さい. 本サイト内の検索は,サイト内検索のページをご利用下さい.
問い合わせ先: 金子邦彦(かねこ くにひこ)