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
def objective(trial): | |
import keras | |
#セッションのクリア | |
keras.backend.clear_session() | |
num_layer = trial.suggest_int("num_layer", 3, 8) | |
mid_units = int(trial.suggest_discrete_uniform("mid_units", 100, 300, 100)) | |
num_filters = [int(trial.suggest_discrete_uniform("num_filter_"+str(i), 16, 128, 16)) for i in range(num_layer)] | |
dropout_rate = trial.suggest_uniform('dropout_rate', 0.0, 0.5) | |
metrics = trial.suggest_categorical('metrics', ['accuracy']) |
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
def create_model(num_layer, mid_units, num_filters, dropout_rate): | |
from keras.models import Sequential | |
from keras.layers import Dense, Dropout, Flatten | |
from keras.layers import Conv2D, MaxPooling2D | |
model = Sequential() | |
model.add(Conv2D(filters=num_filters[0], kernel_size=(3, 3), | |
activation="relu", | |
input_shape=(37, 110, 1))) | |
for i in range(1, num_layer): | |
model.add(Conv2D(filters=num_filters[i], kernel_size=(3,3), |
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
def load_data(path, isGray = False, isEqualLength = False, isFlat = False): | |
import sys | |
from PIL import Image | |
import random | |
import os | |
import numpy as np | |
from lib.json_data import read_by_key | |
from tensorflow.keras.utils import to_categorical | |
import copy | |
gun_list = read_by_key(os.path.join('settings', 'data.json'), 'gunList') |
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
# -*- coding: utf-8 -*- | |
import Adafruit_PCA9685 | |
import cv2 | |
import numpy as np | |
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input | |
from tensorflow.keras.preprocessing.image import img_to_array | |
from tensorflow.keras.models import load_model | |
import time |
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
wid = 10 # グラデーションの変化幅(%) | |
color_before = '#efefef' # もともとの背景色 | |
color_after = '#ffcc99' # 変化後の背景色 | |
first_duration = 35 # 1変化目の時間幅(%) | |
second_duration = 30 # 2変化目の時間幅(%) | |
class Bezier: | |
def __init__(self, p): | |
self.__p = p |
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 matplotlib.pyplot as plt | |
class Bezier: | |
def __init__(self, p): | |
self.__p = p | |
def calc(self, t): | |
return self.__calc(self.__p, t) | |
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
wid = 10 # グラデーションの変化幅(%) | |
color_before = '#efefef' # もともとの背景色 | |
color_after = '#ffcc99' # 変化後の背景色 | |
first_duration = 35 # 1変化目の時間幅(%) | |
second_duration = 30 # 2変化目の時間幅(%) | |
f = open('./css.txt', mode='w') | |
for i in range(first_duration): | |
p = i + 1 | |
f.write(' ' + str(p) + '% {\n background: linear-gradient(to right, ' + color_after + ' ' + |
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
// GETリクエスト | |
axios | |
.get("http://<localIP>:50001") | |
.then((response) => { | |
console.log(response); | |
}) | |
.catch((error) => { | |
console.log("<>", error); | |
}) |
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
[package] | |
name = "hello-world" | |
version = "0.1.0" | |
authors = ["kouya17 <my email>"] | |
edition = "2018" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
actix-web = "3" |
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
use actix_web::{get, post, web, App, HttpResponse, HttpServer, Responder}; | |
use serde::{Deserialize, Serialize}; | |
#[derive(Debug, Serialize, Deserialize)] | |
struct Operation { | |
kind: String, | |
user: String, | |
} | |
#[get("/")] |
NewerOlder