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
-- test of FFI vs regular lua code | |
-- EC march 21st 2014 | |
torch.setdefaulttensortype('torch.FloatTensor') | |
require 'sys' | |
require 'image' | |
require 'torchffi' | |
local bit = require('bit') | |
local ffi = require('ffi') |
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
-- E. Culurciello Oct 2014 | |
-- video file loading in macos | |
-- a cheap ffmpeg hack / alternative: | |
require("image") | |
local lfs = require "lfs" | |
video = {} | |
function video:init(args) |
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
-------------------------------------------------------------------------------- | |
-- E. Culurciello, October 2014 | |
-- socket test in node.js and Lua | |
-------------------------------------------------------------------------------- | |
require 'image' | |
local async = require 'async' | |
-- tcp client: | |
async.tcp.connect({host='127.0.0.1', port=6969}, function(client) |
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
// Example of sending to Lua code and receiving results: | |
// E. Culurciello, November 2014 | |
// server and socket test: | |
// http://www.hacksparrow.com/tcp-socket-programming-in-node-js.html | |
var net = require('net'); | |
var HOST = '127.0.0.1'; | |
var PORT = 6969; | |
// Create a server instance, and chain the listen function to it |
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
--[[ precision-test | |
Compare precision of hardware and software implementation | |
run with: qlua precision-network.lua | |
--]] | |
require 'nn' | |
require 'pl' | |
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
-- net cpu/gpu speed test | |
-- E. Culurciello, March 2015 | |
require 'nn' | |
require('cunn') | |
torch.setdefaulttensortype('torch.FloatTensor') | |
net = torch.load('../../models/home-A1l/model.net') | |
net_gpu = torch.load('../../models/home-A1l/model.net') | |
net_gpu:cuda() |
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
local mask = function (inputImage, mask, th) | |
local temp | |
mask = mask[1] | |
k = image.gaussian{size = 7, normalize = true}:float() | |
mask = image.convolve(mask, k, 'same'):repeatTensor(3,1,1) | |
temp = mask:gt(th):float():mul(.8):add(.2) | |
return inputImage:clone():cmul(temp) | |
end |
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
-------------------------------------------------------------------------------- | |
-- E. Culurciello SSD speed test for batch 128 | |
------------------------------------------------------------------------------- | |
print('SSD test program in for Torch7 batches') | |
torch.manualSeed(1) | |
torch.setdefaulttensortype('torch.FloatTensor') | |
torch.setnumthreads(8) |
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
to resize 1080p videos: | |
ffmpeg -i pool.mp4 -vf scale=640:360 pool-small.mp4 | |
to match odroid fps (12fps): need to speed up video: | |
https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video | |
1: | |
ffmpeg -i dog.mp4 -vf scale=640:360 -filter:v "setpts=0.5*PTS" dog-2x.mp4 | |
because it does not scale with this command, so we need to do more: | |
2: |
OlderNewer