generating log mel spectrogram using librosa
The mel spectrogram additionally includes a step of projecting (power of) STFT bins onto Mel-frequency bins via a Mel filterbank; I don't have access to path so I made demo on exponential chirp:

You can visualize the kind of projection taking place by plotting the mel basis:

Note in general the two won't look alike unless filters.mel are carefully selected (nor do they have to).

Code
import numpy as np
import librosa
import librosa.display
import matplotlib.pyplot as plt

def echirp(N, fmin=.1, fmax=None, tmin=0, tmax=1):
    &quot;&quot;&quot;https://overlordgolddragon.github.io/test-signals/ (bottom)&quot;&quot;&quot;
    fmax = fmax or N // 2
    t = np.linspace(tmin, tmax, N)

    a = (fmin**tmax / fmax**tmin) ** (1/(tmax - tmin))
    b = fmax**(1/tmax) * (1/a)**(1/tmax)

    phi = 2*np.pi * (a/np.log(b)) * (b**t - b**tmin)
    return np.cos(phi)

#%%
N = 2**16
n_fft, hop_length, n_mels, sr = 2048, 512, 128, 16384
x = echirp(N)

#%%
mel_spectrogram = librosa.feature.melspectrogram(
    x, sr, n_fft=n_fft, hop_length=hop_length, n_mels=n_mels)
log_mel_spectrogram = librosa.power_to_db(mel_spectrogram)
librosa.display.specshow(log_mel_spectrogram, x_axis=&quot;time&quot;, y_axis=&quot;mel&quot;, sr=sr)
plt.show()

#%%
X = librosa.stft(x, hop_length=hop_length)
mel_basis = librosa.filters.mel(sr, n_fft, n_mels=n_mels)
Xmel = np.dot(mel_basis, abs(X)**2)
Xdb = librosa.power_to_db(Xmel)
librosa.display.specshow(Xdb, x_axis='time', y_axis='hz', sr=sr)
plt.show()

#%%
mel_basis = librosa.filters.mel(sr, n_fft, n_mels=10)
plt.plot(mel_basis.T, color='tab:blue')
kw = dict(weight='bold', fontsize=16, loc='left')
plt.title(&quot;n_mels=10&quot;, **kw)
plt.show()

mel_basis = librosa.filters.mel(sr, n_fft, n_mels=n_mels)
plt.plot(mel_basis.T, color='tab:blue')
kw = dict(weight='bold', fontsize=16, loc='left')
plt.title(&quot;n_mels=%s&quot; % n_mels, **kw)
plt.show()