diatoms_detector/Load Image test.ipynb

70 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

2018-04-10 13:04:13 +02:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"from keras.applications.vgg19 import VGG19\n",
"from keras.preprocessing import image\n",
"from keras.applications.inception_v3 import preprocess_input\n",
"from keras.models import Model\n",
"import numpy as np\n",
"\n",
"# base_model = VGG19(weights='imagenet')\n",
"# model = Model(inputs=base_model.input, outputs=base_model.get_layer('block4_pool').output)\n",
"\n",
"img_path = 'images/Achanthidium delmontii-!-Achnanthidium delmontii.JPG'\n",
"img = image.load_img(img_path, target_size=(224, 224))\n",
"x = image.img_to_array(img)\n",
"x = np.expand_dims(x, axis=0)\n",
"x = preprocess_input(x)\n",
"\n",
"# block4_pool_features = model.predict(x)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(-1.0, 1.0)"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x.min(), x.max()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}