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
require 'torch' | |
require 'nn' | |
require 'image' | |
local hdf5 = require 'hdf5' | |
local cmd = torch.CmdLine() | |
cmd:option('-image_list', '') | |
cmd:option('-model', '') | |
cmd:option('-layer', 30) -- Last ReLU for VGG-16 |
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
require 'nn' | |
print(nn.SpatialReflectionPadding) | |
local m = nn.SpatialReflectionPadding(2, 2, 2, 2) | |
print(m) | |
local x = torch.randn(2, 3, 4, 5) | |
local y = m:forward(x) |
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
require 'torch' | |
local utils = require 'utils' | |
require 'DataLoader' | |
local cmd = torch.CmdLine() | |
cmd:option('-train_data_h5', 'data/vg-regions-720.h5', 'path to the h5file containing the preprocessed dataset') | |
cmd:option('-train_data_json', 'data/vg-regions-720-dicts.json', 'path to the json file containing additional info') | |
cmd:option('-use_split_indicator', 1) |
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
require 'torch' | |
local utils = require 'utils' | |
require 'DataLoader' | |
local cmd = torch.CmdLine() | |
cmd:option('-train_data_h5', 'data/vg-regions-720.h5', 'path to the h5file containing the preprocessed dataset') | |
cmd:option('-train_data_json', 'data/vg-regions-720-dicts.json', 'path to the json file containing additional info') | |
cmd:option('-use_split_indicator', 1) |
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 argparse, os, glob, tempfile | |
import h5py | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.misc import imread, imresize | |
# Stupid workaround for some messed up images | |
from PIL import ImageFile | |
ImageFile.LOAD_TRUNCATED_IMAGES = True |
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
require 'torch' | |
require 'nn' | |
require 'cutorch' | |
require 'cunn' | |
require 'cudnn' | |
require 'optim' | |
require 'hdf5' | |
require 'image' | |
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
1 0.00348258706468 | |
2 0.00497760079642 | |
3 0.00846613545817 | |
4 0.028898854011 | |
5 0.0827517447657 | |
6 0.17506234414 | |
7 0.318862275449 | |
8 0.478781827259 | |
9 0.627372627373 | |
10 0.752123938031 |
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
require 'nn' | |
require 'cutorch' | |
require 'cunn' | |
--[[ | |
-- A simple benchmark comparing fully-connected net times on CPU and GPU. | |
-- | |
-- Note that we don't count time it takes to transfer data to the GPU. | |
--]] |
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 argparse, random, os, time, json | |
from PIL import Image | |
from io import BytesIO | |
import base64 | |
from flask import Flask, request | |
from flask.ext.cors import CORS | |
from flask_restful import Resource, Api |
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
$(function() { | |
var SERVER_URL = null; | |
var video_active = false; | |
var demo_running = false; | |
var NUM_TO_SHOW = 20; | |
var IMAGE_DISPLAY_WIDTH = 800; | |
var BOX_LINE_WIDTH = 6; |