I am Charmie

メモとログ

Deep Learning

Computer Vision系のアノテーションツール

物体検出・追跡用データセット作成のためのアノテーションツールを探している. 要件は以下の通り. クロスプラットフォーム(Ubuntuu, Mac) 物体領域はポリゴン指定(バウンディングボックス駄目) アノテーションの修正が可能 Human-in-the-loopに使える …

Novel View Synthesis系論文とコード

まとめ CVPR 2020 Tutorial Novel-View Synthesis for Objects and Scenes from awesome neural rendering papers コード 動作確認済み 動作未確認 SynSin: End-to-end View Synthesis from a Single Image Nerf++ Generative View Synthesis: From Single-v…

PyTorch: visualize trained filters and feature maps

I just wrote a simple code to visualize trained filters and feature maps of pytorch. For simplicity, the below code uses pretrained AlexNet but the code must work with any network with Conv2d layers. [code lang="python"] !/usr/bin/env pyth…

PyTorch: fine-tune a pre-trained model

See the tutorial. Important note: torchvision provides several pre-trained models with their trained parameters. AlexNet, DenseNet, Inception, ResNet, VGG are available, see here. With pretrained=True, pre-trained parameters are available.…

PyTorch: at evaluation/test phase

I got a runtime error at evaluation phase of my simple siamese network as RuntimeError: cuda runtime error (2) : out of memory at the line of executing forward pass. Some comments on stackoverflow suggests to define x and y with volatile=T…

PyTorch: AutoGrad

See this tutorial. Set requires_grad=True for all tensors we compute gradients w.r.t. them. [code lang='python'] input and output x = torch.randn(N, D_in, device=device, dtype=dtype) y = torch.randn(N, D_out, device=device, dtype=dtype) pa…

PyTorch: define a neural network

See the tutorial. It's quite simple (Keras provides simpler interface though). A neural network is defined as a class that has a forward function. The forward function defines how input data is processed through the network. PyTorch automa…

PyTorch: installation

Super easy installation GUI on the web as below

libcudnn related error after Ubuntu apt update

I got "ImportError of libcudnn.so.6" after Ubuntu apt update although I have no idea how apt update causes the error. The solution is re-install cuDNN. Library files of cuDNN disappeared from a directory where is one of LD_LIBRARY_PATH. So…

tensorflow-gpu 1.4.0 + keras 2.1.1 on Ubuntu 16.04

Tensorflow 1.4.0 binary with CUDA 8 and cuDNN 6 Tensorflow 1.5.0 binary will be with CUDA 9 and cuDNN 7 The following procedure assumes that you use anaconda for python package manager. prepare for driver install Delete installed drivers b…

Keras install error with Anaconda 5.0.0 for Python 3.5.4

"pip install keras" returns the following TypeError. The solution found at StackOverflow says to 1. install html5lib by conda install --force html5lib 2. install keras by pip install keras

Keras: MNIST classification

Keras implementation for MNIST classification with batch normalization and leaky ReLU. [code lang="python"] import numpy as np import time import pandas as pd import matplotlib.pyplot as plt from keras.datasets import mnist from keras.mode…

Keras: error at the beginning of fit with Dropout

When Keras' model contains Dropout component in it, we must tell the model whether we are training or test mode because the network behaves differently. The solution is mentioned in github issue and Keras docs. [code lang="python"] from ke…

Keras: plot_model returns pydot and graphviz related error on Windows

plot_model of Keras installed on Windows may return pydot and graphviz related error like "Graphviz's executables are not found'. The error cause is that the computer does not know the path of Graphviz's executable exactly mentioned as the…

find a layer by name in Keras

[code lang="python"] for layer in model.layers layer_name = layer.get_config()['name'] print(layer_name) if layer_name is 'foo': print('foo') else: print('bar') [/code]

customize a model in Keras

Here's a note to customize a pre-defined model in Keras. This official information and stackoverflow post gave me how to do it. A Model is a list of layers (or layer instances) such as [code lang="python"] model = Sequential([ Dense(32, in…

時系列データに対するDeep Neural Networks

今後必要になってくるはずなのでまとめてみる. Recurrent Neural Network (回帰結合ニューラルネットワーク): 時系列データを扱うNN. 隠れ層の出力が2種類: 次の層へつながる出力,自身につながる出力 Back Propagation Through Time (BPTT): 自身につなが…

Implementation: CycleGAN and Pix2pix

The implementation of CycleGAN and Pix2pix based on pytorch is published on github. Here's a todo procedure with anaconda. The CPU mode installation is under test right now... pytorch installation see the repository For a machine with GPU …

Keras: multiple inputs & outputs

[code lang="python"] from keras.models import Model from keras.layers import Input, Dense input_1 = Input(..., name='input_1') x = Dense(...)(input_1) x = Dense(...)(x) ... output_1 = Dense(dim_output_1, ..., name='output_1') input_2 = Inp…

keras installation on ubuntu 16.04 with CUDA and cuDNN

install CUDA download cuda-repo-ubuntu1604_8.0.44-1_amd64.deb from here sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb sudo apt-get update sudo apt-get cuda update path settings add the following lines at the end of ~/.bashrc and typ…

Keras deep learning library installation on Ubuntu 14.04

[code lang="bash"] conda update conda conda update anaconda conda update --all conda install mingw libpython pip install --upgrade --no-deps theano pip install keras [/code]

Keras deep learning library installation on Windows

Keras, which works with either TensorFlow or Theano, is a library for using deep learning in Python. [code lang="bash"] step 1 prepare for the installation conda update conda conda update anaconda conda update --all conda install mingw lib…

Install TensorFlow on Linux

[code lang="bash"] pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl check installed version python -c "import tensorflow; print(tensorflow.version);" [/code]

install Chainer on Windows

install Microsoft Visual C++ Compiler for Python 2.7 from here install Chainer by pip install chainer