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
| mkdir coco | |
| cd coco | |
| mkdir images | |
| cd images | |
| wget http://images.cocodataset.org/zips/train2017.zip | |
| wget http://images.cocodataset.org/zips/val2017.zip | |
| wget http://images.cocodataset.org/zips/test2017.zip | |
| wget http://images.cocodataset.org/zips/unlabeled2017.zip |
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 graphviz import Digraph | |
| import torch | |
| from torch.autograd import Variable, Function | |
| def iter_graph(root, callback): | |
| queue = [root] | |
| seen = set() | |
| while queue: | |
| fn = queue.pop() | |
| if fn in seen: |
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
| # encoding=utf-8 | |
| # Project: learn-pytorch | |
| # Author: xingjunjie github: @gavinxing | |
| # Create Time: 29/07/2017 11:58 AM on PyCharm | |
| # Basic template from http://pytorch.org/tutorials/beginner/nlp/word_embeddings_tutorial.html | |
| import torch | |
| import torch.nn as nn | |
| import torch.autograd as autograd | |
| import torch.optim as optim |
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
| # coding: utf-8 | |
| import logging | |
| import re | |
| from collections import Counter | |
| import numpy as np | |
| import torch | |
| from sklearn.datasets import fetch_20newsgroups | |
| from torch.autograd import Variable |
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 graphviz import Digraph | |
| import torch | |
| from torch.autograd import Variable, Function | |
| def iter_graph(root, callback): | |
| queue = [root] | |
| seen = set() | |
| while queue: | |
| fn = queue.pop() | |
| if fn in seen: |
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 subprocess | |
| import datetime | |
| import numpy as np | |
| THREAD_NUM=4 | |
| def get_video_info(fileloc) : | |
| command = ['ffprobe', | |
| '-v', 'fatal', | |
| '-show_entries', 'stream=width,height,r_frame_rate,duration', |
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 numpy as np | |
| import scipy | |
| import scipy.ndimage | |
| from scipy.ndimage.filters import gaussian_filter | |
| from scipy.ndimage.interpolation import map_coordinates | |
| import collections | |
| from PIL import Image | |
| import numbers | |
| __author__ = "Wei OUYANG" |
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
| #!/bin/bash | |
| # install CUDA Toolkit v8.0 | |
| # instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network)) | |
| CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-1_amd64.deb" | |
| wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG} | |
| sudo dpkg -i ${CUDA_REPO_PKG} | |
| sudo apt-get update | |
| sudo apt-get -y install cuda |
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 numpy as np | |
| from sklearn.model_selection import train_test_split | |
| import torch | |
| import torch.nn as nn | |
| from torch.autograd import Variable | |
| np.random.seed(1337) | |
| MAX_LEN = 30 |
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 os | |
| import torch | |
| import torch.nn as nn | |
| from torch.autograd import Variable | |
| import torchvision.datasets as dset | |
| import torchvision.transforms as transforms | |
| import torch.nn.functional as F | |
| import torch.optim as optim | |
| ## load mnist dataset | |
| use_cuda = torch.cuda.is_available() |
NewerOlder