Click here to Skip to main content
15,906,463 members
Home / Discussions / C#
   

C#

 
GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Richard Deeming14-Jul-21 4:48
mveRichard Deeming14-Jul-21 4:48 
GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Maximilien14-Jul-21 9:35
Maximilien14-Jul-21 9:35 
GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Richard Deeming14-Jul-21 21:32
mveRichard Deeming14-Jul-21 21:32 
GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Maximilien15-Jul-21 1:11
Maximilien15-Jul-21 1:11 
AnswerRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Gerry Schmitz14-Jul-21 5:20
mveGerry Schmitz14-Jul-21 5:20 
QuestionN-Tier best practices when using in MVC application Pin
Member 949196213-Jul-21 13:33
Member 949196213-Jul-21 13:33 
AnswerRe: N-Tier best practices when using in MVC application Pin
Gerry Schmitz14-Jul-21 5:14
mveGerry Schmitz14-Jul-21 5:14 
QuestionExperiencing Memory Leak and unable to Handle it with GC.Collect() Pin
rahulgorai13-Jul-21 7:35
rahulgorai13-Jul-21 7:35 
C#
using Microsoft.ML;
using Microsoft.ML.Data;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;

namespace MLModelx_ConsoleApp1
{
    public partial class MLModelx
    {
        /// <summary>
        /// model input class for MLModelx.
        /// </summary>
        #region model input class
        public class ModelInput
        {
            [ColumnName(@"Label")]
            public string Label { get; set; }

            [ColumnName(@"ImageSource")]
            public string ImageSource { get; set; }

        }

        #endregion

        /// <summary>
        /// model output class for MLModelx.
        /// </summary>
        #region model output class
        public class ModelOutput
        {
            [ColumnName("PredictedLabel")]
            public string Prediction { get; set; }

            public float[] Score { get; set; }
        }

        #endregion

        private static string MLNetModelPath = Path.GetFullPath("MLModelx.zip");
        bool disposed = false;
        /// <summary>
        /// Use this method to predict on <see cref="ModelInput"/>.
        /// </summary>
        /// <param name="input">model input.</param>
        /// <returns><seealso cref=" ModelOutput"/></returns>
        public static ModelOutput Predict(ModelInput input)
        {
            MLContext mlContext = new MLContext();

            // Load model & create prediction engine
            ITransformer mlModel = mlContext.Model.Load(MLNetModelPath, out var modelInputSchema);
            var predEngine = mlContext.Model.CreatePredictionEngine<ModelInput, ModelOutput>(mlModel);

            ModelOutput result = predEngine.Predict(input);
            return result;
        }
        public void Dispose()
        {
            Dispose1(true);
            GC.SuppressFinalize(this);
        }
        protected virtual void Dispose1(bool disposing)
        {
            if (disposed)
                return;

            if (disposing)
            {
                // Free any other managed objects here.
                //
            }

            // Free any unmanaged objects here.
            //
            disposed = true;
        }

        ~MLModelx()
        {
            Dispose1(false);
        }
    }
}

AnswerRe: Experiencing Memory Leak and unable to Handle it with GC.Collect() Pin
Dave Kreskowiak13-Jul-21 9:41
mveDave Kreskowiak13-Jul-21 9:41 
GeneralRe: Experiencing Memory Leak and unable to Handle it with GC.Collect() Pin
rahulgorai14-Jul-21 2:03
rahulgorai14-Jul-21 2:03 
GeneralRe: Experiencing Memory Leak and unable to Handle it with GC.Collect() Pin
Dave Kreskowiak14-Jul-21 4:16
mveDave Kreskowiak14-Jul-21 4:16 
GeneralRe: Experiencing Memory Leak and unable to Handle it with GC.Collect() Pin
jschell17-Jul-21 10:37
jschell17-Jul-21 10:37 
Question.Tag File Pin
f6112-Jul-21 19:44
f6112-Jul-21 19:44 
AnswerRe: .Tag File Pin
Victor Nijegorodov12-Jul-21 20:38
Victor Nijegorodov12-Jul-21 20:38 
AnswerRe: .Tag File Pin
Ralf Meier12-Jul-21 20:56
mveRalf Meier12-Jul-21 20:56 
AnswerRe: .Tag File Pin
OriginalGriff12-Jul-21 21:18
mveOriginalGriff12-Jul-21 21:18 
AnswerRe: .Tag File Pin
Eddy Vluggen13-Jul-21 0:18
professionalEddy Vluggen13-Jul-21 0:18 
GeneralRe: .Tag File Pin
harold aptroot13-Jul-21 7:45
harold aptroot13-Jul-21 7:45 
AnswerRe: .Tag File Pin
Dave Kreskowiak15-Jul-21 8:25
mveDave Kreskowiak15-Jul-21 8:25 
Questionusing all drives Pin
Mr Shah 411-Jul-21 0:39
Mr Shah 411-Jul-21 0:39 
AnswerRe: using all drives Pin
OriginalGriff11-Jul-21 1:23
mveOriginalGriff11-Jul-21 1:23 
GeneralRe: using all drives Pin
Mr Shah 411-Jul-21 1:33
Mr Shah 411-Jul-21 1:33 
GeneralRe: using all drives Pin
OriginalGriff11-Jul-21 1:40
mveOriginalGriff11-Jul-21 1:40 
GeneralRe: using all drives Pin
Mr Shah 411-Jul-21 1:45
Mr Shah 411-Jul-21 1:45 
GeneralRe: using all drives Pin
OriginalGriff11-Jul-21 1:51
mveOriginalGriff11-Jul-21 1:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.