Skip to content

Commit

Permalink
Se reestrutura el repositorio #34
Browse files Browse the repository at this point in the history
  • Loading branch information
mecyc committed Feb 17, 2022
1 parent ef20ac4 commit bd54b50
Show file tree
Hide file tree
Showing 357 changed files with 11,154 additions and 1,875 deletions.
File renamed without changes.
462 changes: 462 additions & 0 deletions .ipynb_checkpoints/INTERFAZ-Copy1-checkpoint.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 63,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 64,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -25,7 +25,7 @@
},
{
"cell_type": "code",
"execution_count": 65,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -35,7 +35,7 @@
},
{
"cell_type": "code",
"execution_count": 66,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -44,7 +44,7 @@
},
{
"cell_type": "code",
"execution_count": 67,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -53,7 +53,7 @@
},
{
"cell_type": "code",
"execution_count": 68,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -72,43 +72,18 @@
},
{
"cell_type": "code",
"execution_count": 69,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Precisión del modelo: 0.8496\n"
]
}
],
"outputs": [],
"source": [
"print(\"Precisión del modelo: {0: 0.4f}\".format(media/10))"
]
},
{
"cell_type": "code",
"execution_count": 70,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.9333333333333333\n",
"0.8666666666666667\n",
"0.6\n",
"0.7333333333333333\n",
"0.9666666666666667\n",
"0.7666666666666667\n",
"0.8333333333333334\n",
"0.9\n",
"0.8\n",
"0.4666666666666667\n"
]
}
],
"outputs": [],
"source": [
"#Testamos el modelo\n",
"for i in range(len(train)):\n",
Expand Down
56 changes: 24 additions & 32 deletions INTERFAZ.ipynb → ...nb_checkpoints/RadarWave-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -16,29 +16,19 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\sklearn\\externals\\joblib\\__init__.py:15: DeprecationWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.\n",
" warnings.warn(msg, category=DeprecationWarning)\n"
]
}
],
"outputs": [],
"source": [
"import os, sys, platform\n",
"import tkinter as tk\n",
"from tkinter import filedialog\n",
"from tkinter import ttk\n",
"from tkinter import *\n",
"from PIL import ImageTk, Image\n",
"import numpy as np\n",
"import pandas as pd\n",
"from cmath import phase\n",
"from sklearn.externals import joblib \n",
"import joblib #from sklearn.externals \n",
"from acconeer.exptool import configs, clients\n",
"from tkinter import filedialog as fd \n",
"\n",
Expand All @@ -51,7 +41,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -71,8 +61,9 @@
" 'plastico': 'PLASTICO',\n",
" 'cristal': 'CRISTAL' \n",
" }\n",
"\n",
" \n",
" self.contador = 0\n",
"\n",
" #Inicializar GUI\n",
" self.app=tk.Tk()\n",
" self.app.geometry('800x600')\n",
Expand All @@ -98,7 +89,7 @@
" self.menu1.add_separator() #separador\n",
" self.menu1.add_command(label=\"Iniciar radar\", command=self.carga_acconeer)\n",
" self.menu1.add_separator() #separador\n",
" self.menu1.add_command(label=\"Verificar lectura\", state=DISABLED, command=lambda: self.clasificar(self.datos))\n",
" self.menu1.add_command(label=\"Verificar lectura\", state=DISABLED, command=lambda: self.clasificar())\n",
" \n",
" \n",
" # Seccion 'Ayuda':\n",
Expand All @@ -115,7 +106,7 @@
" bot1.pack(side=LEFT, padx=1, pady=1)\n",
" bot2 = Button(barraherr, image=self.icono2,command=self.carga_acconeer)\n",
" bot2.pack(side=LEFT, padx=1, pady=1)\n",
" self.bot3 = Button(barraherr, image=self.icono3, state=DISABLED, command=lambda: self.clasificar(self.datos))\n",
" self.bot3 = Button(barraherr, image=self.icono3, state=DISABLED, command=lambda: self.clasificar())\n",
" self.bot3.pack(side=LEFT, padx=1, pady=1)\n",
" barraherr.pack(side=TOP, fill=X)\n",
" \n",
Expand Down Expand Up @@ -143,9 +134,9 @@
"\n",
" #Gráfico \n",
" #valores iniciales para el gráfico de barras:\n",
" Data1 = {'Clases': ['CARTON','CRISTAL','PLASTICO'], 'Porcentaje': [0,0,0]}\n",
" df1 = pd.DataFrame(Data1, columns= ['Clases', 'Porcentaje'])\n",
" df1 = df1[['Clases', 'Porcentaje']].groupby('Clases').sum()\n",
" Data1 = {'Materiales': ['CARTON','CRISTAL','PLASTICO'], 'Probabilidad': [0,0,0]}\n",
" df1 = pd.DataFrame(Data1, columns= ['Materiales', 'Probabilidad'])\n",
" df1 = df1[['Materiales', 'Probabilidad']].groupby('Materiales').sum()\n",
"\n",
" #Crear Gráfico de barras:\n",
" grafico1 = plt.Figure(figsize=(6,6), dpi=70)\n",
Expand Down Expand Up @@ -255,8 +246,9 @@
" \n",
"\n",
" #Ejecutar radar\n",
" ssh_client.exec_command('Downloads/rpi_xc112/utils/acc_streaming_server_rpi_xc112_r2b_xr112_r2b_a111_r2c')\n",
" print('hola')\n",
" if self.contador == 0:\n",
" ssh_client.exec_command('Downloads/rpi_xc112/utils/acc_streaming_server_rpi_xc112_r2b_xr112_r2b_a111_r2c')\n",
" self.contador+=1\n",
" \n",
" #Parámetros del radar\n",
" iq = configs.IQServiceConfig()\n",
Expand All @@ -275,7 +267,7 @@
" data.append(raspi.get_next()[-1])\n",
" \n",
" #raspi.close()\n",
" #ssh_client.close()\n",
" ssh_client.close()\n",
"\n",
" data = np.asarray(data)\n",
"\n",
Expand Down Expand Up @@ -303,12 +295,12 @@
" '''\n",
"\n",
" \n",
" def clasificar(self,datos):\n",
" def clasificar(self):\n",
" global label_packed\n",
" pred = self.modelo.predict(datos)[0]\n",
" pred = self.modelo.predict(self.datos)[0]\n",
" salida = self.diccionario[pred]\n",
" self.centro.configure(foreground='#011638', text=salida) \n",
" porcentajes = self.modelo.predict_proba(datos)[0]\n",
" porcentajes = self.modelo.predict_proba(self.datos)[0]\n",
" self.actualizarGrafico(porcentajes)\n",
" self.bot3['state'] = DISABLED\n",
" self.menu1.entryconfig(\"Verificar lectura\",state = DISABLED)\n",
Expand All @@ -317,9 +309,9 @@
" #global barras\n",
" self.barras.clear()\n",
" #crear dataframe\n",
" Data1 = {'Clases': ['CARTON','CRISTAL','PLASTICO'], 'Porcentaje': porcentajes}\n",
" df1 = pd.DataFrame(Data1, columns= ['Clases', 'Porcentaje'])\n",
" df1 = df1[['Clases', 'Porcentaje']].groupby('Clases').sum()\n",
" Data1 = {'Materiales': ['CARTON','CRISTAL','PLASTICO'], 'Probabilidad': porcentajes}\n",
" df1 = pd.DataFrame(Data1, columns= ['Materiales', 'Probabilidad'])\n",
" df1 = df1[['Materiales', 'Probabilidad']].groupby('Materiales').sum()\n",
" #Agregar data al grafico de barras\n",
" df1.plot(kind='bar', legend=True, ax=self.barras, rot=0)\n",
" self.barras.set_title('Probabilidad de pertenencia')\n",
Expand Down Expand Up @@ -357,9 +349,9 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {
"scrolled": true
"scrolled": false
},
"outputs": [],
"source": [
Expand Down
File renamed without changes.
128 changes: 128 additions & 0 deletions .ipynb_checkpoints/Untitled2-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import socket\n",
"\n",
"nombre_equipo = '192.168.0.14' #socket.gethostname()\n",
"direccion_equipo = socket.gethostbyname('Martín-PC')\n",
"print(\"el nombre del equipo es: %s\" % nombre_equipo)\n",
"print(\"La IP es: %s\" % direccion_equipo)\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'192.168.1.143'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import socket\n",
"socket.gethostbyname('radaracconeer')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Martín-PC'"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"socket.gethostname()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"b'acc_board_init: Board data from EEPROM: HW: XC112, HW rev: R2B, Production test version: v1.104, Test log id: 21265204, Date: 2018-08-10, Test status: PASS.\\nbind(): (98) Address already in use'\n"
]
}
],
"source": [
"import paramiko\n",
"# Inicia un cliente SSH\n",
"ssh_client = paramiko.SSHClient()\n",
"# Establecer política por defecto para localizar la llave del host localmente\n",
"ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())\n",
"# Conectarse\n",
"ssh_client.connect('192.168.1.143', 22, 'pi', 'raspberry')\n",
"# Ejecutar un comando de forma remota capturando entrada, salida y error estándar\n",
"\n",
"entrada, salida, error = ssh_client.exec_command('Downloads/rpi_xc112/utils/acc_streaming_server_rpi_xc112_r2b_xr112_r2b_a111_r2c')\n",
"\n",
"# Mostrar la salida estándar en pantalla\n",
"print(salida.read())\n",
"# Cerrar la conexión\n",
"#ssh_client.close()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"ssh_client.close()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit bd54b50

Please sign in to comment.