SciSharp / SiaNet

An easy to use C# deep learning library with CUDA/OpenCL support
https://scisharp.github.io/SiaNet
MIT License
380 stars 83 forks source link

InvalidCastException #13

Closed ZhangFinder closed 6 years ago

ZhangFinder commented 6 years ago

1; class Sequential : Evaluate(Value data) , 2 class DataFrameTrainPredict: Evaluate(object testData) Sequential .Evaluate invokes DataFrameTrainPredict.Evaluate,and in DataFrameTrainPredict.Evaluate there are "DataFrame data = (DataFrame)testData;" , so it is a InvalidCastException when Value is Cast into DataFrame.

deepakkumar1984 commented 6 years ago

I have checked in the fix. Could you please take latest and try again.

ZhangFinder commented 6 years ago

You have changed "Sequential . Evaluate(Value data)" into "Sequential .Evaluate(DataFrame data)" , Have you considered about "ImgGenTrainPredict.Evaluate(object testData)"? In "ImgGenTrainPredict.Evaluate(object testData)" ,there is "Value data = (Value)testData;" ,and "ImgGenTrainPredict.Evaluate" may also be invoked by "Sequential . Evaluate"

deepakkumar1984 commented 6 years ago

I am working on standardizing the dataframe. There is another ImageDataFrame which is inherited from the XYFrame class but its not completed yet. If we need to predict with images please wait this week for me to complete the code and test it out. I will setup some examples for you on how to use it.

deepakkumar1984 commented 6 years ago

I have updated the DataFrame with another method. I will improve it later. Here is the example

DataFrame predictData = new DataFrame(); predictData.LoadImage("[image path]", Tuple.Create(32, 32));

var result = model.Evaluate(predictData);

Please try if it works for you

ZhangFinder commented 6 years ago

Thank you