Skip to content

Instantly share code, notes, and snippets.

import sys
from six import StringIO
from gym import utils
from gym.envs.toy_text import discrete
import numpy as np
MAP = [
"+---------+",
"|R: | : :G|",
"| : : : : |",
@nagataka
nagataka / q_taxi.py
Created June 8, 2018 17:59
Q learning template for taxi domain
# activation command
# 'workon rl'
import gym
import numpy as np
env = gym.make('Taxi-v2')
NUM_OF_EPISODE = 10000
"""Note for reset
@nagataka
nagataka / face_detector.py
Last active August 21, 2019 12:53
Facial landmark detector with dlib
import numpy as np
from scipy.spatial import procrustes
from scipy.linalg import orthogonal_procrustes
import matplotlib.pyplot as plt
from matplotlib.transforms import Affine2D
import argparse
import dlib
import cv2
from collections import OrderedDict
@nagataka
nagataka / note-openpose.txt
Created May 22, 2018 21:56
Install notes for openpose...
# https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md
git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose
cd openpose
sudo apt-get install cmake-qt-gui
sudo bash ./ubuntu/install_cmake.sh
sudo apt-get install libopencv-dev
sudo ubuntu/install_cuda.sh
sudo ubuntu/install_cudnn.sh
@nagataka
nagataka / setup.txt
Created April 27, 2018 03:45
setup Ubuntu
[apt]
sudo apt-get -y install vim git
sudo apt-get update
# https://github.com/openai/mlsh/blob/58f527ab7e3397eeb723a7309852b6d8791d5c24/gym/Dockerfile
sudo apt-get install -y libav-tools
sudo apt-get install -y python-numpy
sudo apt-get install -y python-scipy
sudo apt-get install -y python-pyglet
sudo apt-get install -y python-setuptools
sudo apt-get install -y libpq-dev
import tensorflow as tf
import numpy as np
bandits = [0.2, 0, -0.2, -5]
num_bandits = len(bandits)
def pull_bandit(bandit):
result = np.random.randn(1)
if result > bandit:
return 1
@nagataka
nagataka / q_gym.py
Created March 26, 2018 17:30
Simple Q-learning
import gym
import numpy as np
env = gym.make('Taxi-v2')
env.reset()
print(env.observation_space.n)
print(env.action_space.n)
env.render()
Q = np.zeros([env.observation_space.n, env.action_space.n])
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nagataka
nagataka / Datasets.md
Last active April 15, 2020 17:49
List of publicly available datasets
@nagataka
nagataka / ansible_playbook_neuroroboticplatform.yml
Created January 4, 2018 01:20
Ansible playbook for setting up Neurorobotic platform (ISO installation)
- hosts: 127.0.0.1
connection: local
vars:
pip_packages:
- tensorflow
- pandas
- matplotlib
tasks:
- name: install ros-kinetic-viewer
apt: