private void ButtonToClick_Click(object sender, RoutedEventArgs e)
        {
            FileInfo model       = new FileInfo("Assets\\Model\\itracker.onnx");
            FileInfo inputFrame  = new FileInfo("Assets\\Frames\\00000.jpg");
            FileInfo datasetPath = null;

            ITrackerPredictionEngine.InitializePredictionEngine(model?.FullName);

            if (!string.IsNullOrEmpty(inputFrame?.FullName))
            {
                var prediction = RunPredictionOnImage(inputFrame?.FullName);
                Console.WriteLine($"{inputFrame?.FullName} ({prediction.Item1}, {prediction.Item2})");
            }
            else
            {
                var dataset_base_path = datasetPath?.FullName;

                var recording_sessions = Directory.GetDirectories(dataset_base_path);

                foreach (var session in recording_sessions)
                {
                    var session_path        = Path.Combine(dataset_base_path, session);
                    var session_frames_path = Path.Combine(session_path, "frames");

                    var frames = Directory.GetFiles(session_frames_path, "*.jpg");

                    foreach (var frame in frames)
                    {
                        var frame_path = Path.Combine(session_path, frame);

                        var prediction = RunPredictionOnImage(frame_path);
                        Console.WriteLine($"{frame} ({prediction.Item1}, {prediction.Item2})");
                    }
                }
            }
        }
Beispiel #2
0
        static void Main(
            FileInfo inputFrame,
            FileInfo model,
            FileInfo datasetPath)
        {
            ITrackerPredictionEngine.InitializePredictionEngine(model?.FullName);

            if (!string.IsNullOrEmpty(inputFrame?.FullName))
            {
                var prediction = RunPredictionOnImage(inputFrame?.FullName);

                Console.WriteLine($"{inputFrame?.FullName} ({prediction.Item1}, {prediction.Item2})");
            }
            else
            {
                var dataset_base_path = datasetPath?.FullName;

                var recording_sessions = Directory.GetDirectories(dataset_base_path);

                foreach (var session in recording_sessions)
                {
                    var session_path        = Path.Combine(dataset_base_path, session);
                    var session_frames_path = Path.Combine(session_path, "frames");

                    var frames = Directory.GetFiles(session_frames_path, "*.jpg");

                    foreach (var frame in frames)
                    {
                        var frame_path = Path.Combine(session_path, frame);

                        var prediction = RunPredictionOnImage(frame_path);
                        Console.WriteLine($"{frame} ({prediction.Item1}, {prediction.Item2})");
                    }
                }
            }
        }