airpack_scripts.pytorch.run_inference

Module Contents

airpack_scripts.pytorch.run_inference.get_file_pars(filename)

File names are of the format: key0=val0_key1=val1_key2=val2.bin so that we can easily parse the file name to get the file parameters, e.g., snr=10. This will allow us to only plot the desired SNR values.

Parameters

filename (Union[get_file_pars.str, os.PathLike]) – filename string to parse

Returns

Dictionary of file parameters

Return type

Dict[get_file_pars.str, Any]

airpack_scripts.pytorch.run_inference.setup_inference_function(saver_path, file_name='saved_model.onnx')

Sets up a tensorflow session from an onnx file to perform inference saved_model :param saver_path: Path to onnx file :param file_name: onnx file name :return: Callable inference function

Parameters
  • saver_path (pathlib.Path) –

  • file_name (str) –

Return type

Callable[[numpy.ndarray], List[float]]

airpack_scripts.pytorch.run_inference.infer(data_folder, plot_snr=12, fs=31250000.0)

This script will re-initialize a trained PyTorch model for inference. It will look through the test_data_folder and find one signal file for each label and for the SNR value defined by plot_snr.

Note

For the provided data set, plot_snr may range from -5 to 20 dB and the accuracy of the trained model may be shown to go down as the SNR is decreased.

Parameters
  • data_folder (Union[str, os.PathLike]) – Location of data

  • plot_snr (int) – Define desired SNR to plot

  • fs (float) – Define sample rate

Returns

Inference results

Return type

List[float]