목록Project (27)
UOMOP
def dtw_score(song1, song1_plag_area, song2, song2_plag_area, sr, rand_num) : # 나중에 모드를 여러개 정해보자. # 만약 random이면 비교대상이 random이고, window면 주기적으로 window를 내는 방식이다. song1_ext = np.array(extractor(song1, song1_plag_area, sr = sr)) song2_ext = np.array(extractor(song2, song2_plag_area, sr = sr)) #================================song1의 난수 생성================================ song1_start = int(song1_plag_ar..
librosa에서 제공하는 beat_track 등을 이용해서 tempo(bpm)을 구하면 정확성이 많이 떨어진다. 직접 음원의 Feature들을 추출해보고 tempo(bpm)에 영향을 많이 주는 Feature를 찾아보자. # ========================= 라이브러리 호출 ========================= import numpy as np import pandas as pd import librosa import joblib import matplotlib.pyplot as plt import IPython.display as ipd import seaborn as sns from sklearn import metrics from xgboost import plot_import..
def extractor(A, area, sr) : # area = 01:31.5 ~ 02:18.3 area = str(area) start = int(area[0]) * 600 + int(area[1]) * 60 + int(area[3]) * 10 + int(area[4]) * 1 + int(area[6]) /10 end = int(area[10]) * 600 + int(area[11]) * 60 + int(area[13]) * 10 + int(area[14]) * 1 + int(area[16]) /10 A_cut = A[int(start * sr) : int(end * sr)] return A_cut def chroma_score(song1, song1_plag_area, song2, song2_pl..
import numpy as np import pandas as pd import librosa import joblib import matplotlib.pyplot as plt import IPython.display as ipd from xgboost import plot_importance from sklearn import preprocessing from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.metrics import accuracy_score from lightgbm import LGBMClassifier def check_genre(s..
def check_genre(song, sr, model) : col_names = ['chroma_stft_mean', 'chroma_stft_var','rms_mean','rms_var', 'spectral_centroid_mean', 'spectral_centroid_var','spectral_bandwidth_mean', 'spectral_bandwidth_var', 'rolloff_mean', 'rolloff_var', 'zero_crossing_rate_mean', 'zero_crossing_rate_var', 'harmony_mean', 'harmony_var', 'perceptr_mean', 'perceptr_var', 'tempo', 'mfcc1_mean', 'mfcc1_var', 'mf..
pip install joblib from xgboost import XGBClassifier from xgboost import plot_importance from sklearn import preprocessing from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.metrics import accuracy_score from sklearn.model_selection import GridSearchCV import joblib data = pd.read_csv("features_3_sec.csv"); X = data.drop("label", ax..