/// <summary> /// Predict gender/age for all faces which were detected. /// </summary> /// <param name="faceLocs"> /// Locations of all detected faces. /// </param> /// <param name="faces"> /// Data of all detected faces. /// </param> /// <returns> /// A list of Result object, /// each one is the position and predicted result of a face. /// </returns> protected List <Result> Fit(List <Location> faceLocs, List <byte[]> faces) { int[] shape = { 1, // We will perform tensor stacking inside CreateTensor function Height, Width, Depth }; // Convert faces' data into one tensor var inputs = TensorUtils.CreateTensor(faces, shape); // Normalize input tensor before passing to tensorflow model. // This could sustainably increase model's accuracy if (Preprocessors != null) { foreach (var preprocessor in Preprocessors) { inputs = preprocessor.Process(inputs); } } return(Fit(faceLocs, inputs)); }