Giter Club home page Giter Club logo

torch-toolbox's Introduction

Torch Toolbox

A collection of snippets and libraries for Torch from Purdue e-Lab.

License

MIT

torch-toolbox's People

Contributors

atcold avatar codeac29 avatar culurciello avatar hohocode avatar jhjin avatar mvitez avatar paulkrog avatar spk921 avatar willwilliams avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

torch-toolbox's Issues

symbol(s) not found for architecture x86_64

Hi I am getting this error when trying to compile the Video Decoder tool for Mac OS X Version 10.11.6:

gcc video_decoder.o mpjpeg.o -shared -L/Users/joaocarvalho/torch/install/lib/lua/5.1 -L/Users/joaocarvalho/torch/install/lib -o libvideo_decoder.so -lavutil -lavformat -lavcodec -lswscale -lTH -lluajit -lluaT /usr/local/lib/libjpeg.dylib /usr/local/lib/libpng.dylib
Undefined symbols for architecture x86_64:
"_avcodec_alloc_frame", referenced from:
_video_decoder_init in video_decoder.o
_video_decoder_rgb in video_decoder.o
_encoderopen in video_decoder.o
"_avcodec_free_frame", referenced from:
_encoderclose in video_decoder.o
"_avcodec_get_frame_defaults", referenced from:
_video_decoder_batch_resized in video_decoder.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libvideo_decoder.so] Error 1

Any idea how to solve this ?

Error invstd not found

I think with the change from running_std to running_var the BN absorber is not working. I tried calculating running_var from running_std. But the output doesnt match after using BN absorber.

./BN-absorber.lua:5: attempt to index local 'invstd' (a nil value)
stack traceback:
./BN-absorber.lua:5: in function 'absorb_bn_conv'
./BN-absorber.lua:73: in function <./BN-absorber.lua:26>
example.lua:33: in main chunk
[C]: in function 'dofile'
...arun/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x00405ea0

Problem installing Video-decoder

Hi,

I am trying to install the Video-decoder package.
I have cloned the repo into ~/torch/pkg and then

$ cd ~/torch/pkg/torch-toolbox/Video-decoder
$ make

I got this error:

gcc -O3 -fopenmp -c -fpic -Wall -I. -I/usr/local/include video_decoder.c
video_decoder.c:13:10: fatal error: 'luaT.h' file not found
#include <luaT.h>
         ^
1 error generated.
make: *** [video_decoder.o] Error 1

I am using a Mac and I have brew installed the prerequisites.

What am I doing incorrectly?

Do I need re-initialization after cudnn.covert

I have a question here. We I build a network, I use the methods in Weight-init.lua to initialize the weights of my network which are all 'nn' layers. But, sometimes I need use covert the net to cudnn version, Do I need re-initialization after cudnn.covert(model, cudnn)? Any easy way?

Video encoder

Is there any toolbox which can encode images/videos to h264 file?

I tried to build the video-transmitter, but it said permission denied, Makefile:24: recipe for target 'video_transmitter.o' failed
make: *** [video_transmitter.o] Error 127 even I have added Torch directory to the Makefile.

Make fails

make produces the error:

gcc -O3 -fopenmp -c -fpic -Wall -I. -I/usr/local/include video_decoder.c
video_decoder.c:13:18: fatal error: luaT.h: No such file or directory
#include <luaT.h>
^
compilation terminated.
make: *** [video_decoder.o] Error 1

libvideo_decoder.so: undefined symbol: av_frame_unref

I am getting the following error when I try to load video using video_decoder.

-> % qlua test-frame.lua -v 1DCnIad1Y0w.mp4
Unable to connect X11 server (continuing with -nographics)
qlua: error loading module 'libvideo_decoder' from file './libvideo_decoder.so':
./libvideo_decoder.so: undefined symbol: av_frame_unref
stack traceback:
[C]: at 0x7fc4456649c0
[C]: at 0x7fc445439bd0
[C]: in function 'require'

What could be the issue? could you please help?

<video_decoder> the codec is not supported

I tried to run the test-stream.lua with following command

th test-stream.lua -v 01TP_extract.avi

And it gives me this error

Input #0, avi, from '01TP_extract.avi':
Duration: 00:02:05.03, start: 0.000000, bitrate: 108156 kb/s
Stream #0:0: Video: lagarith (LAGS / 0x5347414C), none, 960x720, 108179 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
<video_decoder> the codec is not supported.
/home/jayp/torch/install/bin/luajit: test-stream.lua:14: No video
stack traceback:
[C]: in function 'error'
test-stream.lua:14: in main chunk
[C]: in function 'dofile'
...jayp/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00406d2

