Skip to content

Instantly share code, notes, and snippets.

require 'cutorch'
require 'cunn'
-- problem appears with two or more layers
model = nn.Sequential()
model:add( nn.SpatialConvolution(1,10,3,3) )
model:add( nn.SpatialConvolution(10,20,3,3) )
model:cuda()
print( 'This works' )
@etrulls
etrulls / mwe.lua
Created September 23, 2015 09:05
mwe depthconcat
require 'cutorch'
require 'cunn'
require 'cudnn'
torch.setnumthreads(1)
cutorch.setDevice(1)
torch.setdefaulttensortype('torch.FloatTensor')
-- model
c1 = nn.Sequential()
| 27% 32C P8 27W / 189W | 15MiB / 6143MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
| 5 GeForce GTX TIT... Off | 0000:89:00.0 Off | N/A |
| 27% 33C P8 32W / 189W | 15MiB / 6143MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
| 6 GeForce GTX TIT... Off | 0000:8F:00.0 Off | N/A |
| 42% 66C P2 123W / 189W | 3589MiB / 6143MiB | 99% Default |
+-------------------------------+----------------------+----------------------+
| 7 GeForce GTX TIT... Off | 0000:90:00.0 Off | N/A |
| 52% 79C P2 106W / 189W | 3340MiB / 6143MiB | 0% Default |
@etrulls
etrulls / common.lua
Created December 7, 2015 10:58
26killer
require 'lfs'
require 'xlua'
-- color output
colors = require 'ansicolors'
COL_LIGHTRED = '%{bright red}'
COL_DARKRED = '%{reset red}'
COL_LIGHTGREEN = '%{bright green}'
COL_DARKGREEN = '%{reset green}'
COL_LIGHTYELLOW = '%{bright yellow}'
/cvlabdata1/home/eduard/soft/torch/torch-distro-icc/install/bin/luajit: .../torch-distro-icc/install/share/lua/5.1/nn/Container.lua:67:
In 1 module of nn.Sequential:
In 2 module of nn.ParallelTable:
In 4 module of nn.Sequential:
In 2 module of nn.Sequential:
...torch/torch-distro-icc/install/share/lua/5.1/nn/THNN.lua:110: bad argument #5 to 'v' (2D or 4D weight tensor expected, but got: [] at /cvlabdata1/home/eduard/soft/torch/torch-distro-icc/extra/nn/lib/THNN/generic/SpatialConvolutionMM.c:15)
stack traceback:
[C]: in function 'v'
...torch/torch-distro-icc/install/share/lua/5.1/nn/THNN.lua:110: in function 'SpatialConvolutionMM_updateOutput'
...stro-icc/install/share/lua/5.1/nn/SpatialConvolution.lua:79: in function <...stro-icc/install/share/lua/5.1/nn/SpatialConvolution.lua:76>
require 'nn'
require 'image'
desc = nn.Sequential()
desc:add( nn.SpatialConvolution( 1, 10, 3, 3, 1, 1 ) )
desc:add( nn.Tanh() )
desc:add( nn.SpatialLPPooling( 10, 2, 2, 2 ) )
desc:add( nn.SpatialSubtractiveNormalization( 10, image.gaussian(5) ) )
desc:add( nn.View( 10, -1 ) )
def exhaustive(v):
n = len(v)
best = [None, None]
max_sum = 1e-9
for i in range(n):
for j in range(i + 1, n):
if sum(v[i:j + 1]) > max_sum:
max_sum = sum(v[i:j + 1])
best = [i, j + 1]
@etrulls
etrulls / tracks.py
Created February 5, 2019 19:59
Compute track length
import numpy as np
from colmap.scripts.python.read_model import read_model, qvec2rotmat
from colmap.scripts.python.read_dense import read_array
from imageio import imread
import matplotlib.pyplot as plt
import deepdish as dd
import h5py
import matplotlib.patches as patches
from time import time
from glob import glob
import os
import sys
gpu = sys.argv[1]
seqs = sys.argv[2].split(',')
for i, seq in enumerate(seqs):
src = '/cvlabdata1/cvlab/datasets_eduard/colmap'
files = glob(f'{src}/{seq}/dense/images/*.jpg')
diff --git a/src/compute_inliers_opt.py b/src/compute_inliers_opt.py
index 062c248..aca21e8 100644
--- a/src/compute_inliers_opt.py
+++ b/src/compute_inliers_opt.py
@@ -8,6 +8,7 @@ from utils import loadh5
import cv2
import glob
from IPython import embed
+import os