#include:
#include <linux/moduleparam.h>
from sqlalchemy.ext.declarative import declarative_base | |
#from sqlalchemy import * | |
#from sqlalchemy.orm import * | |
# Pro entity v podadresari. Podaresar *musi* obsahovat prazdny soubor __init__.py ! | |
#from entity.User import User | |
''' | |
Zavislosti: | |
# apt-get install python-sqlalchemy |
"""adapted from https://github.com/OlavHN/bnlstm to store separate population statistics per state""" | |
import tensorflow as tf, numpy as np | |
RNNCell = tf.nn.rnn_cell.RNNCell | |
class BNLSTMCell(RNNCell): | |
'''Batch normalized LSTM as described in arxiv.org/abs/1603.09025''' | |
def __init__(self, num_units, is_training_tensor, max_bn_steps, initial_scale=0.1, activation=tf.tanh, decay=0.95): | |
""" | |
* max bn steps is the maximum number of steps for which to store separate population stats | |
""" |
import numpy as np | |
from scipy.ndimage.interpolation import map_coordinates | |
from scipy.ndimage.filters import gaussian_filter | |
def elastic_transform(image, alpha, sigma, random_state=None): | |
"""Elastic deformation of images as described in [Simard2003]_. | |
.. [Simard2003] Simard, Steinkraus and Platt, "Best Practices for | |
Convolutional Neural Networks applied to Visual Document Analysis", in | |
Proc. of the International Conference on Document Analysis and | |
Recognition, 2003. |
7 | |
2 | |
1 | |
0 | |
4 | |
1 | |
4 | |
9 | |
5 | |
9 |
#!/usr/bin/env python | |
#coding=utf8 | |
########################################################################################## | |
import os | |
import logging | |
import logging.handlers | |
import traceback | |
from flask import Flask | |
from flask.ext.restful import reqparse, abort, Api, Resource | |
from flask import request |
########################################################################################## | |
import os | |
import sys | |
import json | |
import unittest | |
import pprint | |
import httplib | |
import urllib | |
import datetime | |
import random |
Long ago, the first time I read "The Pragmatic Programmer", I read some advice that really stuck with me.
"Don't Use Manual Procedures".
This in the chapter on Ubiquitous Automation. To summarize, they want you to automate all the things.
The trouble was that I hadn't much of an idea how to actually go
from __future__ import print_function | |
from keras.datasets import cifar10 | |
from keras.layers import merge, Input | |
from keras.layers.convolutional import Convolution2D, ZeroPadding2D, AveragePooling2D | |
from keras.layers.core import Dense, Activation, Flatten | |
from keras.layers.normalization import BatchNormalization | |
from keras.models import Model | |
from keras.preprocessing.image import ImageDataGenerator | |
from keras.utils import np_utils |