MathJax 是一個 JavaScript 的函式庫,可以讓你直接使用 LaTeX、MathML 或 AsciiMath 的語法,把數學式寫進網頁中,並且可以用右鍵剪貼數學式,各種瀏覽器都可以看,效果幾乎跟傳統 LaTeX 一樣,是一個十分強大的函式庫。
TrivialCode
2018年8月16日 星期四
2016年7月28日 星期四
Ubuntu 開啟ssh 連線
在ubuntu的環境下, 如果想要開啟遠端ssh連線
要安裝 openssh-client and openssh-server
並執行 ssh
安裝好ssh後可以在 /etc/ssh/sshd_config 裡面更改連線的port的位置
port 的預設值是22
如果沒有安裝ssh就連線, 會看到以下錯誤訊息
ssh: connect to host localhost port 22: Connection refused
要安裝 openssh-client and openssh-server
並執行 ssh
sudo apt-get install openssh-client openssh-server
sudo /etc/init.d/ssh start
port 的預設值是22
如果沒有安裝ssh就連線, 會看到以下錯誤訊息
ssh: connect to host localhost port 22: Connection refused
2016年7月25日 星期一
Eclipse / macro
Project Macros
This topic describes the various macros that are available for use within projects. They can be used when specifying build command or build options and in general are quite useful when trying to make projects portable and more maintainable.
Macro | Description |
---|---|
${InputFileName} | Represents the input file name. |
${InputFileExt} | Represents the extension of the input file. |
${InputFileBaseName} | Represents the base name of the input file. That is the file name with an extension stripped. |
${InputFileRelPath} | Represents the input file path relative to the builder current directory. |
${InputDirRelPath} | Represents the input file directory path relative to the builder current directory. |
${OutputFileName} | Represents the output file name. |
${OutputFileExt} | Represents the output file extension. |
${OutputFileBaseName} | Represents the output file base name. That is the output file name with an extension stripped. |
${OutputFileRelPath} | Represents the output file path relative to the current builder directory. |
${OutputDirRelPath} | Represents the output file directory path relative to the current builder directory. |
${ConfigName} | Represents the name of a given configuration. |
${ConfigDescription} | Represents the description of a given configuration. |
${BuildArtifactFileName} | Represents the name of the build artifact. |
${BuildArtifactFileExt} | Represents the extension of the build artifact. |
${BuildArtifactFileBaseName} | Represents the base name of the build artifact. |
${BuildArtifactFilePrefix} | Represents the prefix of the build artifact. |
${ProjName} | Represents the name of a given project. |
${ProjDirPath} | Represents the absolute path of a given project. |
${WorkspaceDirPath} | Represents the workspace absolute path. |
${DirectoryDelimiter} | Represents the directory delimiter used on the system. That is the “\? for Win32 systems and the “/? for Unix-like systems. This could be useful, e.g. in the case a user needs the absolute path of an input file. The absolute path would be represented in the following way: CWD{DirectoryDelimiter}${InputFileRelPath} |
${PathDelimiter} | Represents the default path delimiter used on the system to separate paths in the path environment variables. That is the “;? for Win32 systems and the “:? for Unix-like systems
This might be used in the environment variable definitions
|
${EclipseVersion} | Represents the current Eclipse version. |
${CDTVersion} | Represents the current CDT version. |
${HostOsName} | Represents the operating system name on which eclipse is running. |
${C2000_CG_ROOT} | Installation folder of the C28x code generation tools. |
${C5500_CG_ROOT} | Installation folder of the C55x code generation tools. |
${C6000_CG_ROOT} | Installation folder of the C6x code generation tools. |
${MSP430_CG_ROOT} | Installation folder of the MSP430 code generation tools. |
${TMS470_CG_ROOT} | Installation folder of the ARM code generation tools. |
${CCS_INSTALL_ROOT} | Root installation directory of CCS. i.e. the directory installed in + /ccsv4 or /ccsv5 |
${CG_TOOL_ROOT} | Installation folder of the currently selected code generation tools. Will be the same value as the matching <ISA>_CG_ROOT macro. |
${CG_TOOL_SUFFIX} | Contains the ISA of the currently selected code generation tools. i.e. 2000 for C2000. |
2016年6月17日 星期五
caffe fast-rcnn GPU編譯流程
caffe fast-rcnn GPU編譯流程(含python layer)
2015/12/21 | 無
嗨, 大家好今天要來分享的是 fast-rcnn GPU編譯流程
1. 前期準備工作, 安裝相依程式
#下列為C++ 快速安裝方式, 若想要安裝最新版本請至各官網下載自行編譯
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
#下列為C++ 快速安裝方式, 若想要安裝最新版本請至各官網下載自行編譯
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
#下列為python 快速安裝方式
sudo apt-get -y install python-pip
cd ./caffe-fast-rcnn/python
for req in (catrequirements.txt);dosudopipinstallreq; done
#install easydict
wget https://pypi.python.org/packages/source/e/easydict/easydict-1.6.zip
unzip easydict-1.6.zip
cd easydict-1.6
python setup.py install
sudo apt-get -y install python-pip
cd ./caffe-fast-rcnn/python
for req in (catrequirements.txt);dosudopipinstallreq; done
#install easydict
wget https://pypi.python.org/packages/source/e/easydict/easydict-1.6.zip
unzip easydict-1.6.zip
cd easydict-1.6
python setup.py install
#下列為安裝CUDA 流程
#先到官網下載安裝檔
https://developer.nvidia.com/cuda-downloads
#Ctrl + Alt + F1
sudo lightdm stop
sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install cuda
#安裝驅動期間必須要重新開機才能繼續
#先到官網下載安裝檔
https://developer.nvidia.com/cuda-downloads
#Ctrl + Alt + F1
sudo lightdm stop
sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install cuda
#安裝驅動期間必須要重新開機才能繼續
#安裝cuDNN
tar -zxf cudnn-7.0-linux-x64-v3.0-prod.tgz
cd cuda
sudo cp lib64/* /usr/local/cuda/lib64/
sudo cp include/cudnn.h /usr/local/cuda/include/
tar -zxf cudnn-7.0-linux-x64-v3.0-prod.tgz
cd cuda
sudo cp lib64/* /usr/local/cuda/lib64/
sudo cp include/cudnn.h /usr/local/cuda/include/
#build caffe
cp Makefile.config.example Makefile.config
vi Makefile.config
cp Makefile.config.example Makefile.config
vi Makefile.config
#1.Uncomment the line: USE_CUDNN := 1 and WITH_PYTHON_LAYER := 1
#2.Make sure the CUDA_DIR correctly points to our CUDA installation.
#2.Make sure the CUDA_DIR correctly points to our CUDA installation.
make pycaffe -j8
make all -j8
make test -j8
make all -j8
make test -j8
cd ./caffe-fast-rcnn/lib
rm ./nms/*.so
make
rm ./nms/*.so
make
#恭喜完成
parse command line arguments in bash
./myscript.sh -e conf -s /etc -l /usr/lib /etc/hosts
#!/bin/bash
# Use -gt 1 to consume two arguments per pass in the loop (e.g. each
# argument has a corresponding value to go with it).
# Use -gt 0 to consume one or more arguments per pass in the loop (e.g.
# some arguments don't have a corresponding value to go with it such
# as in the --default example).
# note: if this is set to -gt 0 the /etc/hosts part is not recognized ( may be a bug )
while [[ $# -gt 1 ]]
do
key="$1"
case $key in
-e|--extension)
EXTENSION="$2"
shift # past argument
;;
-s|--searchpath)
SEARCHPATH="$2"
shift # past argument
;;
-l|--lib)
LIBPATH="$2"
shift # past argument
;;
--default)
DEFAULT=YES
;;
*)
# unknown option
;;
esac
shift # past argument or value
done
echo FILE EXTENSION = "${EXTENSION}"
echo SEARCH PATH = "${SEARCHPATH}"
echo LIBRARY PATH = "${LIBPATH}"
echo "Number files in SEARCH PATH with EXTENSION:" $(ls -1 "${SEARCHPATH}"/*."${EXTENSION}" | wc -l)
if [[ -n $1 ]]; then
echo "Last line of file specified as non-opt/last argument:"
tail -1 $1
fi
Rotate image around x, y, z axis in OpenCV
記錄一下在網路上找到的資料
http://stackoverflow.com/questions/19093728/rotate-image-around-x-y-z-axis-in-opencv/19110462#19110462
可以對圖片做x , y , z 三軸旋轉
http://stackoverflow.com/questions/19093728/rotate-image-around-x-y-z-axis-in-opencv/19110462#19110462
可以對圖片做x , y , z 三軸旋轉
Finally found a way, thanks to this post:https://plus.google.com/103190342755104432973/posts/NoXQtYQThgQ
I let OpenCV calculate the matrix for me, but I'm doing the perspective transform myself (found it easier to implement than putting everything into a cv::Mat)
float rotx, roty, rotz; // set these first
int f = 2; // this is also configurable, f=2 should be about 50mm focal length
int h = img.rows;
int w = img.cols;
float cx = cosf(rotx), sx = sinf(rotx);
float cy = cosf(roty), sy = sinf(roty);
float cz = cosf(rotz), sz = sinf(rotz);
float roto[3][2] = { // last column not needed, our vector has z=0
{ cz * cy, cz * sy * sx - sz * cx },
{ sz * cy, sz * sy * sx + cz * cx },
{ -sy, cy * sx }
};
float pt[4][2] = {{ -w / 2, -h / 2 }, { w / 2, -h / 2 }, { w / 2, h / 2 }, { -w / 2, h / 2 }};
float ptt[4][2];
for (int i = 0; i < 4; i++) {
float pz = pt[i][0] * roto[2][0] + pt[i][1] * roto[2][1];
ptt[i][0] = w / 2 + (pt[i][0] * roto[0][0] + pt[i][1] * roto[0][1]) * f * h / (f * h + pz);
ptt[i][1] = h / 2 + (pt[i][0] * roto[1][0] + pt[i][1] * roto[1][1]) * f * h / (f * h + pz);
}
cv::Mat in_pt = (cv::Mat_<float>(4, 2) << 0, 0, w, 0, w, h, 0, h);
cv::Mat out_pt = (cv::Mat_<float>(4, 2) << ptt[0][0], ptt[0][1],
ptt[1][0], ptt[1][1], ptt[2][0], ptt[2][1], ptt[3][0], ptt[3][1]);
cv::Mat transform = cv::getPerspectiveTransform(in_pt, out_pt);
cv::Mat img_in = img.clone();
cv::warpPerspective(img_in, img, transform, img_in.size());
2016年6月15日 星期三
Ubuntu 14.04 install boost
如何安裝 boost 到 ubuntu 14.04
1. Download boost
http://www.boost.org/
2. cd /path/boost/
sudo apt-get update
sudo apt-get install build-essential g++ python-dev autotools-dev libicu-dev build- essential libbz2-dev libboost-all-dev
./bootstrap.sh --prefix=/usr/local
sudo ./b2 install
3. sudo apt-get install libboost-all-dev
1. Download boost
http://www.boost.org/
2. cd /path/boost/
sudo apt-get update
sudo apt-get install build-essential g++ python-dev autotools-dev libicu-dev build- essential libbz2-dev libboost-all-dev
./bootstrap.sh --prefix=/usr/local
sudo ./b2 install
3. sudo apt-get install libboost-all-dev
訂閱:
文章 (Atom)