%% Inference Section
% Given an unknown input signal, this function converts the signal to time-frequency representation first and then proceeds to predict the modulation type of the signal using the Deep Learning model trained earlier

function predClassProb = modelPredictModType(inputSig) %#codegen
% This function is only intended to support wavelet deep learning examples.
% It may change or be removed in a future release.
coder.gpu.kernelfun();
% input signal size is 1024-by-2

% parameters
ModelFile = 'mdwv_model.mat'; % file that saves the neural network model
imSize = [227 227]; % Size of the input image for the deep learning network

%Function to converts signal to wavelet time-frequency image
im = cwtModType(inputSig, imSize);

%Load the trained deep learning network
persistent model;
if isempty(model)
    model = coder.loadDeepLearningNetwork(ModelFile, 'mynet');
end

% Predict the Signal Modulation
predClassProb = model.predict(im);
end