knorth55's memo

Technical memo by @knorth55

Python

Light Head RCNN: Chainer implementation

I made Chainer implementation of Light Head RCNN. All codes are available on Github knorth55/chainer-light-head-rcnn. arXiv Github github.com

Get matched list quickly in python

If you do not consider the list order, it is better to use set and & operator. a = [1, 2, 3] b = [2, 3, 4] c = sorted(list(set(a) & set(b))) stackoverflow.com

Python2.7でUnicode文字をjoin

Python2.7でUnicode文字をjoinすると不思議なことになる >>> a = u'\U0001f607' >>> a u'\U0001f607' >>> print(a) >>> a = a.join(u'\U0001f607') >>> a u'\ud83d\U0001f607\ude07' >>> print(a) ??????Unicode文字をつなげる際は >>> a = u'\U0001f607' >…

PyGraphvizのインストールで "No package 'libcgraph' found" (OS X)

pipでpygraphvizを入れようとすると下記のようなエラーが出た。 $ sudo pip install pygraphviz Collecting pygraphviz Downloading pygraphviz-1.3.1.tar.gz (103kB) 100% |████████████████████████████████| 112kB 4.8MB/s Installing collected packages…

Pythonの引数が参照渡しである影響

Python 2.7でちょっとつまってしまったので検証してみたら、関数の引数は以下のような例で変更されるらしい。 Pythonは参照渡しなので可変オブジェクトであるリストに関してはこういった破壊的(?)な処理が行われます。参考サイト Pythonの引数は全て参照…