Last active
December 13, 2018 04:54
-
-
Save diaoenmao/a0ec567346e11c1c8329b202c8cc3384 to your computer and use it in GitHub Desktop.
Anomaly Detection for Multimodality Dataset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if __name__ == '__main__': | |
| aligned_cmumosi_highlevel = mmdatasdk.mmdataset('./data/MOSI/deployed') | |
| data_keys = mmdatasdk.dataset.standard_datasets.CMU_MOSI.cmu_mosi_std_folds.standard_train_fold + \ | |
| mmdatasdk.dataset.standard_datasets.CMU_MOSI.cmu_mosi_std_folds.standard_valid_fold + \ | |
| mmdatasdk.dataset.standard_datasets.CMU_MOSI.cmu_mosi_std_folds.standard_test_fold | |
| supported_feature_names = {'covarep':'COVAREP','opensmile':'OpenSmile-emobase2010','facet':'FACET 4.1','glove':'glove_vectors','bert':'BERT embeddings','label':'Opinion Segment Labels'} | |
| data = {k:{} for k in supported_feature_names} | |
| id = {k:[] for k in supported_feature_names} | |
| print('multiple labels keys') | |
| for k in supported_feature_names: | |
| exec('{} = aligned_cmumosi_highlevel.computational_sequences[\'{}\'].data'.format(k,supported_feature_names[k])) | |
| exec('for m in {0}:\n'.format(k) + | |
| ' tmp_data = {0}[m][\'features\'][:]\n'.format(k) + | |
| ' tmp_data[tmp_data == -np.inf] = 0\n' + | |
| ' if(k==\'label\'):\n' + | |
| ' if(tmp_data.shape[0]>1):\n' + | |
| ' print(m,k,tmp_data.shape)\n' + | |
| ' tmp_data = tmp_data.item(0)\n' + | |
| ' else:\n' + | |
| ' tmp_data = tmp_data.astype(np.float32)\n' + | |
| ' if(m[:m.index(\'[\')] in data_keys):\n' + | |
| ' data[\'{0}\'][m] = tmp_data\n'.format(k) + | |
| ' id[\'{0}\'].append(m)\n'.format(k)) | |
| print('non-aligned keys') | |
| for idx in sorted(id['label']): | |
| pivot = data['covarep'][idx] | |
| for k in supported_feature_names: | |
| if(k != 'label' and k != 'bert'): | |
| if(pivot.shape[0] != data[k][idx].shape[0]): | |
| print(idx,'covarep',pivot.shape,k,data[k][idx].shape) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment