Visualizzazione post con etichetta windows. Mostra tutti i post
Visualizzazione post con etichetta windows. 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. 

lunedì 30 gennaio 2017

open command window in windows


if you need to open the DOS shell, prompt, command line, from the file explorer application.
Enter into the folder and ...

Windows Vista/7/8.x/10

In the newer versions of Windows, you do not have to install anything. Simply hold down the Shift key and right-click a folder. The context menu will contain an entry, ‘Open command window here.”

from http://www.techsupportalert.com/content/how-open-windows-command-prompt-any-folder.htm


martedì 13 dicembre 2016

How to read a image sequence with OpenCV


This rough post contains information about the stored image sequence management for still images processing in OpenCV. This post is a reminder, not a tutorial.

Simple assumptions


  • Your image sequence contains images with file name like this: image000001.png. Normally you store images with this sequential file name convention (consider also the case of auto file naming)
  • Your images are in png format (It is only for this example)
  • Your folder absolute path is /folder1/folder2/folder3/ (please consider that Unix and Win paths are different, so use carefully the \ or / chars)


ImageList file

you can use the image list file creator inside the opencv samples, to build a xml file containing the list of the images inside the target folder.
Then you can import the list of images as a vector inside your code

VideoCapture

0. some variables
cv::Mat image_frame;
std::string str_sequenceFileName = "/folder1/folder2/folder3/image%06d.png ";

1. create a videocapture object and then open it, check if is opened and eventually send an error on the shell.

cv::VideoCapture videoCapture;
videoCapture.open(str_sequenceFileName); // open the default camera
if (!videoCapture.isOpened()) {  // check if we succeeded
std::cerr << "[EE] opening video capture OFFLINE device" << std::endl;
return -1;
}
}

2. use the videocapture object instance to grab the current frame. the videocapture grabs the frame from the image sequence folder. You can use it directly inside your main image processing loop.

videoCapture >> image_frame;

Glob

0. some variables
cv::String str_sequenceFolder = "/folder1/folder2/folder3"
cv::String glob_folder = str_sequenceFolder + "/*.png";
std::vector<cv::String> imageFileNamesList;
imageFileNamesList.clear();
cv::Mat image_frame;

1. fill the vector with the image names inside the sequence folder, to obtain the image names list vector

cv::glob(glob_folder, imageFileNamesList);

2. sort the vector (maybe it is not useful)

std::sort(imageFileNamesList.begin(), imageFileNamesList.end());

3. read the current image from the sequence folder

for (int n_frameNumber=0; n_frameNumber < imageFileNamesList.size(); ++n_frameNumber) 
{
    image_frame = cv::imread(imageFileNamesList[n_frameNumber]);
    //some image processing
}

venerdì 12 febbraio 2016

Ubuntu 14.04 LTS on Dell inspiron 15 7000 series



subtitle: a lot of problems





ok, this is the page of the hardware configuration certification in ubuntu
http://www.ubuntu.com/certification/catalog/component/dmi/4755/dmi%3ADellSystemInspiron157000Series7537/


...but...

WI FI

when you finish the installation stage, u could have no wireless connection
due to problems with Intel wireless drivers

on the Dell pc you have this wireless card
Intel® Wireless 7265
Intel® Wireless 3165 (starting from firmware XX.XX.13.0 and kernel 4.1)

https://wireless.wiki.kernel.org/en/users/Drivers/iwlwifi


a solution is to use this trick:


First, verify that you have these two files; iwlwifi-7265D-13.ucode and iwlwifi-7265-13.ucode:
ls /lib/firmware | grep 7265
If so, we are going to make copies but rename them:
cd /lib/firmware
sudo cp iwlwifi-7265D-13.ucode  iwlwifi-3165-9.ucode
sudo cp iwlwifi-7265-13.ucode  iwlwifi-3165-13.ucode

FROM: http://askubuntu.com/questions/672700/how-can-i-install-intel-dual-band-wireless-ac-3165-drivers

This solution works for me.


Kernel 4.X

you could have problems with this kernel
in my case the nouveau drivers crash on startup 


FREEZING


sometimes the OS freezes,

I don't be sure that this is the solution...

If you have installed the Ubuntu distro on a PC with Microsoft Windows pre-installed maybe the fast startup settings could be put on the RAM some configuration files, then when you start linux it could be find a incoerent state...
 
try to disable the hybernate and sleep, and fast startup in windows OS


I tryed also to install other kernels or other versions of  ubuntu and mint, but I cannot have more than half an hour to spend in installations...

giovedì 13 dicembre 2012

Windows application with console

se stai usando una windows application come entry point per l'applicazione e vuoi anche una console

#include <iostream>
#include <string>
#include <cstdio>
#include <windows.h>
#include <io.h>
#include <fcntl.h>

int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
if (AllocConsole()) {
int ifd = _open_osfhandle((intptr_t)GetStdHandle(STD_INPUT_HANDLE), _O_TEXT);
int ofd = _open_osfhandle((intptr_t)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);

*stdin = *_fdopen(ifd, "r");
*stdout = *_fdopen(ofd, "w");

std::cout<<"I made a console window";
std::cin.get();

fclose(stdout);
fclose(stdin);
}
}

Reference:
http://www.daniweb.com/software-development/cpp/threads/347901/is-it-possible-to-use-a-console-app-and-windows-one-at-the-same-time

venerdì 7 dicembre 2012

OpenGL su windows 7

alcuni appunti per installare OpenGL su windows 7
il mio pc è un po' datato quindi supporta fino alla 2.1

1. ricordarsi che con windows opengl sono supportate a livello driver e dovrebbero esser già nel sistema operativo, meglio comunque aggiornare i driver della propria scheda grafica.

2. per esser sicuro si può installare opengl extension viewer che testa quali opengl si possono utilizzare con i driver grafici installati.

3. preso da internet alcuni appunti sulle opengl


We need the following sets of libraries in programming OpenGL:
  1. Core OpenGL (GL): consists of hundreds of functions, which begin with a prefix "gl" (e.g., glColor, glVertex, glTranslate, glRotate). The Core OpenGL models an object via a set of geometric primitives, such as point, line, and polygon.
  2. OpenGL Utility Library (GLU): built on-top of the core OpenGL to provide important utilities and more building models (such as qradric surfaces). GLU functions start with a prefix "glu" (e.g., gluLookAt, gluPerspective)
  3. OpenGL Utilities Toolkit (GLUT): provides support to interact with the Operating System (such as creating a window, handling key and mouse inputs); and more building models (such as sphere and torus). GLUT functions start with a prefix of "glut" (e.g., glutCreatewindow, glutMouseFunc). 
  4. Quoting from the opengl.org: "GLUT is designed for constructing small to medium sized OpenGL programs. While GLUT is well-suited to learning OpenGL and developing simple OpenGL applications, GLUT is not a full-featured toolkit so large applications requiring sophisticated user interfaces are better off using native window system toolkits. GLUT is simple, easy, and small."
  5. Alternative of GLUT includes SDL, ....
  6. OpenGL Extension Wrangler Library (GLEW): "GLEW is a cross-platform open-source C/C++ extension loading library. GLEW provides efficient run-time mechanisms for determining which OpenGL extensions are supported on the target platform." Source and pre-build binary available at http://glew.sourceforge.net/.
  7.  installazione di glut per la parte grafica.


Reference

http://www.hackorama.com/opengl/
http://www.opengl.org/resources/libraries/glut/
http://www3.ntu.edu.sg/home/ehchua/programming/opengl/HowTo_OpenGL_C.html
http://web.eecs.umich.edu/~sugih/courses/eecs487/glut-howto/

mercoledì 28 novembre 2012

OpenCV su Windows con Visual Studio

per installare opencv su windows con Visual Studio

1. installare opencv: scaricando dal sito il file eseguibile
2. installare opencv in una cartella non di sistema, così non ci sono problemi di permessi
3. aggiornare la variabile PATH del sistema, mettendo la cartella in cui sono presenti sia le dll che le lib

4. dentro a visual studio inserire nel progetto

  • indicazione della cartella degli header D:\opencv...\include
  • indicazione della cartella dei file .lib D:\opencv...\lib
  • elenco dei file lib che si usano (che sono differenti per compilazione in debug e per compilazione in release, si distinguono dalla d finale prima dell'estensione.) 
meglio dare una riavviata prima di usare il codice, per fissare la variabile path.