LoginSignup
0
0

More than 5 years have passed since last update.

raspberry pi 3 でstretch その7

Last updated at Posted at 2017-11-07

概要

raspberry pi 3 でstretchやってみた。
tensorflowやってみた。

環境

Raspberry Pi 3 model B v1.2 element14
2017-09-07-raspbian-stretch
tensorflow1.3

インストール

設定

sudo nano /etc/dphys-swapfile

conf_swapsize=1024

サンプルコード

from tensorflow.contrib.keras.python.keras.applications.resnet50 import ResNet50
from tensorflow.contrib.keras.python.keras.preprocessing import image
from tensorflow.contrib.keras.python.keras.applications.imagenet_utils import preprocess_input, decode_predictions
import numpy as np

model = ResNet50(weights = 'imagenet')
img_path = 'p1m.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))



以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0