how torch stores images

require('image')
imgPath = "image.jpg"
img = torch.Tensor(1, 3, imgDim, imgDim)
img[1] = image.load(imgPath, 3, byte)

image is stored as float, conversion is (intensity/255.). stored top->bottom, line by line. format RGB.

display

require 'gnuplot'
gnuplot.figure(1)
gnuplot.imagesc(img[1])

Torch<->numpy dictionary
https://github.com/torch/torch7/wiki/Torch-for-Numpy-users

Installing torch for miniconda

I got the error while installing torch for miniconda. Something like
Linking CXX executable mshrable
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `BC'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `tgetnum'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `PC'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `tputs'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `tgetent'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `tgetflag'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `tgoto'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `UP'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `tgetstr

The same was for python3 and python2 environments.  The solution (at least for python 2) was to remove miniconda from path and compile torch with the system python.


Solution from https://github.com/ContinuumIO/anaconda-issues/issues/152
same here, temporay fix for me is to remove conda readline from the environment:
conda remove --force readline
and install the python bindings with pip install readline.
That way, I presume it is using the system readline.

compile dlib for miniconda

Activate miniconda environment (my environment is called py3):
source activate py3

Produce initial steps from the readme:
cd examples
mkdir build
cd build
cmake ..
cmake --build . --config Release

inside function  build_dlib() of file setup.py add the highlighted code:
        if platform_arch == '64bit' and sys.platform == "win32":
            # 64bit build on Windows

         .................. bla bla ...................

            for ext in [py_ver.replace(".", "") + '.lib', py_ver + 'mu.lib', py_ver + 'm.lib', py_ver + 'u.lib']:
                py_lib = os.path.abspath(os.path.join(inc_dir, '../libs/', 'python' + ext))
                if os.path.exists(py_lib):
                    cmake_extra_arch += ['-DPYTHON_LIBRARY={lib}'.format(lib=py_lib)]
                    break
        else:
            cmake_extra_arch += ['-DPYTHON_LIBRARY=/home/user/miniconda/envs/py3/lib/libpython3.so']
            cmake_extra_arch += ['-DPYTHON_INCLUDE_DIR=/home/user/miniconda/envs/py3/include/python3.5m']


        build_dir = os.path.join(script_dir, "./tools/python/build")
     ......................bla bla.....................................


Replace /home/user/miniconda by your path to miniconda

Run python setup.py install (as usual)

compile dlib for miniconda

Activate miniconda environment (my environment is called py3):
source activate py3

Produce initial steps from the readme:
cd examples
mkdir build
cd build
cmake ..
cmake --build . --config Release

inside function  build_dlib() of file setup.py add the highlighted code:
        if platform_arch == '64bit' and sys.platform == "win32":
            # 64bit build on Windows

         .................. bla bla ...................

            for ext in [py_ver.replace(".", "") + '.lib', py_ver + 'mu.lib', py_ver + 'm.lib', py_ver + 'u.lib']:
                py_lib = os.path.abspath(os.path.join(inc_dir, '../libs/', 'python' + ext))
                if os.path.exists(py_lib):
                    cmake_extra_arch += ['-DPYTHON_LIBRARY={lib}'.format(lib=py_lib)]
                    break
        else:
            cmake_extra_arch += ['-DPYTHON_LIBRARY=/home/user/miniconda/envs/py3/lib/libpython3.so']
            cmake_extra_arch += ['-DPYTHON_INCLUDE_DIR=/home/user/miniconda/envs/py3/include/python3.5m']


        build_dir = os.path.join(script_dir, "./tools/python/build")
     ......................bla bla.....................................


Replace /home/user/miniconda by your path to miniconda

Run python setup.py install (as usual)

Mount windows shares in linux



Use sudo if needed

Mount

mkdir /mnt/share
mount -t cifs //windowsmachineip/sharename -o username=user,password=urPassword /mnt/share

Unmount

umount /mnt/shares

autocomplete from history in terminal (in linux mint)

create a file .inputrc

in your home directory and put there
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
TAB: menu-complete



Restart your terminal.

How you can autocomplete from history using Up and down keys.