void DistortCmd(Guid session, string[] args) { string path = string.Empty; int distortions = 0; if (args.Length == 3) { path = args[1]; distortions = int.Parse(args[2]); } else { Console.Write("Target directory or file: "); path = IOConsole.ReadAndParsePath(); Console.Write("How many distortions per image?: "); distortions = int.Parse(Console.ReadLine()); } if (DIO.Directory.Exists(path)) { foreach (string file in DIO.Directory.GetFiles(path)) { Magic.DefaultDistort(file, session, distortions); } } else { Magic.DefaultDistort(path, session, distortions); } }
void EvalCmd(string[] args) { bool isDir = false; string path = string.Empty; string labelsPath = string.Empty; string modelPath = string.Empty; if (args.Length == 3) { path = args[1]; isDir = DIO.Directory.Exists(path); string trainedDir = IOConsole.ParseDir(args[2]); labelsPath = IOConsole.ParseFile($"{trainedDir}/labels.txt"); modelPath = IOConsole.ParseFile($"{trainedDir}/mobile.bytes"); } else if (args.Length == 4) { path = args[1]; isDir = DIO.Directory.Exists(path); labelsPath = IOConsole.ParseFile(args[2]); modelPath = IOConsole.ParseFile(args[3]); } else { Console.Write("Target image: "); path = IOConsole.ReadAndParsePath(); isDir = DIO.Directory.Exists(path); Console.Write("Trained dir: "); string trainedDir = IOConsole.ReadAndParseDir(); labelsPath = IOConsole.ParseFile($"{trainedDir}/labels.txt"); modelPath = IOConsole.ParseFile($"{trainedDir}/mobile.bytes"); } if (isDir) { Eval.EvalDir(path, labelsPath, modelPath); } else { Eval.EvalFile(path, labelsPath, modelPath); } }