generateSpectrograms.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:CNNs-Speech-Music-Discrimination 作者: MikeMpapa 项目源码 文件源码
def createSpectrogramFile(x, Fs, fileName, stWin, stStep):
        specgramOr, TimeAxis, FreqAxis = aF.stSpectogram(x, Fs, round(Fs * stWin), round(Fs * stStep), False)            
        print specgramOr.shape
        if inputs[2]=='full':
            print specgramOr
            numpy.save(fileName.replace('.png','')+'_spectrogram', specgramOr)
        else:   
            #specgram = scipy.misc.imresize(specgramOr, float(227.0) / float(specgramOr.shape[0]), interp='bilinear')                        
            specgram = cv2.resize(specgramOr,(227, 227), interpolation = cv2.INTER_LINEAR)
            im1 = Image.fromarray(numpy.uint8(matplotlib.cm.jet(specgram)*255))
            scipy.misc.imsave(fileName, im1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号