You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Install Asp.Net Core payload and then follow Installation Instructions here to configure ML5 to use it from C# Blazor app.
API documentation can be followed from here after lib configuration.
.
Sample Neural Network
@page "/nn"
@using BlazorML5@usingBlazorML5.Helpers@inject IJSRuntime runtime
<PageTitle>Index</PageTitle><button @onclick="AddData">Add Data and Train</button>
@code
{
NeuralNetwork _network;protectedoverrideasyncTaskOnInitializedAsync(){awaitMl5.InitAsync(runtime);_network=awaitMl5.NeuralNetworkAsync(newNeuralNetworkOptions(){Task=TaskType.Classification,DataUrl="https://raw.githubusercontent.com/ml5js/ml5-library/main/examples/p5js/NeuralNetwork/NeuralNetwork_color_classifier/data/colorData_small.json",Debug=true,Inputs=newobject[]{"r","g","b"},Outputs=newobject[]{"label"}});_network.OnTraining+=(l,e)=>{Console.WriteLine($"Training: {e}%");};_network.OnTrainingComplete+=async()=>{Console.WriteLine($"Training Complete");await_network.ClassifyMultipleAsync(newobject[]{newobject[]{12,13,14},newobject[]{15,16,17}});};_network.OnDataLoaded+=(e)=>{Console.WriteLine($"Data Loaded");};_network.OnClassify+=async(l,e)=>{Console.WriteLine(e.Length);Console.WriteLine(e[0].Label);};_network.OnClassifyMultiple+=async(l,e)=>{Console.WriteLine(e.Length);Console.WriteLine(e[0].Length);Console.WriteLine(e[0][0].Label);};}asyncvoidAddData(){//data fetched from .csv file no need to manually add and hence directly training //await _network.NormalizeDataAsync();await_network.TrainAsync();}}