Skip to content

Instantly share code, notes, and snippets.

Avatar

Eugenio Culurciello culurciello

View GitHub Profile
View pytorchcheat.txt
http://pytorch.org/
https://discuss.pytorch.org/
https://github.com/pytorch/
https://github.com/bfortuner/pytorch-cheatsheet/blob/master/pytorch-cheatsheet.ipynb
View pytorch failure Titan X (Maxwell)
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__
View table-test.lua
-- 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()
View xception.lua
-- 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))
View RL-example.py
#! /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:
View recurrent-multilayer.lua
-- 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)
View LineSegmentCetector.lua
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
View ffmpeg.rtf
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:
You can’t perform that action at this time.