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

View file

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -17,15 +17,18 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "ename": "StopIteration",
"output_type": "stream", "evalue": "",
"text": [ "output_type": "error",
"/tmp/deepl/dataset_rot\n", "traceback": [
"['octane', 'werewolf', 'breakout', 'aftershock']\n" "\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", "cell_type": "code",
"execution_count": 4, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -89,7 +92,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -99,7 +102,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -133,7 +136,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -145,7 +148,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -267,7 +270,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -324,7 +327,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -350,7 +353,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -362,7 +365,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {