It's trainin' time.
This commit is contained in:
parent
12d745d1b0
commit
2db47abee0
@ -8,11 +8,15 @@ namespace JeuHoy_WPF_Natif.Model {
|
||||
public GestionFichiersSorties(){}
|
||||
|
||||
public List<Squelette> ChargerCoordonnees(string fichier) {
|
||||
StreamReader lecteur = new StreamReader(fichier);
|
||||
List<Squelette> lstSql = new List<Squelette>();
|
||||
string sLigne = "";
|
||||
string[] sTabElements = null;
|
||||
|
||||
if (!File.Exists(fichier))
|
||||
return lstSql;
|
||||
|
||||
StreamReader lecteur = new StreamReader(fichier);
|
||||
|
||||
if (!lecteur.EndOfStream) {
|
||||
sLigne = lecteur.ReadLine();
|
||||
int nbElements = Convert.ToInt32(sLigne);
|
||||
|
@ -4,19 +4,25 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JeuHoy_WPF_Natif.Model;
|
||||
|
||||
namespace JeuHoy_WPF_Natif.Model {
|
||||
public class GestionPerceptrons {
|
||||
private Dictionary<string, Perceptron> _lstPerceptrons = new Dictionary<string, Perceptron>();
|
||||
private Model.IGestionFichiers _gestionSortie = new GestionFichiersSorties();
|
||||
private List<Squelette> _lstData = new List<Squelette>();
|
||||
private IGestionFichiers _gestionSortie = new GestionFichiersSorties();
|
||||
private List<Squelette> _lstData;
|
||||
|
||||
/// <summary>
|
||||
/// Constructeur
|
||||
/// </summary>
|
||||
public GestionPerceptrons() {
|
||||
_lstData = _gestionSortie.ChargerCoordonnees("train.txt");
|
||||
|
||||
for (char x = '0'; x <= '9'; ++x)
|
||||
_lstPerceptrons.Add(x.ToString(), new Perceptron(x.ToString()));
|
||||
|
||||
foreach (Squelette sql in _lstData)
|
||||
Entrainement(sql, sql.Reponse);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -44,6 +50,7 @@ namespace JeuHoy_WPF_Natif.Model {
|
||||
if (reponse != "") {
|
||||
coordo.Reponse = reponse;
|
||||
_lstData.Add(coordo);
|
||||
SauvegarderCoordonnees("train.txt");
|
||||
}
|
||||
|
||||
if (_lstData is null)
|
||||
|
@ -30,8 +30,8 @@ namespace JeuHoy_WPF_Natif.Presenter
|
||||
private void _vue_EntrainementEvt(object sender, EventArgs e)
|
||||
{
|
||||
// Perceptron!!!
|
||||
string position = _vue.GetPositionEnCour().ToString();
|
||||
Squelette sq = new Squelette(new double[1], position);
|
||||
string position = (_vue.GetPositionEnCour() - 1).ToString();
|
||||
Squelette sq = new Squelette(_gestionnaireKinect.Body, position);
|
||||
|
||||
_vue.Console = _gestionnairePerceptron.Entrainement(sq, position);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using JeuHoy_WPF_Natif.View;
|
||||
using Microsoft.Kinect;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
@ -42,6 +43,10 @@ namespace JeuHoy_WPF.View
|
||||
|
||||
_presentateur = new PresentateurWEntrainement(this);
|
||||
|
||||
for (int x = 1; x <= CstApplication.NBFIGURE; ++x)
|
||||
if (File.Exists("HoyContent/fig" + x.ToString() + ".png"))
|
||||
_dicImgFigure.Add("fig" + x, new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"./HoyContent/fig" + x.ToString() + ".png", UriKind.Absolute)));
|
||||
|
||||
ChargerFigure();
|
||||
_son.JouerSonAsync(@"./HoyContent/hoy.wav");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user