Does anyone have any idea why this might be happening ?

Thank You!

Invalid and inefficient vfw-avi packed B frames detected

I have installed everything necessary but I still get the following error:

Gtk-Message: Failed to load module "pantheon-filechooser-module"
Gtk-Message: Failed to load module "canberra-gtk-module"
[mpeg4 @ 0x7f10c005dc00] Invalid and inefficient vfw-avi packed B frames detected
[1] 8324 segmentation fault (core dumped) qlua test-frame.lua -v ~/Downloads/temp/mv2_001.avi

Video-decoder error during installation in mac

I am getting the following error on my mac while installing the libvideo-decoder. ffmpeg version is 3-1-2.

video_decoder.c:2859:3: warning: implicit declaration of function 'avcodec_free_frame' is invalid in C99 [-Wimplicit-function-declaration]
                avcodec_free_frame(&enc.pFrame_yuv);
                ^
video_decoder.c:2865:9: warning: 'avcodec_encode_video2' is deprecated [-Wdeprecated-declarations]
                while(avcodec_encode_video2(enc.fmt_ctx->streams[0]->codec, &enc.pkt, 0, &got) >= 0 && got)
                      ^
/usr/local/include/libavcodec/avcodec.h:5261:5: note: 'avcodec_encode_video2' has been explicitly marked deprecated here
int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
    ^
video_decoder.c:2865:56: warning: 'codec' is deprecated [-Wdeprecated-declarations]
                while(avcodec_encode_video2(enc.fmt_ctx->streams[0]->codec, &enc.pkt, 0, &got) >= 0 && got)
                                                                     ^
/usr/local/include/libavformat/avformat.h:880:21: note: 'codec' has been explicitly marked deprecated here
    AVCodecContext *codec;
                    ^
video_decoder.c:2875:4: warning: 'av_free_packet' is deprecated [-Wdeprecated-declarations]
                        av_free_packet(&enc.pkt);
                        ^
/usr/local/include/libavcodec/avcodec.h:4414:6: note: 'av_free_packet' has been explicitly marked deprecated here
void av_free_packet(AVPacket *pkt);
     ^
video_decoder.c:2880:42: warning: 'codec' is deprecated [-Wdeprecated-declarations]
                avcodec_close(enc.fmt_ctx->streams[0]->codec);
                                                       ^
/usr/local/include/libavformat/avformat.h:880:21: note: 'codec' has been explicitly marked deprecated here
    AVCodecContext *codec;
                    ^
79 warnings generated.
gcc -O3 -c -fpic -Wall -DDARWIN -I. -I/Users/abhi/torch/install/include mpjpeg.c
gcc video_decoder.o mpjpeg.o -shared -L/Users/abhi/torch/install/lib/lua/5.1 -L/Users/abhi/torch/install/lib -o libvideo_decoder.so -lavutil -lavformat -lavcodec -lswscale -lTH -lluajit -lluaT /usr/local/lib/libjpeg.dylib
Undefined symbols for architecture x86_64:
  "_avcodec_alloc_frame", referenced from:
      _video_decoder_init in video_decoder.o
      _video_decoder_rgb in video_decoder.o
      _encoderopen in video_decoder.o
  "_avcodec_free_frame", referenced from:
      _encoderclose in video_decoder.o
  "_avcodec_get_frame_defaults", referenced from:
      _video_decoder_batch_resized in video_decoder.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libvideo_decoder.so] Error 1

SpatialFullConvolution

Hi,
Is there xavier initilzation for SpatialFullConvolution?
is it sufficient to add the following line in your code?
elseif m.__typename == 'nn.SpatialFullConvolution' then
m:reset(method(m.nInputPlanem.kHm.kW, m.nOutputPlanem.kHm.kW))

Not able to run video with .MXF extension

I tried to load video with .MXF extension using test-frame but it stops/pauses after few frames. In the beginning I get the following warning message too:

[mxf @ 0x7f9d9c022720] material track 2: no corresponding source track found
Video statistics: 720x960 (unknown frames)

Usage with Native Torch

Hi there,

How do you integrate this torch toolbox with a native installation of Torch?

Do you have a documentation or something related?

Cloning to my existing Torch installation directory seem to work well for me. But I get a compilation error:

/home/lex/torch/install/bin/luajit: farnnConv.lua:256: attempt to call a boolean value
stack traceback:
    farnnConv.lua:256: in main chunk
    [C]: in function 'dofile'
    .../lex/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
    [C]: at 0x00406670

The code section in question is:

