報酬の時間割引(Temporal Discounting)とは、将来得られる報酬の価値を現在と比較した際に、時間の遅れに応じてその価値を割り引いて評価する現象を指す ([セルフコントロール - 脳科学辞典](https://bsd.neuroinf.jp/w/index.php?title=%E3%82%BB%E3%83%AB%E3%83%95%E3%82%B3%E3%83%B3%E3%83%88%E3%83%AD%E3%83%BC%E3%83%AB&mobileaction=toggle_view_desktop#:~:text=%E8%A1%8C%E5%8B%95%E7%B5%8C%E6%B8%88%E5%AD%A6%E3%81%AB%E3%81%8A%E3%81%84%E3%81%A6%E3%81%AF%E3%80%81%E4%B8%8A%E8%BF%B0%E3%81%AE%E3%82%88%E3%81%86%E3%81%AA%E8%A1%9D%E5%8B%95%E7%9A%84%E8%A1%8C%E5%8B%95%E3%81%8C%E3%81%AA%E3%81%9C%E8%B5%B7%E3%81%8D%E3%82%8B%E3%81%AE%E3%81%8B%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%80%81%E6%99%82%E9%96%93%E5%89%B2%E5%BC%95%20%E5%95%8F%E9%A1%8C,1%5D%E3%80%82%E5%BE%93%E6%9D%A5%E3%81%AE%E7%B5%8C%E6%B8%88%E5%AD%A6%E3%83%A2%E3%83%87%E3%83%AB%E3%81%A7%E3%81%AF%E6%8C%87%E6%95%B0%E9%96%A2%E6%95%B0%20%E7%9A%84%E3%81%AA%E5%89%B2%E5%BC%95%E7%8E%87%E3%82%92%E6%83%B3%E5%AE%9A%E3%81%97%E3%81%A6%E3%81%8D%E3%81%9F%E3%80%82%E3%81%93%E3%81%AE%E3%83%A2%E3%83%87%E3%83%AB%E3%81%A7%E
Peter Dayanの強化学習への貢献や、報酬予測誤差の神経メカニズムに関する研究について詳しく調べます。
彼の研究がどのように強化学習理論に影響を与え、脳内の報酬システムとどのように関連しているのかを整理し、中級者向けに分かりやすく説明します。
結果がまとまり次第、お知らせします。
ピーター・デイアン(Peter Dayan)は、強化学習(RL)の分野を開拓した計算神経科学者であり、Q学習や時間差分学習 (TD学習) に関する基礎的業績で知られています (Peter Dayan - Wikipedia)。彼はクリス・ワトキンス(Chris Watkins)とともにQ学習アルゴリズムの開発に寄与し、1992年の共同論文ではQ学習が適切な条件下で最適な行動価値に収束することを証明しました (Peter Dayan - Wikipedia) ([Q-learning | Machine Learning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# カメラ内部パラメータ(内部パラメータ行列) | |
# ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, gray.shape[::-1], None, None) | |
# -----reading camera intrinsic matrix | |
cameraMatrix = np.loadtxt("calib/cameraMatrix.csv",delimiter=",") | |
distCoeffs = np.loadtxt("calib/distCoeffs.csv",delimiter=",") | |
# 外部パラメータ行列 | |
# https://gist.github.com/shks/e3cd5fc22ad9f4ddbccd5312a64803c3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
retval, rvec, tvec = aruco.estimatePoseBoard(corners, ids, board, cameraMatrix, distCoeffs, None, None) | |
#rvec, tvec : 3 float vector | |
#ロドリゲス公式で、rvecから回転行列へ変換する | |
Rmatrix, Jacob = cv2.Rodrigues(rvec) | |
# [3 x 4 matrix]で、R|t マトリクスを作成 | |
RTmatrix34_L = np.concatenate([Rmatrix, tvec], axis=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -load camera instrinsic matrix | |
cameraMatrix = np.loadtxt("calib/cameraMatrix.csv",delimiter=",") | |
distCoeffs = np.loadtxt("calib/distCoeffs.csv",delimiter=",") | |
# prepare the 'same' aruco board | |
aruco = cv2.aruco | |
dictionary = aruco.getPredefinedDictionary(aruco.DICT_4X4_50) | |
board = cv2.aruco.GridBoard_create(5, 5, 0.2,0.1,dictionary) | |
# retval = cv.aruco.GridBoard_create( markersX, markersY, markerLength, markerSeparation, dictionary[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cv2 import aruco | |
import cv2 | |
aruco_dict = aruco.Dictionary_get(aruco.DICT_6X6_250) | |
board = aruco.CharucoBoard_create(28, 16, 200, 140, aruco_dict) | |
imboard = board.draw((1920,1080)) | |
cv2.imwrite('CharucoBoard.png', imboard) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
arr = op('td_top').numpyArray('delayed=True') | |
gray = arr[:, :, 0] | |
gray = gray * 255.0 | |
gray = gray.astype(np.uint8) | |
#flip | |
gray = cv2.flip(gray, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import cv2 | |
import glob | |
_list = glob.glob("./some/*", recursive=True) | |
_list.sort() | |
fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') | |
video = cv2.VideoWriter('./some/video.mp4',fourcc, 60.0, (1024, 1024)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
_list = glob.glob("*.mov", recursive=True) | |
for fname in _list: | |
sampleName = os.path.basename(fname).split('.', 1)[0] | |
print(sampleName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import os | |
def save_all_frames(video_path, dir_path, basename, ext='jpg'): | |
cap = cv2.VideoCapture(video_path) | |
if not cap.isOpened(): | |
return | |
os.makedirs(dir_path, exist_ok=True) |
NewerOlder