Skip to content

Instantly share code, notes, and snippets.

View PonDad's full-sized avatar

PonDad PonDad

View GitHub Profile
@PonDad
PonDad / apple_keras.py
Last active May 31, 2017 12:59
Google Assistant で 深層学習 - KerasをRaspberry Piで音声操作する
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Conv2D, MaxPooling2D
from keras.utils import np_utils
root_dir = "./image/"
categories = ["red_apple", "green_apple"]
nb_classes = len(categories)
image_size = 32
@PonDad
PonDad / app.py
Created April 29, 2017 15:32
Raspberry Pi にGoogle Assistant SDKを搭載して「OK Google」してみる
# -*- coding:utf-8 -*-
from bottle import route, run
import irm
import os
@route('/light_on')
def light_on():
irm.playIR("room_light_on.json")
irm.playIR("stand_light_on.json")
print("Light On!")
@PonDad
PonDad / agent.py
Last active October 25, 2017 15:06
reinforcement-learning
import numpy as np
import pandas as pd
class QLearning:
def __init__(self, actions, learning_rate=0.01, reward_decay=0.9, e_greedy=0.9):
# actions = [0, 1, 2, 3]
self.actions = actions
self.alpha = learning_rate
self.discount_factor = reward_decay
# -*- coding: utf-8 -*-
"""
Created on Thu May 5, 2016
@author: jonki
https://github.com/jojonki/reinforcement-practice/blob/master/simple-q-learning.py
こちらをPython3で動作する様に一部改変しました
"""
import numpy as np
import random
@PonDad
PonDad / PCA9685.py
Last active April 3, 2017 11:07
Raspberry Pi 人工無脳ロボットに感情モデルを持たせる
# Copyright (c) 2016 Adafruit Industries
# Author: Tony DiCola
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@PonDad
PonDad / app.py
Created March 25, 2017 15:26
Raspberry Pi ロボットをゼスチャーで操作する【GrovePi/Python3】
import grove_gesture_sensor
from grove_rgb_lcd import *
import time
import Adafruit_PCA9685
import grove_i2c_motor_driver
pwm = Adafruit_PCA9685.PCA9685()
pwm.set_pwm_freq(60)
m= grove_i2c_motor_driver.motor_driver()
@PonDad
PonDad / gesture.py
Last active March 21, 2017 14:02
Raspberry Pi ゼスチャーセンサーで操作する【GrovePi+】
import grove_gesture_sensor
from grove_rgb_lcd import *
import time
def main():
g=grove_gesture_sensor.gesture()
g.init()
setText("-\nNewtral")
setRGB(255,255,255) #White
while True:
@PonDad
PonDad / PCA9685.py
Last active November 9, 2017 08:46
Raspberry Pi サーボモーターとOpen CVで顔追跡カメラ(Haar-like)
# Copyright (c) 2016 Adafruit Industries
# Author: Tony DiCola
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@PonDad
PonDad / PCA9685.py
Last active April 4, 2018 09:02
Raspberry Pi サーボモーターとOpen CVで物体追跡カメラ(Meanshift)
# https://github.com/adafruit/Adafruit_Python_PCA9685 を少し書き換えています
# Copyright (c) 2016 Adafruit Industries
# Author: Tony DiCola
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@PonDad
PonDad / app.js
Created March 4, 2017 13:37
fastTextで音声入力をネガポジ判定する
var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var exec = require('child_process').exec;
var five = require("johnny-five");
var board = new five.Board();
app.use(express.static('public'));