Visualizzazione post con etichetta science. Mostra tutti i post
Visualizzazione post con etichetta science. Mostra tutti i post

sabato 4 marzo 2017

Install caffe and caffe for matlab on windows 10 for deep learning

ok, not so straightforward...

March, 2017

This brief tutorial helps you to successfully install Caffe on Windows OS and to run the MatLab wrapper on your machine.
Caffe is a very useftul deep learning framework http://caffe.berkeleyvision.org/
I used it to build a LSTM system, cutting the net to a specific layer.

1. First

Refer to this webpage, as noticed by the official webpage of the caffe project:
https://github.com/BVLC/caffe/tree/windows

2. Install pre-requisites

But, if you are a developer, or a dev-geek you have all the software into the checklist, and here you cannot find any suggestion about them:

  • Git!! 
  • Cmake, same as git, you got it previously.
  • Python, 2.X or 3.X or Anaconda, Miniconda etc. 
  • MatLab
  • Cuda and cuDnn

  • MSVC 13 or 15, ok, maybe this is not your IDE for C++, so install it!


3. Follow the instruction on the readme of the caffe windows

Care about the build_win configuration file. There you have to modify the flags with your preference about your personal installation. To install caffe on MatLab enable the correct flag.
if NOT DEFINED BUILD_MATLAB set BUILD_MATLAB=1

4. How to allow caffe working in MatLab

After the installation process (inside the MSVC build the project INSTALL of the caffe solution)
you can try to run the demo on the caffe folders, you could encounter this issue: MatLab does not recognize and accept folder name +caffe.
Copy all the DLLs and other compiled-linekd files from the build caffe folder where you have the mex caffe file.
To solve it you could make a new folder matcaffe, creating a copy of +caffe and renaming it.
When you add the folder to MatLab path using addpath link to the matcaffe folder.
However, internally MatLab use the +caffe folder. 

mercoledì 7 novembre 2012

Ridurre dimensioni di un pdf - linux

Una volta fatto un repor, tesi, tesina, progetto, articolo potrebbe essere utile ridurre le dimensioni in mb del pdf generato, per mandarlo per mail o per archiviarlo.

Comando che strizza i pdf

ps2pdf -dCompatibilityLevel=1.4 -dMAxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -sPAPERSIZE=a4 paper.pdf

Si ottiene un file paper.pdf.pdf che è di dimensione ridotta.
Giocando con i parametri si possono avere riduzioni maggiori.

ps2pdf è un comando che di suo produce un file PDF 1.4, le opzioni sono quelle di gs:

Spazi nelle formule matematiche latex

come usare gli spazi all'interno delle formule matematiche in latex.
Perchè normalmente non vengono considerati gli spazi lasciati nel testo...

Dentro all'ambiente matematico

  • \; a thick space
  • \: a medium space
  • \, a thin space
  • \! a negative thin space

Esempio 

se usiamo
$ [1 2 3] $ viene stampato [123]
mentre con 
$ [1 \; 2 \; 3] $ viene stampato [1 2 3]

reference

martedì 6 novembre 2012

Errore matlab libc.6 linux

Quando si lancia matlab da terminale potrebbe presentarsi questo errore:

/usr/local/MATLAB/R2010b/bin/matlab: 1: /usr/local/MATLAB/R2010b/bin/util/oscheck.sh: /lib64/libc.so.6: not found

Normalmente questo potrebbe accadere con una distribuzione Ubuntu

per risolverlo, in base alla propria distribuzione, è sufficiente fare:

Ubuntu 64 bit:
sudo ln -s /lib/x86_64-linux-gnu/libc.so.6 /lib64/libc.so.6

Ubuntu 32 bit:
sudo ln -s /lib/i386-linux-gnu/libc.so.6 /lib/libc.so.6

Ubuntu 64-bit con Student Version:
sudo ln -s /lib/x86_64-linux-gnu/libc.so.6 /lib


Aggiungere comandi linux

Per aggiungere un nuovo comando, per lanciare ad esempio un'applicazione
In questo appunto ho fatto riferimento a Matlab, in modo da poter lanciare matlab da riga di comando come se fosse un normale comando della distribuzione Linux.

Creare lo script in bash o altro, per lanciare il programma, l'ho fatto in una cartella che uso per gli script
touch matlab.sh

Il file matlab.sh contiene questo:

#!/bin/bash
/usr/local/MATLAB/R2010b/bin/matlab -desktop

Ricordarsi di mettere i permessi di esecuzione al file
chmod +x matlab.sh


Linkare dentro alla cartella /usr/bin lo script
root@pippo:/usr/bin: ln -s /home/utente/Scripts/matlab.sh matlab

Ora si puo' lanciare matlab come un normale comando di linux.