mlp        = nn.Sequential();  
input = 1    output = 1     HUs = 1;                   -- Hidden units in dynamic layer parameters
mlp:add(nn.Linear(input, HUs))              
mlp:add(nn.ReLU())                       
--mlp:add(nn.Linear(HUs, output))               
mlp:add(nn.SpatialConvolutionMM(3,4,5,5))

method = 'xavier'
mlp_x = require('weight-init')(mlp, method)

Thanks!

demo learner missing files

Hi, Great toolbox

Can you provide download links to the model.net, stats.t7 and categories.txt files used in this demo ?

video-decoder on linux

when I build on linux, I got
gcc -O3 -c -fpic -Wall -DUSEGLES2 -DDOVIDEOCAP -I. -I/home/nvidia/torch/install/include -I/usr/include/freetype2 video_decoder.c
video_decoder.c:13:18: fatal error: luaT.h: No such file or directory
compilation terminated.
Makefile:55: recipe for target 'video_decoder.o' failed
make: *** [video_decoder.o] Error 1

Installing weight-init.lua

I need to use weight-init.lua in my project and would prefer to use it in a clean way, e.g. by placing it in the search path of th.

To this end, I created a directory named "weight-init" under /extra and copied the contents of torch-toolbox/Weight-Init into it and made appropriate changes to /extra/CMakeLists.txt and added /extra/weight-init/CMakeLists.txt`

diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt
index 903ff3b..94ff2ed 100644
--- a/extra/CMakeLists.txt
+++ b/extra/CMakeLists.txt
@@ -5,6 +5,7 @@ ADD_SUBDIRECTORY(nngraph)
 ADD_SUBDIRECTORY(nnx)
 ADD_SUBDIRECTORY(threads)
 ADD_SUBDIRECTORY(argcheck)
+ADD_SUBDIRECTORY(weight-init)

 IF (WITH_CUDA STREQUAL ON)
  ADD_SUBDIRECTORY(cutorch)
diff --git a/extra/weight-init/CMakeLists.txt b/extra/weight-init/CMakeLists.txt
new file mode 100644
index 0000000..2b2ad94
--- /dev/null
+++ b/extra/weight-init/CMakeLists.txt
@@ -0,0 +1,11 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
+CMAKE_POLICY(VERSION 2.6)
+
+FIND_PACKAGE(Torch REQUIRED)
+
+FILE(GLOB luasrc *.lua)
+
+ADD_TORCH
```_PACKAGE(weight-init "" "${luasrc}")
+

But, "weight-init.lua" is nowhere to be seen in th's search path,

th> require('weight-init')(1, 'xavier_caffe')
...user/Software/torch/install/share/lua/5.1/trepl/init.lua:389: module 'weight-init' not found:No LuaRocks module found for weight-init
        no field package.preload['weight-init']
        no file '/home/user/.luarocks/share/lua/5.1/weight-init.lua'
        no file '/home/user/.luarocks/share/lua/5.1/weight-init/init.lua'
        no file '/home/user/Software/torch/install/share/lua/5.1/weight-init.lua'
        no file '/home/user/Software/torch/install/share/lua/5.1/weight-init/init.lua'
        no file './weight-init.lua'
        no file '/home/user/Software/torch/install/share/luajit-2.1.0-beta1/weight-init.lua'
        no file '/usr/local/share/lua/5.1/weight-init.lua'
        no file '/usr/local/share/lua/5.1/weight-init/init.lua'
        no file '/home/user/.luarocks/lib/lua/5.1/weight-init.so'
        no file '/home/user/Software/torch/install/lib/lua/5.1/weight-init.so'
        no file '/home/user/Software/torch/install/lib/weight-init.so'
        no file './weight-init.so'
        no file '/usr/local/lib/lua/5.1/weight-init.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'error'
        ...user/Software/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
        [string "_RESULT={require('weight-init')(1, 'xavier_ca..."]:1: in main chunk
        [C]: in function 'xpcall'
        ...user/Software/torch/install/share/lua/5.1/trepl/init.lua:661: in function 'repl'
        ...ware/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:204: in main chunk
        [C]: at 0x00406651

What am I missing in CMakeLists ? Or is there another way access this function in a clean way ?

Video encoder failed!

Hello,I can not do this “sudo apt-get install -y libavformat-dev libavutil-dev libavcodec-dev libswscale-dev libfreetype6-dev”.No package ... available, so could you guide me in the issue?
Thank u!!!

Fail to install Video-decoder on TX1

Hi,
I have an error when make Video-decoder in tx1.
This is the error:

gcc: error: unrecognized command line option ‘-mfpu=neon’
Makefile:51: recipe for target 'video_decoder.o' failed
make: *** [video_decoder.o] Error 1

Can this install on aarch64?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.