path dans les variables

This commit is contained in:
gdamms 2022-04-13 09:28:31 +02:00
parent 224bebb81d
commit 3b76c8e222
2 changed files with 25 additions and 23 deletions

View file

@ -13,26 +13,25 @@ import utils
RESIZED_SIZE = (100, 50, 3)
LABELS = ['octane', 'werewolf', 'breakout', 'aftershock']
MODELS_PATH = '../models'
MODEL_FILENAME = 'rot_25e'
# Load model
model = models.load_model('../models/model')
model = models.load_model(MODELS_PATH + '/' + MODEL_FILENAME)
utils.startup(need_focus=False)
running = True
while running:
utils.screenshot(filename='live', folder='../models')
utils.screenshot(filename='live', folder=MODELS_PATH)
# Lecture de l'image
img = PIL.Image.open('../models/live')
# print(f"img.size = {img.size}")
img = PIL.Image.open(MODELS_PATH + '/live')
# Redimensionnement de l'image
img = img.resize(RESIZED_SIZE[:-1], PIL.Image.ANTIALIAS)
# print(f"img.size = {img.size}")
X = np.asarray(img)
Y = model.evaluate(X)

View file

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
@ -17,15 +17,18 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/tmp/deepl/dataset_rot\n",
"['octane', 'werewolf', 'breakout', 'aftershock']\n"
"ename": "StopIteration",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mStopIteration\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m/home/damien/GitHub/DeepLearning/src/notebook.ipynb Cell 2'\u001b[0m in \u001b[0;36m<cell line: 6>\u001b[0;34m()\u001b[0m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/damien/GitHub/DeepLearning/src/notebook.ipynb#ch0000001?line=3'>4</a>\u001b[0m DATASET_PATH \u001b[39m=\u001b[39m \u001b[39m\"\u001b[39m\u001b[39m./dataset_rot/\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/damien/GitHub/DeepLearning/src/notebook.ipynb#ch0000001?line=4'>5</a>\u001b[0m DATASET_PATH \u001b[39m=\u001b[39m os\u001b[39m.\u001b[39mpath\u001b[39m.\u001b[39mabspath(DATASET_PATH)\n\u001b[0;32m----> <a href='vscode-notebook-cell:/home/damien/GitHub/DeepLearning/src/notebook.ipynb#ch0000001?line=5'>6</a>\u001b[0m CLASSES \u001b[39m=\u001b[39m \u001b[39mnext\u001b[39;49m(os\u001b[39m.\u001b[39;49mwalk(DATASET_PATH))[\u001b[39m1\u001b[39m]\n\u001b[1;32m <a href='vscode-notebook-cell:/home/damien/GitHub/DeepLearning/src/notebook.ipynb#ch0000001?line=7'>8</a>\u001b[0m \u001b[39mprint\u001b[39m(DATASET_PATH)\n\u001b[1;32m <a href='vscode-notebook-cell:/home/damien/GitHub/DeepLearning/src/notebook.ipynb#ch0000001?line=8'>9</a>\u001b[0m \u001b[39mprint\u001b[39m(CLASSES)\n",
"\u001b[0;31mStopIteration\u001b[0m: "
]
}
],
@ -43,7 +46,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@ -89,7 +92,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@ -99,7 +102,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [
{
@ -133,7 +136,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@ -145,7 +148,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [
{
@ -267,7 +270,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [
{
@ -324,7 +327,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [
{
@ -350,7 +353,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@ -362,7 +365,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {},
"outputs": [
{