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
mv Day.. day_ # move Day folder to day_ folder | |
# move MTS files to root dir | |
mv ./01/2019/* . | |
# to concate MTS files into MP4 | |
ffmpeg -i "concat:$(echo *.MTS | tr ' ' '|')" -strict -2 concat_out.mp4 |
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.functional as F | |
is_cuda = True | |
input = torch.randn(1, 19, 32, 64, requires_grad=True) | |
target = torch.randint(22, size=(1,32,64,)) | |
print(input.dim()) | |
print("number of out-of-bound targets", (target > 18).sum()) |
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 | |
with torch.autograd.set_detect_anomaly(True): | |
x = torch.randn(5,6, requires_grad=True) | |
z = x.sum(-1) | |
z += z * z | |
z.sum().backward() |
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, torch.nn as nn, torch.nn.functional as F | |
def perform_non_parallelconv(input, convs): | |
outs = [] | |
for i in range(len(convs)): | |
o = convs[i](input[:, i]) | |
outs.append(o) | |
outs = torch.cat(outs, dim=1) | |
return outs |
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 torch.utils.data import DataLoader, Dataset | |
import torch, torch.nn as nn | |
import numpy as np | |
class DS(Dataset): | |
# Constructor | |
def __init__(self): | |
super().__init__() | |
X = list(np.arange(15000)) | |
self.x = X |
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, torch.nn as nn | |
import torch.nn.functional as F | |
import os, sys | |
import copy | |
import torch.optim as optim | |
class ConvReLU(nn.Module): | |
def __init__(self, indim, outdim): | |
super().__init__() | |
self.conv = nn.Conv2d(indim, outdim, kernel_size=1) |
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 get_dataloader_from_pth(path, batch_size=4): | |
contents = torch.load(path) | |
dataset = torch.utils.data.TensorDataset(contents['x'], contents['y']) | |
dataloader = torch.utils.data.DataLoader(dataset, batch_size=batch_size, | |
shuffle=True, num_workers=2) | |
return dataloader | |
#---------------------------------------------------------------------- | |
import os.path as osp |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 imgaug as ia | |
import imgaug.augmenters as iaa | |
print("loaded") | |
prob = 0.5 | |
sometimes = lambda aug: iaa.Sometimes(prob, aug) | |
output_shape=(473,473) | |
seq = iaa.Sequential([ | |
# apply the following augmenters to most images | |
iaa.Fliplr(0.5), | |
sometimes(iaa.Affine( |
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 __future__ import print_function | |
from __future__ import division | |
import torch | |
import torch.nn as nn | |
import torch.optim as optim | |
import numpy as np | |
import torchvision | |
from torchvision import datasets, models, transforms | |
from torch.autograd import Variable | |
import matplotlib.pyplot as plt |