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
What did you do?
I have read ML.NET and Unity #1886.
I have added all necessary dlls to Assets/Plugin folder. And tested that my model working on data from text file.
Now I want to load data from collection using MLContext.Data.LoadFromEnumerable() function.
What happened?
It works in editor, but in standalone build i get PlutformNotSupported Excepetion.
What did you expect?
Load data without exception.
It works if i set api level to .Net4.x. Thats why it works in editor, but unfortunatly in real project i have to use .netstandard2.0 for my other dependencies.
Source code / logs
Minimal example:
using System.Linq;
using Microsoft.ML;
using UnityEngine;
using Random = UnityEngine.Random;
public class Clusterisator : MonoBehaviour
{
void Start()
{
Calculate();
}
class Point
{
public float X, Y, Z;
}
public static void Calculate()
{
var points = Enumerable.Range(0, 100)
.Select(_ => new Point {X = Random.value, Y = Random.value, Z = Random.value})
.ToList();
var mlContext = new MLContext(seed: 0);
var dataView = mlContext.Data.LoadFromEnumerable(points);
var pipeline = mlContext.Transforms
.Concatenate("Features", "X", "Y", "Z")
.Append(mlContext.Clustering.Trainers.KMeans(numberOfClusters: 5));
var transformed = pipeline.Fit(dataView).Transform(dataView);
var clusterColumn = transformed.Schema.GetColumnOrNull("PredictedLabel").Value;
var cursor = transformed.GetRowCursor(new[] {clusterColumn});
var clusterizatorResult = cursor.GetGetter<uint>(clusterColumn);
while (cursor.MoveNext())
{
uint cluster = 0;
clusterizatorResult(ref cluster);
Debug.Log(cluster);
}
}
}
Exception stack trace:
PlatformNotSupportedException: Operation is not supported on this platform.
at Microsoft.ML.ApiUtils.GeneratePeek[TOwn,TRow,TValue] (System.Reflection.FieldInfo fieldInfo, System.Reflection.Emit.OpCode assignmentOpCode) [0x00040] in <b2a9703d9c7542afbe2c6d1a607e584a>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <a1e9f114a6e64f4eacb529fc802ec93d>:0
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0004b] in <a1e9f114a6e64f4eacb529fc802ec93d>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <a1e9f114a6e64f4eacb529fc802ec93d>:0
at Microsoft.ML.Internal.Utilities.Utils.MarshalInvoke[TArg1,TArg2,TResult] (Microsoft.ML.Internal.Utilities.FuncStaticMethodInfo3`3[T1,T2,TResult] func, System.Type genArg1, System.Type genArg2, System.Type genArg3, TArg1 arg1, TArg2 arg2) [0x0000a] in <52c676b9d07a49dd94084172a2250221>:0
at Microsoft.ML.ApiUtils.GeneratePeek[TOwn,TRow] (Microsoft.ML.Data.InternalSchemaDefinition+Column column) [0x0003a] in <b2a9703d9c7542afbe2c6d1a607e584a>:0
at Microsoft.ML.Data.DataViewConstructionUtils+DataViewBase`1[TRow]..ctor (Microsoft.ML.Runtime.IHostEnvironment env, System.String name, Microsoft.ML.Data.InternalSchemaDefinition schemaDefn) [0x00060] in <b2a9703d9c7542afbe2c6d1a607e584a>:0
at Microsoft.ML.Data.DataViewConstructionUtils+StreamingDataView`1[TRow]..ctor (Microsoft.ML.Runtime.IHostEnvironment env, System.Collections.Generic.IEnumerable`1[T] data, Microsoft.ML.Data.InternalSchemaDefinition schemaDefn) [0x00000] in <b2a9703d9c7542afbe2c6d1a607e584a>:0
at Microsoft.ML.Data.DataViewConstructionUtils.CreateFromEnumerable[TRow] (Microsoft.ML.Runtime.IHostEnvironment env, System.Collections.Generic.IEnumerable`1[T] data, Microsoft.ML.Data.SchemaDefinition schemaDefinition) [0x00026] in <b2a9703d9c7542afbe2c6d1a607e584a>:0
at Microsoft.ML.DataOperationsCatalog.LoadFromEnumerable[TRow] (System.Collections.Generic.IEnumerable`1[T] data, Microsoft.ML.Data.SchemaDefinition schemaDefinition) [0x00011] in <b2a9703d9c7542afbe2c6d1a607e584a>:0
at Clusterisator.Calculate () [0x0003f] in C:\Users\User\RiderProjects\Minimal ML Test\Assets\Clusterisator.cs:25
at Clusterisator.Start () [0x00001] in C:\Users\User\RiderProjects\Minimal ML Test\Assets\Clusterisator.cs:10
System information
Issue
What did you do?
I have read ML.NET and Unity #1886.
I have added all necessary dlls to Assets/Plugin folder. And tested that my model working on data from text file.
Now I want to load data from collection using MLContext.Data.LoadFromEnumerable() function.
What happened?
It works in editor, but in standalone build i get
PlutformNotSupported
Excepetion.What did you expect?
Load data without exception.
It works if i set api level to .Net4.x. Thats why it works in editor, but unfortunatly in real project i have to use .netstandard2.0 for my other dependencies.
Source code / logs
Minimal example:
Exception stack trace:
Minimal Unity project:
Minimal ML Test.zip
The text was updated successfully, but these errors were encountered: