This file contains 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 | |
DIR1=$(pwd) | |
MAINDIR=$(pwd)/3rdparty | |
mkdir ${MAINDIR} | |
cd ${MAINDIR} | |
conda create -y -n "NavAgents" python=3.6 | |
source activate NavAgents | |
conda install opencv -y | |
conda install pytorch torchvision -c pytorch -y |
This file contains 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
#include <opencv2/core.hpp> | |
int main(int argc, char** argv) { | |
double x[117][43] = {{-890.2075142966416, -91.49514585853208, -1519.470669123981, -4378.297874749891, 288.75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},{ | |
328.0247571268432, -1514.656408530106, -525.5454067319092, -4091.284249468227, 841.8749389648438, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},{ | |
0.4572510884940519, -0.04269169026717295, -0.8883123671621016, -4.565511104557279, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},{ | |
-774.7308902380352, -63.73590155633997, -1582.833433156421, -4813.378878037186, 0, 406.8749694824219, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},{ | |
437.1122295425562, -1473.381008340528, -562.1952994931905, -4437.79235664477, 0, 931.874938964843 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
%matplotlib inline | |
import matplotlib | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
import numpy as np | |
from PIL import Image | |
fname = '../../test-graf/img1.png' | |
img = Image.open(fname).convert('RGB') | |
img = np.array(img) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
# The train/test net protocol buffer definition | |
net: "examples/cifar10/cifar10_full_sigmoid_train_test.prototxt" | |
# test_iter specifies how many forward passes the test should carry out. | |
# In the case of CIFAR10, we have test batch size 100 and 100 test iterations, | |
# covering the full 10,000 testing images. | |
test_iter: 100 | |
# Carry out testing every 1000 training iterations. | |
test_interval: 1000 | |
# The base learning rate, momentum and the weight decay of the network. | |
base_lr: 0.001 |
This file contains 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 | |
class CompactBilinearPooling(torch.nn.Module): | |
def __init__(self, input_dim1, input_dim2, output_dim, sum_pool = True): | |
super(CompactBilinearPooling, self).__init__() | |
self.output_dim = output_dim | |
self.sum_pool = sum_pool | |
generate_sketch_matrix = lambda rand_h, rand_s, input_dim, output_dim: torch.sparse.FloatTensor(torch.stack([torch.arange(input_dim, out = torch.LongTensor()), rand_h.long()]), rand_s.float(), [input_dim, output_dim]).to_dense() | |
self.sketch_matrix1 = torch.nn.Parameter(generate_sketch_matrix(torch.randint(output_dim, size = (input_dim1,)), 2 * torch.randint(2, size = (input_dim1,)) - 1, input_dim1, output_dim)) | |
self.sketch_matrix2 = torch.nn.Parameter(generate_sketch_matrix(torch.randint(output_dim, size = (input_dim2,)), 2 * torch.randint(2, size = (input_dim2,)) - 1, input_dim2, output_dim)) |
This file contains 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
hb_setup(); | |
%% | |
res = rproc.read('scoresroot', ... | |
fullfile(hb_path, 'matlab', 'scores', 'default')); | |
norm_splits = {}; | |
norms_path = fullfile(hb_path, 'matlab', 'data', 'best_normalizations.csv'); | |
norms = readtable(norms_path, 'delimiter', ','); | |
norms.Properties.RowNames = norms.descriptor; |
This file contains 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 | |
from torch.autograd import Variable | |
def batched_grid_apply(img, grid, batch_size): | |
n_patches = len(grid) | |
if n_patches > batch_size: | |
bs = batch_size | |
n_batches = n_patches / bs + 1 | |
for batch_idx in range(n_batches): |
NewerOlder