This file contains hidden or 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 hidden or 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: |
This file contains hidden or 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 cv = require 'cv' | |
| require 'cv.highgui' | |
| require 'cv.imgproc' | |
| require 'cv.imgcodecs' | |
| require 'image' | |
| -- local image = cv.imread{arg[1] or 'demo/lena.jpg', cv.IMREAD_GRAYSCALE} | |
| imgT = image.lena() | |
| imgT = image.lena() | |
| imgTg = imgT[2] -- convert to grayscale and remove the first dimension |
This file contains hidden or 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
| -- Eugenio Culurciello | |
| -- August 2016 | |
| -- a test to learn to code PredNet-like nets in Torch7 | |
| require 'nn' | |
| require 'nngraph' | |
| torch.setdefaulttensortype('torch.FloatTensor') | |
| nngraph.setDebug(true) |
This file contains hidden or 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
| #! /usr/bin/env python3 | |
| # E. Culurciello, example of reinforcement learning in Python | |
| # | |
| # http://mnemstudio.org/path-finding-q-learning-tutorial.htm | |
| # Game: 5 rooms connected through doors. One room is the goal-room. | |
| # the goal of the game is to get to the goal-room | |
| import numpy as np | |
| # this is how rooms are connected: |
This file contains hidden or 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
| -- Xception model | |
| -- a Torch7 implementation of: https://arxiv.org/abs/1610.02357 | |
| -- E. Culurciello, October 2016 | |
| require 'nn' | |
| local nClasses = 1000 | |
| function nn.SpatialSeparableConvolution(nInputPlane, nOutputPlane, kW, kH) | |
| local block = nn.Sequential() | |
| block:add(nn.SpatialConvolutionMap(nn.tables.oneToOne(nInputPlane), kW,kH, 1,1, 1,1)) |
This file contains hidden or 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, November 2016 | |
| -- test to see if table insert/remove is slower than table addressing | |
| iters = 1e5 | |
| tablesize = 1e4 | |
| tab1={} | |
| item = torch.randn(iters,1024) | |
| sys.tic() |
This file contains hidden or 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
| elab@gpu5 ~/pytorch-examples/imagenet [master*]$ python3 main.py -a alexnet /media/SuperSSD/test-dataset-train-val/ | |
| => creating model 'alexnet' | |
| Traceback (most recent call last): | |
| File "main.py", line 286, in <module> | |
| main() | |
| File "main.py", line 129, in main | |
| train(train_loader, model, criterion, optimizer, epoch) | |
| File "main.py", line 165, in train | |
| output = model(input_var) | |
| File "/usr/local/lib/python3.4/dist-packages/torch/nn/modules/module.py", line 210, in __call__ |