Exemplo n.º 1
0
"""!
@brief Example 18
@details: Video feature extraction example
@author Theodoros Giannakopoulos {[email protected]}
"""
import video_features as vf

v = vf.VideoFeatureExtractor(["flow"], resize_width=300, step=0.25)
f, t, fn = v.extract_features("f1.mkv")
print(f.shape)
print(t.shape)
print(len(fn))
Exemplo n.º 2
0
for i in range(0,len(playlist['items'])):
	name = re.sub(' [\{\(\[].*?[\)\}\]]', '', playlist['items'][i]['playlist_meta']['title'])
	filename = re.sub("[,.!?'|&]", '', name).replace(' ', '_')
	[s, Fs] = librosa.load("audio/"+filename+".wav")
	mfccs = np.transpose(librosa.feature.mfcc(y=s,sr=Fs,n_mfcc=13))
	deltas = librosa.feature.delta(mfccs)
	deltadeltas = librosa.feature.delta(deltas)
	feats[i,0:12] = np.mean(mfccs)
	feats[i,13:25] = np.var(mfccs)
	feats[i,26:38] = np.mean(deltas)
	feats[i,39:51] = np.var(deltas)
	feats[i,52:64] = np.mean(deltadeltas)
	feats[i,65:77] = np.var(deltadeltas)

plt.figure(figsize=(10, 4))
librosa.display.specshow(mfccs, x_axis='time')
plt.colorbar()
plt.title('MFCC')
plt.tight_layout()

# Video Feature Extraction
for i in range(0,len(playlist['items'])):
	name = re.sub(' [\{\(\[].*?[\)\}\]]', '', playlist['items'][i]['playlist_meta']['title'])
	filename = re.sub("[,.!?'|&]", '', name).replace(' ', '_')
	v = vf.VideoFeatureExtractor(["colors", "lbps", "hog","flow"], resize_width=300, step = 0.25)
	f, t, fn = v.extract_features("videos/"+filename+".mkv")

print(f.shape)
print(t.shape)
print(len(fn))
Exemplo n.º 3
0
    #print(beat_times)

    if i == 0:
        plt.figure(figsize=(15, 5))
        librosa.display.waveplot(s[0:120000])
        plt.vlines(beat_times[0:16], -1, 1, color='r')
        plt.ylim(-1, 1)
        plt.title('Beat Tracking')
        plt.tight_layout()

# Video Feature Extraction
for i in range(0, 1):
    name = re.sub(' [\{\(\[].*?[\)\}\]]', '',
                  playlist['items'][i]['playlist_meta']['title'])
    filename = re.sub("[,.!?'|&]", '', name).replace(' ', '_')
    v = vf.VideoFeatureExtractor(["hogs"], resize_width=300, step=0.25)
    f, t, fn = v.extract_features("music_videos/" + filename + ".mp4")

print(f.shape)
print(t.shape)
print(len(fn))

for i in range(0, len(playlist['items'])):
    name = re.sub(' [\{\(\[].*?[\)\}\]]', '',
                  playlist['items'][i]['playlist_meta']['title'])
    filename = re.sub("[,.!?'|&]", '', name).replace(' ', '_')
    v = vf.VideoFeatureExtractor(["colors"], resize_width=300, step=0.25)
    f, t, fn = v.extract_features("music_videos/" + filename + ".mp4")

print(f.shape)
print(t.shape)