/// <summary> /// Classify an image, using a model /// </summary> /// <param name="image">image (jpeg) file to be analyzed</param> /// <param name="model">model used for classification</param> /// <returns>image related labels</returns> public async Task <IEnumerable <string> > ClassifyImageAsync(byte[] image, Approaches approach = Approaches.Default) { var classification = await models[approach == Approaches.Default ? defaultModel : approach].ClassifyImageAsync(image); return(classification.OrderByDescending(c => c.Probability) .Select(c => c.Label)); }
public List <Detector> GetDetectorsForSignal() { var detectors = new List <Detector>(); foreach (var a in Approaches.OrderBy(a => a.ProtectedPhaseNumber)) { foreach (var d in a.Detectors) { detectors.Add(d); } } return(detectors.OrderBy(d => d.DetectorID).ToList()); }
private bool CompareSignalProperties(Signal signalToCompare) { if (signalToCompare != null && SignalID == signalToCompare.SignalID && PrimaryName == signalToCompare.PrimaryName && SecondaryName == signalToCompare.SecondaryName && IPAddress == signalToCompare.IPAddress && Latitude == signalToCompare.Latitude && Longitude == signalToCompare.Longitude && RegionID == signalToCompare.RegionID && ControllerTypeID == signalToCompare.ControllerTypeID && Enabled == signalToCompare.Enabled && Approaches.Count() == signalToCompare.Approaches.Count() ) { return(true); } return(false); }
public TensorFlowPredictionStrategy(AppSettings settings, IHostingEnvironment environment) { object parseDefaultModel; defaultModel = (Enum.TryParse(typeof(Approaches), settings.TensorFlowPredictionDefaultModel, ignoreCase: true, result: out parseDefaultModel)) ? (Approaches)parseDefaultModel : Approaches.Default; if (defaultModel == Approaches.Default) { defaultModel = Approaches.TensorFlowPreTrained; } models = new Dictionary <Approaches, IClassifier> { { Approaches.TensorFlowPreTrained, new TensorFlowInceptionPrediction(settings, environment) }, { Approaches.TensorFlowCustom, new TensorFlowModelPrediction(settings, environment) } }; }
public VisionStrategy(IOptionsSnapshot <AppSettings> settings, IHostingEnvironment environment, IComputerVisionClient computerVisionClient, ICustomVisionClient customVisionClient, ILoggerFactory loggerFactory) { object parseDefaultModel; defaultModel = (Enum.TryParse(typeof(Approaches), settings.Value.CognitiveServicesPredictionDefaultModel, ignoreCase: true, result: out parseDefaultModel)) ? (Approaches)parseDefaultModel : Approaches.Default; if (defaultModel == Approaches.Default) { defaultModel = Approaches.ComputerVision; } models = new Dictionary <Approaches, IClassifier> { { Approaches.ComputerVision, new ComputerVisionPrediction(settings, computerVisionClient) }, { Approaches.CustomVisionOffline, new CustomVisionOfflinePrediction(settings, environment, loggerFactory.CreateLogger <CustomVisionOfflinePrediction>()) }, { Approaches.CustomVisionOnline, new CustomVisionOnlinePrediction(settings, customVisionClient) } }; }
public void AdvanceDialogue() // call in character script { if (timer <= 0) // if clicking cd is finished { if (index < currentDialogue.Count - 1) { index++; // add one to index } else // if dialogue is finished { index = 0; // reset index to the start of the dialogue GiveCard(); // give player the card this approach gives if (GameManager.me.player == null) // if there is no player, make one { GameManager.me.player = Instantiate(GameManager.me.playerPrefab); } myApproach = Approaches.na; // set my approach } timer = interval; // reset timer } }
public List <DirectionType> GetAvailableDirections() { var directions = Approaches.Select(a => a.DirectionType).Distinct().ToList(); return(directions); }