2018년 8월 15일 수요일

Ubuntu instant-off option

Objective: (safe) power-off  the computer with pressing the power button

Refer to:
https://askubuntu.com/questions/430776/how-can-i-modify-the-power-button-behaviour
https://askubuntu.com/questions/1000393/how-to-configure-the-power-off-button-to-just-power-off-instantly-in-ubuntu-17-1?rq=1
https://ubuntuforums.org/showthread.php?t=2270015

2018년 5월 15일 화요일

Switch gcc versions between 4.9 and 5.4 or over

ref: https://codeyarns.com/2015/02/26/how-to-switch-gcc-version-using-update-alternatives/

after setting
$ sudo update-alternatives --config gcc

2018년 5월 1일 화요일

How to use another gpu when the first gpu is out of memory

tip: https://github.com/BVLC/caffe/issues/440
http://kawahara.ca/caffe-how-to-specify-which-gpu-to-use-in-pycaffe/

before initializing gpu, set the gpu_id first
Errors in Caffe

Traceback (most recent call last):
  File "Scripts/compute_bn_statistics.py", line 15, in <module>
    import caffe
  File "/home/morinjwang/DL/caffe-segnet-cudnn5/python/caffe/__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
  File "/home/morinjwang/DL/caffe-segnet-cudnn5/python/caffe/pycaffe.py", line 13, in <module>
    from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: dynamic module does not define init function (init_caffe)

check if you compile your Caffe library using python 2.7 OR python 3.*

2018년 4월 30일 월요일

Errors when installing Caffe

설치 하라는거 설치 잘 하고, 위치 정확히 지정해 주고, 에러메시지 잘 해독하면 된다
Tutorial of training ENet using caffe
(https://github.com/TimoSaemann/ENet/tree/master/Tutorial)

+ how to deal with the number of labels in images using cityscapes dataset

No multiple gpu support
(https://github.com/TimoSaemann/ENet/issues/53)

2018년 3월 6일 화요일

NFS(Network File System)

:without using direct connection via USB cable, or using ssh or minicom

LINK: https://www.fun25.co.kr/blog/linux-ubuntu-16-04-nfs-setting/

2018년 3월 4일 일요일

Getting 403 forbidden error in sudo apt-get update

sol: resetting apt repository
(LINK: https://ksy3241blog.wordpress.com/2016/06/17/sudo-apt-get-update-%EC%97%90%EB%9F%AC/)


Trial and error to follow SegNet-Tutorial(3) 
(link: http://mi.eng.cam.ac.uk/projects/segnet/tutorial.html)

5. training SegNet using Cityscapes dataset
number of labels in Cityscapes dataset: 34 (id 0 to 33)
re-grouping labels into 11+1 classes ( sky, building, pole, road, pavement, tree, signsymbol, fence, car, pedestrian, bicyclist, unlabelled )

(to-be-updated)

2018년 1월 17일 수요일

Trial and error to follow SegNet-Tutorial(2)
(link: http://mi.eng.cam.ac.uk/projects/segnet/tutorial.html)

4. test my own data
1) change the path of dense_image_data_param-source in *.prototxt file

========================================================================
segnet_inference_kitti.prototxt
name: "VGG_ILSVRC_16_layer"
layer {
  name: "data"
  type: "DenseImageData"
  top: "data"
  top: "label"
  dense_image_data_param {
    source: "/home/morinjwang/data/JWang2017IROS/test.txt" # Change this to the absolute path to your data file
    batch_size: 1
  }
}
========================================================================

Note that if you want to automatically resize the testing images, try to add two lines below

========================================================================
segnet_inference_kitti.prototxt
name: "VGG_ILSVRC_16_layer"
layer {
  name: "data"
  type: "DenseImageData"
  top: "data"
  top: "label"
  dense_image_data_param {
    source: "/home/morinjwang/data/JWang2017IROS/test.txt" # Change this to the absolute path to your data file
    batch_size: 1
    new_height: 360
    new_width: 480
  }
}
========================================================================

2) make the test.txt file (/path/of/the/original/image /path/of/the/corresponding/groundtruth/image)

========================================================================
text.txt
...
/home/morinjwang/data/JWang2017IROS/image_02/0000/000110.png  /home/morinjwang/data/JWang2017IROS/img_gth/segments/0000/000110.png
...
========================================================================

3) run test_segmentation_camvid.py

2018년 1월 8일 월요일

Trial and error to follow SegNet-Tutorial(1)
(link: http://mi.eng.cam.ac.uk/projects/segnet/tutorial.html)

1. download caffe-segnet or caffe-segnet-cudnn accelerated version
- choose one considering your ubuntu configuration. In my case, I tried both, however, I used the 'caffe-segnet-cudnn'

(from https://github.com/ethereon/caffe-tensorflow/issues/118)
Note. we SHOULD download above caffe without using pre-installed caffe. because some parameters are deprecated and no longer valid in our current Caffe version (updated on 1.8.2018).
you can see the definitions in ${CAFFE_ROOT}/src/caffe/proto/caffe.proto

Ex) 
message LayerParameter{
  ...
  optional BNParameter bn_param = 45;
  ...
}

message BNParameter{
  ...
  optional FillerParameter scale_filler = 1;  // The filler for the scale
  optional FillerParameter shift_filler = 2;  // The filler for the shift
}
>> those parameters are no longer valid in current version of Caffe.

2. download trained weights
(link: https://github.com/alexgkendall/SegNet-Tutorial/blob/master/Example_Models/segnet_model_zoo.md)
- For testing segmentation performance of urban scenes, download two files:

CAMVID-SegnetBasic:  
http://mi.eng.cam.ac.uk/~agk34/resources/SegNet/segnet_basic_camvid.caffemodel ( segnet_basic_camvid.prototxt)
Cityscapes: 
http://mi.eng.cam.ac.uk/~agk34/resources/SegNet/segnet_iter_30000_timo.caffemodel ( segnet_model_driving_webdemo.prototxt)

3. testing the SegNet
using downloaded weights, we can test the network.
1) run test_segmentation_camvid.py
> python SegNet-Tutorial/Scripts/test_segmentation_camvid.py --model SegNet-Tutorial/Models/segnet_inference.prototxt --weights SegNet-Tutorial/Models/Inference/segnet_iter_30000_timo.caffemodel --iter 233

Note. for pretrained weights using cityscapes, author used 11-class model.
In 'test_segmentation_camvid.py' ignore 4th class 'road_marking'
you need to modify the example script a little bit

========================================================================
Activate conda environment

https://conda.io/docs/user-guide/tasks/manage-python.html

========================================================================
Caffe-segnet-cudnn build error
when uncommenting 'use_cudnn = 1', there is an error as follows:
...
bc: symbol lookup error: /opt/anaconda3/lib/libreadline.so.6: undefined symbol: PC
...

try to install readline properly in conda (with ncurses)
https://github.com/conda-forge/rpy2-feedstock/issues/1

2018년 1월 7일 일요일

CAFFE + ANACONDA + PYTHON3.* + CUDA8 + OpenCV3 install reference

https://guozhilingblog.wordpress.com/2016/10/10/caffepython3-5anaconda3opencv3-1cuda7-5ubuntu14-04/
https://yangcha.github.io/Caffe-Conda/
http://blog.csdn.net/lien0906/article/details/51784191
http://yingshu.ink/2017/01/12/Python3-5-Anaconda3-Caffe%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0%E6%A1%86%E6%9E%B6%E6%90%AD%E5%BB%BA/
https://hub.docker.com/r/yangcha/caffe-gpu-conda/~/dockerfile/

2018년 1월 6일 토요일

VIM cheatsheet

(from http://itisfun.tistory.com/281)
Kill processes in ubuntu

ps -ef | grep PROCESSNAME
sudo kill -9 PID

http://121202.tistory.com/45
Instruction of visdom (official github site)

https://github.com/facebookresearch/visdom
Visdom running error (Python3.6.1+anaconda+multiuser env)

Error like "Could not open static file"

1. Try to change the lines in /opt/anaconda3/lib/python3.6/site-packages/visdom/static/index.html
following the link
http://blog.csdn.net/xiaocainiaodeboke/article/details/78941243

(https://github.com/facebookresearch/visdom/issues/185, help)

2. Manually download the missing files. For my case, 'fonts/classnames' and 'fonts/layout_bin_packer' are missing. Try to download the files in the following links

'fonts/classnames': http://jedwatson.github.io/classnames
'fonts/layout_bin_packer': https://github.com/stefanpenner/layout-bin-packer

(Updated 21:29 18.1.6)
because of classnames and layout_bin_packer directories which I made by hand (stupid)

Note that after "pip uninstall visdom", files are not clearly removed in case of the downloaded scripts when you first run visdom.



SSD(Single shot detector) PyTorch implementation github link, tutorial

https://github.com/amdegroot/ssd.pytorch#download-voc2007-trainval--test

2018년 1월 5일 금요일

GPU usage check in Ubuntu

http://dongjinlee.tistory.com/entry/Check-the-gpu-usage-in-Ubuntu

========================================================================

CUDA version check

nvcc --

========================================================================

CUDNN version check

cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

2018년 1월 4일 목요일

Permission denied 13 error for running visdom.server

chmod 775 -R /directory/you/want/to/modify

https://askubuntu.com/questions/536392/error-13-permission-denied
Python Numpy sum error (single-shot multibox object detector in PyTorch)

https://stackoverflow.com/questions/46420007/numpy-sum-got-an-keepdims-error

By updating PyTorch version to 0.2 > problem is solved

https://discuss.pytorch.org/t/updating-pytorch/309