wemosでnnc その3

#概要

wemosでnncやってみた。
sinを予測してみた。
nncで学習したnnbを使った。

#結果

![image](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/7c102c2d-ad4b-90b4-13a6-80e62331a642.png)



#サンプルコード


```
#include "network.h"
#include "runtime.h"
#include "runtime_internal.h"
#include "context.h"
#include <assert.h>
#include <string.h>

static unsigned char sin_nnb[] = {
 0x02, 0x00, 0x00, 0x00, 0x14, 0x36, 0x81, 0x06, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
 0x22, 0x00, 0x00, 0x00, 0x38, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00,
 0x34, 0x00, 0x00, 0x00, 0xC4, 0x01, 0x00, 0x00, 0xD8, 0x01, 0x00, 0x00, 0xDC, 0x01, 0x00, 0x00,
 0x6C, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x88, 0x03, 0x00, 0x00, 0x18, 0x05, 0x00, 0x00,
 0x2C, 0x05, 0x00, 0x00, 0x30, 0x05, 0x00, 0x00, 0x34, 0x05, 0x00, 0x00, 0x48, 0x05, 0x00, 0x00,
 0x50, 0x05, 0x00, 0x00, 0x64, 0x05, 0x00, 0x00, 0x6C, 0x05, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00,
 0x88, 0x05, 0x00, 0x00, 0x9C, 0x05, 0x00, 0x00, 0xBC, 0x05, 0x00, 0x00, 0xC8, 0x05, 0x00, 0x00,
 0xCC, 0x05, 0x00, 0x00, 0xE4, 0x05, 0x00, 0x00, 0xE8, 0x05, 0x00, 0x00, 0xEC, 0x05, 0x00, 0x00,
 0x04, 0x06, 0x00, 0x00, 0x10, 0x06, 0x00, 0x00, 0x14, 0x06, 0x00, 0x00, 0x2C, 0x06, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
 0x64, 0x00, 0x00, 0x00, 0xDA, 0x48, 0x5F, 0x3E, 0x9D, 0xB0, 0xF4, 0x3D, 0x34, 0x13, 0x36, 0x3E,
 0xEF, 0x2A, 0x92, 0x3E, 0x22, 0x48, 0x99, 0x3E, 0x9B, 0x89, 0x38, 0xBE, 0x3F, 0x03, 0x3F, 0x3E,
 0xEA, 0xF6, 0x6E, 0xBD, 0x70, 0x13, 0xD8, 0xBD, 0xDA, 0x75, 0x80, 0x3D, 0x02, 0x88, 0x38, 0x3D,
 0x2A, 0x16, 0x32, 0x3E, 0x04, 0x68, 0x1F, 0x3E, 0xB8, 0xBC, 0x32, 0x3D, 0x98, 0xB8, 0x22, 0x3E,
 0x6F, 0x35, 0x71, 0x3D, 0x6C, 0xEE, 0x37, 0x3E, 0x07, 0x19, 0x97, 0xBD, 0x10, 0xC4, 0x6F, 0x3D,
 0x55, 0x8E, 0x2F, 0xBE, 0x58, 0x46, 0xD1, 0xBE, 0x53, 0xAA, 0x11, 0x3E, 0x35, 0x18, 0xC7, 0x3D,
 0xAE, 0x0C, 0x1F, 0xBE, 0x84, 0x79, 0xB7, 0x3E, 0x53, 0x7A, 0x29, 0xBE, 0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
 0xF9, 0x1E, 0x8C, 0xBE, 0x50, 0x09, 0xA8, 0xBE, 0x16, 0xA5, 0xC6, 0x3D, 0x92, 0xC3, 0x96, 0xBE,
 0xF2, 0x8E, 0x7F, 0xBE, 0xBC, 0x16, 0xB0, 0x3E, 0xE6, 0x9A, 0x0C, 0xBE, 0xC0, 0x72, 0x74, 0x3E,
 0xE8, 0x13, 0x7C, 0xBE, 0x33, 0x5B, 0x62, 0x3D, 0xDC, 0x65, 0x9C, 0xBE, 0x44, 0x03, 0x8B, 0xBE,
 0x7B, 0x0A, 0xFD, 0x3D, 0x1E, 0x46, 0x3A, 0xBE, 0x1C, 0x9B, 0x3B, 0x3E, 0xB0, 0x29, 0xF3, 0x3D,
 0x5D, 0xC1, 0xBB, 0x3E, 0x5C, 0xAB, 0x70, 0x3E, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
 0x88, 0xBE, 0x74, 0xBC, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0xFE, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00,
 0x07, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
 0x12, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00,
 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00,
 0x01, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00,
 0x01, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00,
 0x1D, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,   
};
void dump(nn_network_t * net)
{
	unsigned int i,
		j;
	char work[40];
	sprintf(work, "NNB: Version: [%d]\n", net->version);
	Serial.print(work);
	sprintf(work, "NNB: Has %d buffers.\n", net->buffers.size);
	Serial.print(work);
	int * list = (int *) NN_GET(net, net->buffers.list);
	for (i = 0; i < net->buffers.size; i++)
	{
		sprintf(work, "NNB: Buffer id:%d size:%d\n", i, * (list + i));
		Serial.print(work);
	}
	sprintf(work, "NNB: Has %d variables.\n", net->variables.size);
	Serial.print(work);
	list = (int *) NN_GET(net, net->variables.list);
	for (i = 0; i < net->variables.size; i++)
	{
		nn_variable_t * var = (nn_variable_t *) (NN_GET(net, * (list + i)));
		sprintf(work, "NNB: Variable id: %d\n", var->id);
		Serial.print(work);
		sprintf(work, "NNB: Variable shape: (");
		Serial.print(work);
		int * shape_list = (int *) NN_GET(net, var->shape.list);
		for (j = 0; j < var->shape.size; j++)
		{
			sprintf(work, " %d", *(shape_list + j));
			Serial.print(work);
		}
		sprintf(work, " )\n");
		Serial.print(work);
		sprintf(work, "NNB: Variable type: %d\n", var->type);
		Serial.print(work);
		sprintf(work, "NNB: Variable fp_pos: %d\n", var->fp_pos);
		Serial.print(work);
		if (var->data_index < 0)
		{
			sprintf(work, "NNB: Variable data_index: Buffer[%d]\n", (-1 * var->data_index) - 1);
			Serial.print(work);
		}
		else
		{
			sprintf(work, "NNB: Variable data_index: %d\n", var->data_index);
			Serial.print(work);
		}
	}
	sprintf(work, "NNB: Has %d functions.\n", net->functions.size);
	Serial.print(work);
	list = (int *) NN_GET(net, net->functions.list);
	sprintf(work, "NNB: Has %d inputs.\n", net->inputs.size);
	Serial.print(work);
	list = (int *) NN_GET(net, net->inputs.list);
	for (i = 0; i < net->inputs.size; i++)
	{
		sprintf(work, "NNB: Input[%d] Variable id:%d\n", i, * (list + i));
		Serial.print(work);
	}
	sprintf(work, "NNB: Has %d outputs.\n", net->outputs.size);
	Serial.print(work);
	list = (int *) NN_GET(net, net->outputs.list);
	for (i = 0; i < net->outputs.size; i++)
	{
		sprintf(work, "NNB: Output[%d] Variable id:%d\n", i, * (list + i));
		Serial.print(work);
	}
}
rt_context_pointer context = 0;
rt_return_value_t ret;
nn_network_t * net;
int i = 0;
void setup()
{
	float input[] = {
		0
	};
	Serial.begin(9600);
	Serial.println("start");
	ret = rt_allocate_context(&context);
	assert(ret == RT_RET_NOERROR);
	Serial.println("ok0");
	net = (nn_network_t *) sin_nnb;
	Serial.println("ok1");
	dump(net);
	ret = rt_initialize_context(context, net);
	assert(ret == RT_RET_NOERROR);
	Serial.println("ok2");
	memcpy(rt_input_buffer(context, 0), input, sizeof(input));
	ret = rt_forward(context);
	Serial.println("0 = ");
	float * probs = (float *) rt_output_buffer(context, 0);
	Serial.println(probs[0]);
	assert(ret == RT_RET_NOERROR);
	Serial.println("ok3");
}
void loop()
{
	float input[] = {
		0
	};
	input[0] = -M_PI + M_PI * 2.0 * i / 50;
	memcpy(rt_input_buffer(context, 0), input, sizeof(input));
	ret = rt_forward(context);
	float * probs = (float *) rt_output_buffer(context, 0);
	Serial.println(probs[0]);
	i++;
	if (i > 50) i = 0;
	delay(300);
}


```


以上。