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
| # Resume | |
| git clone https://github.com/Collaborative-AI/colda.git | |
| cd colda | |
| # Init | |
| git commit --allow-empty -m "Initial dummy commit" | |
| # Merge for package | |
| git remote add --fetch package https://github.com/Collaborative-AI/Package.git | |
| git merge package/main --allow-unrelated-histories |
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
| from PIL import Image | |
| from argparse import ArgumentParser | |
| import os | |
| from multiprocessing import Pool | |
| alg_dict = { | |
| 'lanczos': Image.LANCZOS, | |
| 'nearest': Image.NEAREST, | |
| 'bilinear': Image.BILINEAR, | |
| 'bicubic': Image.BICUBIC, |
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
| # Instructions can be found at https://github.com/willylulu/celeba-hq-modified and https://zhuanlan.zhihu.com/p/52188519 | |
| import os | |
| import sys | |
| import io | |
| import glob | |
| import pickle | |
| import argparse | |
| import threading | |
| import queue |
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: |
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
| def extract_patches_2d(img,patch_shape,step=[1.0,1.0],batch_first=False): | |
| patch_H, patch_W = patch_shape[0], patch_shape[1] | |
| if(img.size(2)<patch_H): | |
| num_padded_H_Top = (patch_H - img.size(2))//2 | |
| num_padded_H_Bottom = patch_H - img.size(2) - num_padded_H_Top | |
| padding_H = nn.ConstantPad2d((0,0,num_padded_H_Top,num_padded_H_Bottom),0) | |
| img = padding_H(img) | |
| if(img.size(3)<patch_W): | |
| num_padded_W_Left = (patch_W - img.size(3))//2 | |
| num_padded_W_Right = patch_W - img.size(3) - num_padded_W_Left |
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
| import torch | |
| import torch.nn as nn | |
| import torch.optim as optim | |
| import torch.nn.functional as F | |
| torch.manual_seed(2809) | |
| def check_params(modelA, modelB): |