https://gist.github.com/victor-shepardson/5b3d3087dc2b4817b9bffdb8e87a57c4
I'm using Ubuntu 16.04 with a GTX 1060
https://gist.github.com/victor-shepardson/5b3d3087dc2b4817b9bffdb8e87a57c4
I'm using Ubuntu 16.04 with a GTX 1060
from contextlib import contextmanager | |
import numpy as np | |
import torch | |
from torch import Tensor, ByteTensor | |
import torch.nn.functional as F | |
from torch.autograd import Variable | |
import pycuda.driver | |
from pycuda.gl import graphics_map_flags | |
from glumpy import app, gloo, gl |
import torch | |
from torch.autograd import Variable | |
import torch.nn as nn | |
class Bottleneck(nn.Module): | |
cardinality = 32 # the size of the set of transformations | |
def __init__(self, nb_channels_in, nb_channels, nb_channels_out, stride=1): | |
super().__init__() |
from keras import layers | |
from keras import models | |
import tensorflow as tf | |
# | |
# generator input params | |
# | |
rand_dim = (1, 1, 2048) # dimension of the generator's input tensor (gaussian noise) |
# http://www.nvidia.com/download/driverResults.aspx/117079/en-us | |
wget http://us.download.nvidia.com/tesla/375.51/nvidia-driver-local-repo-ubuntu1604_375.51-1_amd64.deb | |
sudo dpkg -i nvidia-driver-local-repo-ubuntu1604_375.51-1_amd64.deb | |
sudo apt-get update | |
sudo apt-get -y install cuda-drivers | |
echo "Reboot required." |
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() |
# from: http://blender.stackexchange.com/questions/40650/blender-camera-from-3x4-matrix?rq=1 | |
# And: http://blender.stackexchange.com/questions/38009/3x4-camera-matrix-from-blender-camera | |
# Input: P 3x4 numpy matrix | |
# Output: K, R, T such that P = K*[R | T], det(R) positive and K has positive diagonal | |
# | |
# Reference implementations: | |
# - Oxford's visual geometry group matlab toolbox | |
# - Scilab Image Processing toolbox |
import torch | |
from torch.autograd import Variable | |
import torch.nn as nn | |
import numpy as np | |
import torch.optim as optim | |
import torch.nn.functional as F | |
import time | |
from torchvision.models import vgg | |
# Initialize network |