Beispiel #1
0
        private void Testar(ActivationNetwork activationNetwork, int inputCount, string baseCaminho, string arquivo)
        {
            var classe = _classes.First(c => c.Value.Audios.Any(a => a.StartsWith(baseCaminho)));

            Debug.Write($"{baseCaminho} Saida esperada: ");

            ImprimirVetor(classe.Value.SaidaEsperada, Console.WriteLine, Console.Write);

            var caracteristicas = AudioModelHelper.ObterCaracteristicas(arquivo, inputCount);

            var media = new int[_classes.Count];

            foreach (var item in caracteristicas)
            {
                var saida = activationNetwork.Compute(item);

                //Debug.WriteLine($"'{saida[0]}', '{saida[1]}', '{saida[2]}'");

                var impressao = Imprimir(saida, Console.WriteLine, Console.Write);

                for (int i = 0; i < _classes.Count; i++)
                {
                    media[i] += impressao[i];
                }

                ImprimirVetor(saida, Console.WriteLine, Console.Write);
            }

            Debug.Write("Média: ");
            ImprimirVetor(media, Console.WriteLine, Console.Write);
        }
Beispiel #2
0
        public void Classificar(string arquivo, Action <string> writeLine, Action <string> write)
        {
            var caracteristicas = AudioModelHelper.ObterCaracteristicas(arquivo, msSegmentos);

            writeLine($"Classes: {_classes.Count}");

            foreach (var item in _classes)
            {
                write($"Classe: {item.Value.Descricao}, saida esperada: ");
                ImprimirVetor(item.Value.SaidaEsperada, writeLine, write);
            }

            var media = new int[_classes.Count];

            foreach (var item in caracteristicas)
            {
                var saida = activationNetwork.Compute(item);

                var impressao = Imprimir(saida, writeLine, write);

                for (int i = 0; i < _classes.Count; i++)
                {
                    media[i] += impressao[i];
                }

                ImprimirVetor(saida, writeLine, write);
            }

            Debug.Write("Média: ");
            ImprimirVetor(media, writeLine, write);
        }