Analytics

Holoscan v2.1.0

The new Data Exporter C++ API (DataExporter and CsvDataExporter) is now available. This API can be used to export output from Holoscan applications to comma separated value (CSV) files for Holoscan Federated Analytics applications. DataExporter is a base class to support exporting Holoscan application output in different formats. CsvDataExporter is a class derived from DataExporter to support exporting Holoscan application output to CSV files.

The data root directory can be specified using the environment variable HOLOSCAN_ANALYTICS_DATA_DIRECTORY. If not specified, it defaults to the current directory. The data file name can be specified using the environment variable HOLOSCAN_ANALYTICS_DATA_FILE_NAME. If not specified, it defaults to the name data.csv. All the generated data will be stored inside a directory with the same name as the application name that is passed to the DataExporter constructor. On each run, a new directory inside the <root_dir>\<app_dir>\ will be created and a new data file will be created inside it. Each new data directory will be named with the current timestamp. This timestamp convention prevents a given run of the application from overwriting any data stored previously by an earlier run of that same application.

Sample usage of the API

Copy
Copied!
            

// Include Header #include <holoscan/core/analytics/csv_data_exporter.hpp> // Define CsvDataExporter member variable CsvDataExporter exporter // Initialize CsvDataExporter exporter("app_name", std::vector<std::string>({"column1", "column2", "column3"})) // Export data (typically called within an Operator::compute method) exporter.export_data(std::vector<std::string>({"value1", "value2", "value3"}))

The Holoscan applications like Endoscopy Out of Body Detection uses Inference Processor operator (InferenceProcessorOp) to output the binary classification results. The DataProcessor class used by the inference processor operator (InferenceProcessorOp) is now updated to support writing output to CSV files which can then be used as input to analytics applications. Also any other application using InferenceProcessorOp can now export the binary classification output to the CSV files.

Below is an example application config using the new export operation:

Copy
Copied!
            

inference_processor_op: process_operations: "out_of_body_inferred": ["export_results_to_csv, out_of_body_detection, In-body, Out-of-body, ConfidenceScore"] in_tensor_names: ["out_of_body_inferred"]

This will create a folder named out_of_body_detection in the specified root directory, creates another folder inside it with current timestamp on each run, and creates a .csv file with specified name and three columns - In-body, Out-of-body, and Confidence Score. The lines in the data.csv file will look like:

Copy
Copied!
            

In-body,Out-of-body,Confidence Score 1,0,0.972435 1,0,0.90207 1,0,0.897973 0,1,0.939281 0,1,0.948691 0,1,0.94994

Previous Resources
Next Holoscan C++ API
© Copyright 2022-2024, NVIDIA. Last updated on Jun 17, 2024.