この文章ではCNN実装であるCaffeを用いて,特徴ベクトルの抽出やパラメータの学習を行うための方法について説明する.
以下の作業を行いたいのであれば,Caffeを用いることが望ましい.
- CNNを利用した画像の多クラス分類
- CNNによる特徴ベクトルの抽出
- CNNの転移学習
- Stacked Auto Encoder
# (c) yoya@awm.jp 2019/06/20- | |
# ref) https://pillow.readthedocs.io/en/stable/reference/Image.html | |
import sys | |
from PIL import Image | |
_rgb2xyz_rec709 = ( | |
0.412453, 0.357580, 0.180423, 0, | |
0.212671, 0.715160, 0.072169, 0, # RGB mixing weight | |
0.019334, 0.119193, 0.950227, 0 ) |
#%% (0) Important libraries | |
import tensorflow as tf | |
import numpy as np | |
from numpy import random | |
import matplotlib.pyplot as plt | |
from IPython import display | |
% matplotlib inline | |
#%% (1) Dataset creation. |
#!/usr/bin ipython | |
import numpy as np | |
# data | |
X = np.asarray([(1.0, 1.0), (1.5, 2.0), (3.0, 4.0), (5.0, 7.0), (3.5, 5.0), (4.5, 5.0), (3.5, 4.5)]) | |
# Loyds algorithm with Forgy method | |
import random | |
# euclidian distance |
(require 'cl-lib) | |
;; Depends on s.el | |
(defun direnv-data (dir) | |
;; TODO: use dir for folder or smart current-project-dir variable | |
(let ((cmd (concat "$SHELL -i -c '" "cd " dir " && direnv export bash'"))) | |
(shell-command-to-string cmd))) | |
;;(direnv-data "~/src/direnv") | |
(defun commands-from-direnv (text) |
# ライブラリの読み込み | |
library(gpclib) | |
library(ggplot2) | |
library(maptools) | |
library(classInt) | |
library(RColorBrewer) | |
# gpclib ライセンス警告表示の抑止 | |
gpclibPermit() |
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) | |
(add-to-list 'auto-mode-alist '("\\.Rmd\\'" . markdown-mode)) | |
(add-to-list 'auto-mode-alist '("\\.rmd\\'" . markdown-mode)) | |
(add-hook 'markdown-mode-hook 'turn-on-outline-minor-mode) | |
(defun rmarkdown-new-chunk (name) | |
"Insert a new R chunk." | |
(interactive "sChunk name: ") | |
(insert "\n```{r " name "}\n") | |
(save-excursion |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import smtpd | |
import asyncore | |
import email | |
from email.message import Message | |
from email.header import decode_header | |
from email.utils import parseaddr | |
from optparse import OptionParser |
map $http_accept_language $lang { | |
default en; | |
~de de; | |
~en en; | |
} | |
location /foo/bar/baz/lang.js { | |
try_files $uri.$lang $uri; | |
} |
<?php | |
/* | |
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP) | |
Author: _ck_ (with contributions by GK, stasilok) | |
Version: 0.1.7 | |
Free for any kind of use or modification, I am not responsible for anything, please share your improvements | |
* revision history | |
0.1.7 2015-09-01 regex fix for PHP7 phpinfo | |
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter |