diff --git a/nets/lb1/Dokukin/Dokukin_lab1.docx b/nets/lb1/Dokukin/Dokukin_lab1.docx new file mode 100644 index 0000000..8161e99 Binary files /dev/null and b/nets/lb1/Dokukin/Dokukin_lab1.docx differ diff --git a/nets/lb2/Dokukin/Dokukin_lab2.docx b/nets/lb2/Dokukin/Dokukin_lab2.docx new file mode 100644 index 0000000..93d0437 Binary files /dev/null and b/nets/lb2/Dokukin/Dokukin_lab2.docx differ diff --git a/nets/lb3/Dokukin/Dokukin_lab3.docx b/nets/lb3/Dokukin/Dokukin_lab3.docx new file mode 100644 index 0000000..5271471 Binary files /dev/null and b/nets/lb3/Dokukin/Dokukin_lab3.docx differ diff --git a/nets/lb4/Dokukin/Dokukin_lab4.docx b/nets/lb4/Dokukin/Dokukin_lab4.docx new file mode 100644 index 0000000..8b7c07d Binary files /dev/null and b/nets/lb4/Dokukin/Dokukin_lab4.docx differ diff --git a/robs/lb1/Dokukin_DV/lr1_robots.docx b/robs/lb1/Dokukin_DV/lr1_robots.docx new file mode 100644 index 0000000..8c05d42 Binary files /dev/null and b/robs/lb1/Dokukin_DV/lr1_robots.docx differ diff --git a/robs/lb1/Dokukin_DV/my_obstacle_avoidance.py b/robs/lb1/Dokukin_DV/my_obstacle_avoidance.py new file mode 100644 index 0000000..68882ec --- /dev/null +++ b/robs/lb1/Dokukin_DV/my_obstacle_avoidance.py @@ -0,0 +1,78 @@ +"""my_avoid_obstacles controller.""" + +"""Braitenberg-based obstacle-avoiding robot controller.""" + +from controller import Robot, Compass + +# Get reference to the robot. +robot = Robot() + +# Get robot's Compass device +compass = robot.getCompass("compass") + +# Get simulation step length. +timeStep = int(robot.getBasicTimeStep()) + +# Constants of the Thymio II motors and distance sensors. +maxMotorVelocity = 9.53 +distanceSensorCalibrationConstant = 360 + +# Get left and right wheel motors. +leftMotor = robot.getMotor("motor.left") +rightMotor = robot.getMotor("motor.right") + +# Get frontal distance sensors. +outerLeftSensor = robot.getDistanceSensor("prox.horizontal.0") +centralLeftSensor = robot.getDistanceSensor("prox.horizontal.1") +centralSensor = robot.getDistanceSensor("prox.horizontal.2") +centralRightSensor = robot.getDistanceSensor("prox.horizontal.3") +outerRightSensor = robot.getDistanceSensor("prox.horizontal.4") + +# Enable distance sensors. +outerLeftSensor.enable(timeStep) +centralLeftSensor.enable(timeStep) +centralSensor.enable(timeStep) +centralRightSensor.enable(timeStep) +outerRightSensor.enable(timeStep) + +# Enable the Compass +compass.enable(timeStep) + +# Disable motor PID control mode. +leftMotor.setPosition(float('inf')) +rightMotor.setPosition(float('inf')) + +# Set the initial velocity of the left and right wheel motors. +leftMotor.setVelocity(maxMotorVelocity) +rightMotor.setVelocity(maxMotorVelocity) + +while robot.step(timeStep) != -1: + # Read values from four distance sensors and calibrate. + outerLeftSensorValue = outerLeftSensor.getValue() / distanceSensorCalibrationConstant + centralLeftSensorValue = centralLeftSensor.getValue() / distanceSensorCalibrationConstant + centralSensorValue = centralSensor.getValue() / distanceSensorCalibrationConstant + centralRightSensorValue = centralRightSensor.getValue() / distanceSensorCalibrationConstant + outerRightSensorValue = outerRightSensor.getValue() / distanceSensorCalibrationConstant + + # To read values compass + compassValues = compass.getValues() + + # Detected obstacles + if outerLeftSensorValue != 0 or centralLeftSensorValue != 0: + leftMotor.setVelocity(maxMotorVelocity) + rightMotor.setVelocity(-0.5 * maxMotorVelocity) + elif centralSensorValue != 0 or outerRightSensorValue != 0 or centralRightSensorValue != 0: + leftMotor.setVelocity(-0.5 * maxMotorVelocity) + rightMotor.setVelocity(maxMotorVelocity) + + # Not detected obstacles + if outerLeftSensorValue == 0 and centralLeftSensorValue == 0 and centralSensorValue == 0 and centralRightSensorValue == 0 and outerRightSensorValue == 0: + if compassValues[0] > 0.001: + leftMotor.setVelocity(maxMotorVelocity) + rightMotor.setVelocity(0.9 * maxMotorVelocity) + elif compassValues[0] < -0.001: + leftMotor.setVelocity(0.9 * maxMotorVelocity) + rightMotor.setVelocity(maxMotorVelocity) + else: + leftMotor.setVelocity(maxMotorVelocity) + rightMotor.setVelocity(maxMotorVelocity) \ No newline at end of file diff --git a/robs/lb1/Dokukin_DV/robots1-1.mp4 b/robs/lb1/Dokukin_DV/robots1-1.mp4 new file mode 100644 index 0000000..fb75b5f Binary files /dev/null and b/robs/lb1/Dokukin_DV/robots1-1.mp4 differ diff --git a/robs/lb1/Dokukin_DV/square_path.py b/robs/lb1/Dokukin_DV/square_path.py new file mode 100644 index 0000000..42e8be6 --- /dev/null +++ b/robs/lb1/Dokukin_DV/square_path.py @@ -0,0 +1,74 @@ +"""Sample Webots controller for the square path benchmark.""" + +from controller import Robot + +# Get pointer to the robot. +robot = Robot() + +# Get pointer to each wheel of our robot. +leftWheel = robot.getMotor('left wheel') +rightWheel = robot.getMotor('right wheel') + +rightWheelSensor = robot.getPositionSensor('right wheel sensor') +rightWheelSensor.enable(1) # Refreshes the sensor every 16ms. + +val = 0 +print(rightWheelSensor.getValue()) +leftWheel.setVelocity(5) +rightWheel.setVelocity(5) +leftWheel.setPosition(5000) +rightWheel.setPosition(5000) +robot.step(100) + + +# First set both wheels to go forward, so the robot goes straight. +leftWheel.setVelocity(5.24) +rightWheel.setVelocity(5.24) +leftWheel.setPosition(5000) +rightWheel.setPosition(5000) +val = 20.7 +# Wait for the robot to reach a corner. +while (rightWheelSensor.getValue() < val): + robot.step(1) +print(rightWheelSensor.getValue()) + +leftWheel.setVelocity(0) +rightWheel.setVelocity(0) + +# Repeat the following 4 times (once for each side). +for i in range(0, 3): + robot.step(500) + # Then, set the right wheel backward, so the robot will turn right. + leftWheel.setVelocity(5) + rightWheel.setVelocity(5) + leftWheel.setPosition(5000) + rightWheel.setPosition(-5000) + val -= 2.63 # (2.61 + 0.023 * (i%2)) # 2.59 + # Wait until the robot has turned 90 degrees clockwise. + while (rightWheelSensor.getValue() > val): + robot.step(1) + print(rightWheelSensor.getValue()) + + leftWheel.setVelocity(0) + rightWheel.setVelocity(0) + robot.step(70) + + # First set both wheels to go forward, so the robot goes straight. + leftWheel.setVelocity(5) + rightWheel.setVelocity(5) + leftWheel.setPosition(5000) + rightWheel.setPosition(5000) + val += 20.65 + # Wait for the robot to reach a corner. + while (rightWheelSensor.getValue() < val): + robot.step(1) + print(rightWheelSensor.getValue()) + + leftWheel.setVelocity(0) + rightWheel.setVelocity(0) + + +# Stop the robot when path is completed, as the robot performance +# is only computed when the robot has stopped. +# leftWheel.setVelocity(0) +# rightWheel.setVelocity(0) diff --git a/robs/lb1/Dokukin_DV/task-2.mp4 b/robs/lb1/Dokukin_DV/task-2.mp4 new file mode 100644 index 0000000..331b7cf Binary files /dev/null and b/robs/lb1/Dokukin_DV/task-2.mp4 differ diff --git a/robs/lb2/Dokukin_Safarov/lr2_robots.docx b/robs/lb2/Dokukin_Safarov/lr2_robots.docx new file mode 100644 index 0000000..452cbd6 Binary files /dev/null and b/robs/lb2/Dokukin_Safarov/lr2_robots.docx differ diff --git a/robs/lb2/Dokukin_Safarov/pick&place.py b/robs/lb2/Dokukin_Safarov/pick&place.py new file mode 100644 index 0000000..817ee53 --- /dev/null +++ b/robs/lb2/Dokukin_Safarov/pick&place.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python +# coding: utf-8 + +# In[ ]: + + +"""Sample Webots controller for the pick and place benchmark.""" + +from controller import Robot + +# Create the Robot instance. +robot = Robot() + +# Get the time step of the current world. +timestep = int(robot.getBasicTimeStep()) + +# Inizialize base motors. +wheels = [] +wheels.append(robot.getMotor("wheel1")) +wheels.append(robot.getMotor("wheel2")) +wheels.append(robot.getMotor("wheel3")) +wheels.append(robot.getMotor("wheel4")) +for wheel in wheels: + # Activate controlling the motors setting the velocity. + # Otherwise by default the motor expects to be controlled in force or position, + # and setVelocity will set the maximum motor velocity instead of the target velocity. + wheel.setPosition(60) + +# Initialize arm motors. +armMotors = [] +armMotors.append(robot.getMotor("arm1")) +armMotors.append(robot.getMotor("arm2")) +armMotors.append(robot.getMotor("arm3")) +armMotors.append(robot.getMotor("arm4")) +armMotors.append(robot.getMotor("arm5")) +# Set the maximum motor velocity. +armMotors[0].setVelocity(1) +armMotors[1].setVelocity(0.5) +armMotors[2].setVelocity(0.5) +armMotors[3].setVelocity(0.3) + +# Initialize arm position sensors. +# These sensors can be used to get the current joint position and monitor the joint movements. +armPositionSensors = [] +armPositionSensors.append(robot.getPositionSensor("arm1sensor")) +armPositionSensors.append(robot.getPositionSensor("arm2sensor")) +armPositionSensors.append(robot.getPositionSensor("arm3sensor")) +armPositionSensors.append(robot.getPositionSensor("arm4sensor")) +armPositionSensors.append(robot.getPositionSensor("arm5sensor")) +for sensor in armPositionSensors: + sensor.enable(timestep) + +# Initialize gripper motors. +finger1 = robot.getMotor("finger1") +finger2 = robot.getMotor("finger2") +# Set the maximum motor velocity. +finger1.setVelocity(0.03) +finger2.setVelocity(0.03) +# Read the miminum and maximum position of the gripper motors. +fingerMinPosition = finger1.getMinPosition() +fingerMaxPosition = finger1.getMaxPosition() + + +# Move arm and open gripper. +armMotors[1].setPosition(-0.55) +armMotors[2].setPosition(-0.75) +armMotors[3].setPosition(-1.6) +finger1.setPosition(fingerMaxPosition) +finger2.setPosition(fingerMaxPosition) + +# Monitor the arm joint position to detect when the motion is completed. +while robot.step(timestep) != -1: + if abs(armPositionSensors[3].getValue() - (-1.2)) < 0.01: + # Motion completed. + break + + + + +robot.step(100 * timestep) +# Close gripper. +finger1.setPosition(0.013) +finger2.setPosition(0.013) +# Wait until the gripper is closed. +robot.step(50 * timestep) + +# Lift arm. +armMotors[1].setPosition(0) +# Wait until the arm is lifted. +robot.step(50 * timestep) +wheels[0].setPosition(43) +wheels[1].setPosition(-13) +wheels[2].setPosition(-13) +wheels[3].setPosition(43) +robot.step(100 * timestep) +armMotors[0].setPosition(-2.9) +armMotors[1].setPosition(-1.0) +armMotors[2].setPosition(-0.3) +armMotors[3].setPosition(0.0) +robot.step(250 * timestep) +wheels[0].setPosition(35) +wheels[1].setPosition(-21) +wheels[2].setPosition(-21) +wheels[3].setPosition(35) +robot.step(50 * timestep) + + + + + + + + +# Open gripper. +finger1.setPosition(fingerMaxPosition) +finger2.setPosition(fingerMaxPosition) +robot.step(50 * timestep) + diff --git a/robs/lb2/Dokukin_Safarov/robots2.mp4 b/robs/lb2/Dokukin_Safarov/robots2.mp4 new file mode 100644 index 0000000..4b51d0c Binary files /dev/null and b/robs/lb2/Dokukin_Safarov/robots2.mp4 differ diff --git a/robs/lb3/Dokukin_D/lab3.docx b/robs/lb3/Dokukin_D/lab3.docx new file mode 100644 index 0000000..93cf9ee Binary files /dev/null and b/robs/lb3/Dokukin_D/lab3.docx differ diff --git a/robs/lb3/Dokukin_D/lab3.ipynb b/robs/lb3/Dokukin_D/lab3.ipynb new file mode 100644 index 0000000..b6ff416 --- /dev/null +++ b/robs/lb3/Dokukin_D/lab3.ipynb @@ -0,0 +1,438 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "fashion_mnist.ipynb", + "provenance": [], + "collapsed_sections": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "gWeXWmmX30W-" + }, + "source": [ + "Подключение модулей" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "zhB0YPc7Vb6j" + }, + "source": [ + "# Набор данных\n", + "from tensorflow.keras.datasets import fashion_mnist\n", + "# Модель нейронных сетей\n", + "from tensorflow.keras.models import Sequential\n", + "# Слои\n", + "from tensorflow.keras.layers import Flatten, Dense, Dropout\n", + "from tensorflow.keras import utils\n", + "# Предварительно обученная модель сети\n", + "from tensorflow.keras.applications import Xception\n", + "import numpy as np\n", + "from tensorflow.keras.preprocessing.image import img_to_array, array_to_img" + ], + "execution_count": 1, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "IDqWnbiwWDjL" + }, + "source": [ + "Загрузка тренировочных и тестовых данных" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "P9uL2AHsWF60", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ed192904-9cfc-499a-f0a6-0b85e2db2c4a" + }, + "source": [ + "(x_train, y_train), (x_test, y_test) = fashion_mnist.load_data()" + ], + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-labels-idx1-ubyte.gz\n", + "32768/29515 [=================================] - 0s 0us/step\n", + "40960/29515 [=========================================] - 0s 0us/step\n", + "Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-images-idx3-ubyte.gz\n", + "26427392/26421880 [==============================] - 0s 0us/step\n", + "26435584/26421880 [==============================] - 0s 0us/step\n", + "Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/t10k-labels-idx1-ubyte.gz\n", + "16384/5148 [===============================================================================================] - 0s 0us/step\n", + "Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/t10k-images-idx3-ubyte.gz\n", + "4423680/4422102 [==============================] - 0s 0us/step\n", + "4431872/4422102 [==============================] - 0s 0us/step\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "GQi8J827n1A5" + }, + "source": [ + "Преобразование изображения в 3 канала" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "g-zD_tFPjE8m" + }, + "source": [ + "x_train = np.dstack([x_train]*3)\n", + "x_test = np.dstack([x_test]*3)" + ], + "execution_count": 3, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "WVSoHhfrn9np" + }, + "source": [ + "Изменение формы изображений в соответствии с тензорным форматом" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "GysrSGfxjhw9" + }, + "source": [ + "x_train = x_train.reshape(-1,28,28,3)\n", + "x_test = x_test.reshape(-1,28,28,3)" + ], + "execution_count": 4, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "yEnBYofEVq5x" + }, + "source": [ + "Изменение размера изображений 71x71 в соответствии с требованиями Xception" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "c3SvFQiEVuqQ" + }, + "source": [ + "x_train = np.asarray([img_to_array(array_to_img(im, scale=False).resize((71, 71))) for im in x_train])\n", + "x_test = np.asarray([img_to_array(array_to_img(im, scale=False).resize((71, 71))) for im in x_test])" + ], + "execution_count": 5, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "LkAG-mysWmoT" + }, + "source": [ + "Нормализация данных" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "UDwNGxhAW-yc" + }, + "source": [ + "assert x_train.shape == (60000, 71, 71, 3)\n", + "assert x_test.shape == (10000, 71, 71, 3)\n", + "assert y_train.shape == (60000,)\n", + "assert y_test.shape == (10000,)\n", + "x_train = x_train.astype('float32')\n", + "x_test = x_test.astype('float32')\n", + "x_train /= 255\n", + "x_test /= 255" + ], + "execution_count": 6, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "B_dY-4ViXM5r" + }, + "source": [ + "Преобразование меток в категории" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "8iU-9SNyXPwq" + }, + "source": [ + "y_train = utils.to_categorical(y_train,10)\n", + "y_test = utils.to_categorical(y_test,10)" + ], + "execution_count": 7, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Vd-L90GyaAgj" + }, + "source": [ + "Создание нейронной сети" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "dCeQBqjKaFMN", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "ff81eeef-1df0-47a5-e21e-64474a66ac7a" + }, + "source": [ + "# include_top = false - загрузка только сверточной части сети\n", + "# weights='imagenet' - предварительно обученные веса\n", + "# input_shape - размер тензора\n", + "mobileNet = Xception(weights='imagenet', include_top=False, input_shape=(71,71,3))\n", + "# Без обучения сверточной части сети\n", + "mobileNet.trainable = False\n", + "\n", + "model = Sequential()\n", + "# Добавление сверточного слоя\n", + "model.add(mobileNet)\n", + "# Преобразование двумерного массива в одномерный\n", + "model.add(Flatten())\n", + "# Добавление полносвязного слоя. \n", + "# На вход: 800 нейронов\n", + "model.add(Dense(800, activation='relu'))\n", + "# Слой регуляризации\n", + "model.add(Dropout(0.5))\n", + "# На выход: 10 нейронов\n", + "# softmax обеспечивает сумму вероятности, \n", + "# равную единицы на выходе всех нейронов\n", + "model.add(Dense(10, activation='softmax'))" + ], + "execution_count": 8, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Downloading data from https://storage.googleapis.com/tensorflow/keras-applications/xception/xception_weights_tf_dim_ordering_tf_kernels_notop.h5\n", + "83689472/83683744 [==============================] - 1s 0us/step\n", + "83697664/83683744 [==============================] - 1s 0us/step\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "KSbTNInsd89B" + }, + "source": [ + "Компиляция модели" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "1HzPB9jmd-vj" + }, + "source": [ + "model.compile(loss='categorical_crossentropy',\n", + " optimizer='SGD', \n", + " metrics=['accuracy'])" + ], + "execution_count": 9, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "-R2CrKQfeayf" + }, + "source": [ + "Вывод параметров модели" + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "UgbgxpjMed-4", + "outputId": "bc16862c-f791-4af2-89df-6f9d99ea4060" + }, + "source": [ + "print(model.summary())" + ], + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Model: \"sequential\"\n", + "_________________________________________________________________\n", + "Layer (type) Output Shape Param # \n", + "=================================================================\n", + "xception (Functional) (None, 3, 3, 2048) 20861480 \n", + "_________________________________________________________________\n", + "flatten (Flatten) (None, 18432) 0 \n", + "_________________________________________________________________\n", + "dense (Dense) (None, 800) 14746400 \n", + "_________________________________________________________________\n", + "dropout (Dropout) (None, 800) 0 \n", + "_________________________________________________________________\n", + "dense_1 (Dense) (None, 10) 8010 \n", + "=================================================================\n", + "Total params: 35,615,890\n", + "Trainable params: 14,754,410\n", + "Non-trainable params: 20,861,480\n", + "_________________________________________________________________\n", + "None\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "JcqeFdRXeib4" + }, + "source": [ + "Обучение сети" + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "fyIbMY8xe2TX", + "outputId": "6cb5358e-172c-47c2-b8d1-36ae7dd69d05" + }, + "source": [ + "# На каждой эпохе подается 200 изображений\n", + "model.fit(x_train, y_train, \n", + " batch_size=200, \n", + " epochs=15, \n", + " validation_split=0.1,\n", + " shuffle=True)" + ], + "execution_count": 11, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Epoch 1/15\n", + "270/270 [==============================] - 1148s 4s/step - loss: 0.8588 - accuracy: 0.7126 - val_loss: 0.5681 - val_accuracy: 0.8082\n", + "Epoch 2/15\n", + "270/270 [==============================] - 1144s 4s/step - loss: 0.5940 - accuracy: 0.7914 - val_loss: 0.5219 - val_accuracy: 0.8137\n", + "Epoch 3/15\n", + "270/270 [==============================] - 1144s 4s/step - loss: 0.5386 - accuracy: 0.8099 - val_loss: 0.5001 - val_accuracy: 0.8233\n", + "Epoch 4/15\n", + "270/270 [==============================] - 1144s 4s/step - loss: 0.5030 - accuracy: 0.8214 - val_loss: 0.4620 - val_accuracy: 0.8340\n", + "Epoch 5/15\n", + "270/270 [==============================] - 1144s 4s/step - loss: 0.4810 - accuracy: 0.8282 - val_loss: 0.4552 - val_accuracy: 0.8357\n", + "Epoch 6/15\n", + "270/270 [==============================] - 1144s 4s/step - loss: 0.4633 - accuracy: 0.8352 - val_loss: 0.4440 - val_accuracy: 0.8405\n", + "Epoch 7/15\n", + "270/270 [==============================] - 1144s 4s/step - loss: 0.4441 - accuracy: 0.8409 - val_loss: 0.4377 - val_accuracy: 0.8423\n", + "Epoch 8/15\n", + "270/270 [==============================] - 1143s 4s/step - loss: 0.4314 - accuracy: 0.8450 - val_loss: 0.4295 - val_accuracy: 0.8448\n", + "Epoch 9/15\n", + "270/270 [==============================] - 1143s 4s/step - loss: 0.4213 - accuracy: 0.8486 - val_loss: 0.4224 - val_accuracy: 0.8472\n", + "Epoch 10/15\n", + "270/270 [==============================] - 1143s 4s/step - loss: 0.4106 - accuracy: 0.8507 - val_loss: 0.4215 - val_accuracy: 0.8438\n", + "Epoch 11/15\n", + "270/270 [==============================] - 1144s 4s/step - loss: 0.4017 - accuracy: 0.8555 - val_loss: 0.4130 - val_accuracy: 0.8488\n", + "Epoch 12/15\n", + "270/270 [==============================] - 1144s 4s/step - loss: 0.3932 - accuracy: 0.8596 - val_loss: 0.4121 - val_accuracy: 0.8478\n", + "Epoch 13/15\n", + "270/270 [==============================] - 1144s 4s/step - loss: 0.3889 - accuracy: 0.8603 - val_loss: 0.4076 - val_accuracy: 0.8500\n", + "Epoch 14/15\n", + "270/270 [==============================] - 1144s 4s/step - loss: 0.3793 - accuracy: 0.8633 - val_loss: 0.4008 - val_accuracy: 0.8525\n", + "Epoch 15/15\n", + "270/270 [==============================] - 1144s 4s/step - loss: 0.3740 - accuracy: 0.8646 - val_loss: 0.3988 - val_accuracy: 0.8547\n" + ] + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "" + ] + }, + "metadata": {}, + "execution_count": 11 + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Mg-FA1EAfKLv" + }, + "source": [ + "Проверка качества обучения сети на тестовой выборке" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "Vk0BrUgkfM2i", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "40d752f9-6c10-4bb1-9552-f8032cd51eb9" + }, + "source": [ + "scores = model.evaluate(x_test, y_test, verbose=0)\n", + "print('Доля верных ответов на тестовых данных, в процентах:', round(scores[1]*100, 4))" + ], + "execution_count": 12, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Доля верных ответов на тестовых данных, в процентах: 85.04\n" + ] + } + ] + } + ] +} \ No newline at end of file