This paper refers to the method of using the deep neural long-short-term memory (LSTM) network for the problem of electrocardiogram (ECG) signal classification. ECG signals contain a lot of subtle information analyzed by doctors to determine the type of heart dysfunction. Due to the large number of signal features that are difficult to identify, raw ECG data is usually not suitable for use in machine learning. The article presents how to transform individual ECG time series into spectral images for which two characteristics are determined, which are instantaneous frequency and spectral entropy. Feature extraction consists of converting the ECG signal into a series of spectral images using short-term Fourier transformation. Then the images were converted using Fourier transform again to two signals, which includes instantaneous frequency and spectral entropy. The data set transformed in this way was used to train the LSTM network. During the experiments, the LSTM networks were trained for both raw and spectrally transformed data. Then, the LSTM networks trained in this way were compared with each other. The obtained results prove that the transformation of input signals into images can be an effective method of improving the quality of classifiers based on deep learning.